# This uses bash for the <() syntax.
# TODO: Is there a way we can ignore files with only fuzzy-string changes?
# These are the languages which are maintained in Transifex.
transifex_languages="sq ar ar_SA hy hy_AM ast be brx br my_MM ca cs nl en_AU en_GB et fi gl ka de el he hi hu id ga it ja ks kk km ku_IQ lv lt mai ms_MY mr ne nqo nb nn oc pa fa pl pt pt_BR ro ru szl sd sl es es_AR sv tt te tr uk uz cy
if ! which tx > /dev/null
You must install the Transifex command-line client:
http://docs.transifex.com/client/setup/
This script assumes your working tree is clean, at least in the po directory.
It pulls the translations from Transifex, works out what has changed, and
COMMITS intltool-update changes without prompting. It then leaves the
remaining changes for manual review and committing.
for i in $transifex_languages
XGETTEXT_ARGS=--no-location intltool-update $i
XGETTEXT_ARGS=--no-location intltool-update $i
if cmp -s <(grep ^msg $i.po.cleaned) <(grep ^msg $i.po)
# There were no actual changes.
changed_files="$changed_files $i.po"
if cmp -s <(grep ^msg $i.po.original) <(grep ^msg $i.po.cleaned)
# The cleaning produced no actual changes; undo the cleaning.
# The cleaning produced changes; leave it for committing.
commitable_files="$commitable_files $i.po"
rm -f $i.po.original $i.po.cleaned
# Commit cleaned versions of the changed files.
if [ -n "$commitable_files" ]
hg commit -u "Pidgin Translators <translators@pidgin.im>" \
-m "Clean changed translations" $commitable_files
# Leave the cleaned Transifex versions in place, ready for committing.