summaryrefslogtreecommitdiffstats
path: root/import-translations
diff options
context:
space:
mode:
authorWinterFairy <winterfairy@riseup.net>2013-11-27 21:19:47 +0000
committerWinterFairy <winterfairy@riseup.net>2013-11-29 13:49:47 +0000
commit4516a054797ad7f444494bafc7ebfc426344f209 (patch)
tree34e299b30abb82b652ebd269bfbba571654ba6c3 /import-translations
parent698e61656c4672198f17ddf696f95da5443319bb (diff)
Add an import-translation script.
This will make the importation of completed translations from Transifex automated. It does not import "fr" or "pt_BR", as they are translated in git instead. This script is based on a similar script from TorButton.
Diffstat (limited to 'import-translations')
-rwxr-xr-ximport-translations48
1 files changed, 48 insertions, 0 deletions
diff --git a/import-translations b/import-translations
new file mode 100755
index 0000000..26a4d5f
--- /dev/null
+++ b/import-translations
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+EXCLUDE_LANGS="fr pt_BR"
+
+# Clone or update the translation repository
+mkdir -p tmp
+cd tmp
+
+if [ -d translation ]; then
+ cd translation
+ git fetch origin
+ cd ..
+else
+ git clone https://git.torproject.org/translation.git
+fi
+
+# Checkout the correct branch
+cd translation
+
+git checkout tails-misc_completed
+git merge origin/tails-misc_completed
+
+# For each completely translated language, merge it,
+# unless it is translated outside Transifex
+for i in *.po; do
+ lang="`echo $i | tr - _ | sed 's/\.po$//'`"
+
+ skip='n'
+ for j in $EXCLUDE_LANGS; do
+ if [ "$lang" = "$j" ]; then skip='y'; fi
+ done
+
+ if [ "$skip" = 'n' ]; then
+ echo $lang
+ cp $lang.po ../../po/
+ fi
+done
+
+# Fix syntax of the po files
+cd ../../po
+
+for i in *.po; do
+ lang="`echo $i | tr - _ | sed 's/\.po$//'`"
+
+ intltool-update --dist --gettext-package=tails $lang
+done