#!/bin/bash # What we get from Transifex is unusable and needs some fixing before we're able to use # the translations. FILE=$1 # Fix xliff tags perl -i -pe 's/<xliff:g id=\\?"(.*?)?\\?">//g' $FILE perl -i -pe 's/<\/xliff:g>/<\/xliff:g>/g' $FILE # Escape single and double quotes before and after xliff tags perl -i -pe 's/([^\\])(["'\''])(["'\''])/xliff:g>\\\1/g' $FILE # Restore "<" and ">" perl -i -pe 's/&(lt|gt);/&\1;/g' $FILE # -> perl -i -pe 's/"><\/string>/"\/>/g' $FILE # Escape single and double quotes (but not in comments or the xml tag) perl -i -pe 's/([^\\])'\''/\1\\'\''/g unless /(