summaryrefslogtreecommitdiffstats
path: root/import-translations
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2016-05-31 12:43:06 +0000
committerintrigeri <intrigeri@boum.org>2016-05-31 12:43:06 +0000
commit161d24e8804ba7d8e621430d3f42af460d9a76b6 (patch)
tree2cd72094d0d69c04587a99d7a1905306a7a28713 /import-translations
parent46726251098e83234b6435350ced61ff58674947 (diff)
import-translations: add support for Onion Circuits translatations' Git repo layout.
For some reason, this one has $LANG/onioncircuits.pot instead of the usual $LANG.po. refs: #11160
Diffstat (limited to 'import-translations')
-rwxr-xr-ximport-translations30
1 files changed, 23 insertions, 7 deletions
diff --git a/import-translations b/import-translations
index a74ad8e..3e788d7 100755
--- a/import-translations
+++ b/import-translations
@@ -20,6 +20,9 @@ lang_is_excluded () {
echo -n "$EXCLUDE_LANGS" | grep -qs -w "$lang"
}
+# Defaults
+LANG_DOT_PO_LAYOUT=yes
+
# Detect which project is in current folder,
# and set parameters accordingly
if [ -f 'po/tails.pot' ]; then
@@ -32,6 +35,8 @@ elif [ -f 'po/tails-iuk.pot' ]; then
BRANCH='tails-iuk_completed'
AFTER_IMPORT='make -C po pot && make -C po update-po'
elif [ -f 'po/onioncircuits.pot' ]; then
+ LANG_DOT_PO_LAYOUT=no
+ POTFILE=onioncircuits.pot
BRANCH='tails-onioncircuits_completed'
AFTER_IMPORT='./setup.py build_i18n && ( cd po && for po in *.po ; do msgmerge --update "$po" onioncircuits.pot ; done )'
elif [ -f 'po/tails-perl5lib.pot' ]; then
@@ -65,14 +70,25 @@ eval "$GIT_IN_TOR_TRANSLATION_DIR reset --hard \"origin/$BRANCH\""
# For each completely translated language, merge it,
# unless it is translated outside Transifex
-find "$TOR_TRANSLATION_DIR" -name '*.po' | while read po_file; do
- lang=$(basename "$po_file" | tr - _ | sed 's/\.po$//')
+if [ "$LANG_DOT_PO_LAYOUT" = yes ] ; then
+ find "$TOR_TRANSLATION_DIR" -name '*.po' | while read po_file; do
+ lang=$(basename "$po_file" | tr - _ | sed 's/\.po$//')
+
+ if ! lang_is_excluded "$lang"; then
+ echo "Importing translation for $lang..."
+ cp "$po_file" "$TAILS_PO_DIR"
+ fi
+ done
+else
+ find "$TOR_TRANSLATION_DIR" -name '*.pot' | while read po_file; do
+ lang=$(basename $(dirname "$po_file" | tr - _ | sed 's/\.pot$//'))
- if ! lang_is_excluded "$lang"; then
- echo "Importing translation for $lang..."
- cp "$po_file" "$TAILS_PO_DIR"
- fi
-done
+ if ! lang_is_excluded "$lang"; then
+ echo "Importing translation for $lang..."
+ cp "$po_file" "$TAILS_PO_DIR/${lang}.po"
+ fi
+ done
+fi
# Update PO files
if [ -n "${AFTER_IMPORT:-}" ]; then