2 # This uses bash for the <() syntax.
4 # TODO: Is there a way we can ignore files with only fuzzy-string changes?
6 # These are the languages which are maintained in Transifex.
7 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
10 if ! which tx
> /dev
/null
13 You must install the Transifex command-line client:
14 http://docs.transifex.com/client/setup/
20 This script assumes your working tree is clean, at least in the po directory.
21 It pulls the translations from Transifex, works out what has changed, and
22 COMMITS intltool-update changes without prompting. It then leaves the
23 remaining changes for manual review and committing.
25 Ctrl-C now to abort...
36 for i
in $transifex_languages
40 cp $i.po
$i.po.original
41 XGETTEXT_ARGS
=--no-location intltool-update
$i
42 cp $i.po
$i.po.cleaned
46 XGETTEXT_ARGS
=--no-location intltool-update
$i
48 if [ -e $i.po.cleaned
]
50 if cmp -s <(grep ^msg
$i.po.cleaned
) <(grep ^msg
$i.po
)
52 # There were no actual changes.
53 mv $i.po.original
$i.po
56 mv $i.po
$i.po.transifex
57 changed_files
="$changed_files $i.po"
59 if cmp -s <(grep ^msg
$i.po.original
) <(grep ^msg
$i.po.cleaned
)
61 # The cleaning produced no actual changes; undo the cleaning.
62 mv $i.po.original
$i.po
64 # The cleaning produced changes; leave it for committing.
65 mv $i.po.cleaned
$i.po
66 commitable_files
="$commitable_files $i.po"
71 rm -f $i.po.original
$i.po.cleaned
74 # Commit cleaned versions of the changed files.
75 if [ -n "$commitable_files" ]
77 hg commit
-u "Pidgin Translators <translators@pidgin.im>" \
78 -m "Clean changed translations" $commitable_files
81 # Leave the cleaned Transifex versions in place, ready for committing.
82 for i
in $changed_files