8 SCRIPT_DIR
=$
(readlink
-f "$(dirname "$0")")
9 TOR_TRANSLATION_REMOTE
='https://git.torproject.org/translation.git'
10 TOR_TRANSLATION_DIR
="$SCRIPT_DIR/tmp/tor-translation"
11 GIT_IN_TOR_TRANSLATION_DIR
="git \
12 --work-tree=\"$TOR_TRANSLATION_DIR\" \
13 --git-dir=\"$TOR_TRANSLATION_DIR/.git\""
15 ### External libraries
16 .
"$SCRIPT_DIR/config/chroot_local-includes/usr/local/lib/tails-shell-library/po.sh"
20 echo -n "$EXCLUDE_LANGS" |
grep -qs -w "$lang"
24 LANG_DOT_PO_LAYOUT
=yes
26 # Detect which project is in current folder,
27 # and set parameters accordingly
28 if [ -f 'po/tails.pot' ]; then
29 BRANCH
='tails-misc_completed'
30 AFTER_IMPORT
='intltool_update_po $(po_languages)'
31 elif [ -f 'po/tails-greeter.pot' ]; then
32 BRANCH
='tails-greeter-2_completed'
33 AFTER_IMPORT
='./setup.py build_i18n'
34 elif [ -f 'po/tails-iuk.pot' ]; then
35 BRANCH
='tails-iuk_completed'
36 AFTER_IMPORT
='make -C po pot && make -C po update-po'
37 elif [ -f 'po/onioncircuits.pot' ]; then
39 POTFILE
=onioncircuits.pot
40 BRANCH
='tails-onioncircuits_completed'
41 AFTER_IMPORT
='./setup.py build_i18n && ( cd po && for po in *.po ; do msgmerge --update "$po" onioncircuits.pot ; done )'
42 elif [ -f 'po/tails-perl5lib.pot' ]; then
43 BRANCH
='tails-perl5lib_completed'
44 AFTER_IMPORT
='make -C po pot && make -C po update-po'
45 elif [ -f 'po/tails-installer.pot' ]; then
46 BRANCH
='liveusb-creator_completed'
47 AFTER_IMPORT
='./setup.py build && cd po && for po in *.po ; do msgmerge --update "$po" tails-installer.pot ; done'
48 elif [ -f 'po/tails-persistence-setup.pot' ]; then
49 BRANCH
='tails-persistence-setup_completed'
50 AFTER_IMPORT
='make -C po pot && make -C po update-po'
51 elif [ -f 'po/whisperback.pot' ]; then
52 BRANCH
='whisperback_completed'
55 echo "Current folder is not a project known to this script!"
59 # Clone or update the translation repository
60 if [ -d "$TOR_TRANSLATION_DIR" ]; then
61 eval "$GIT_IN_TOR_TRANSLATION_DIR fetch origin"
63 mkdir
-p "$SCRIPT_DIR/tmp"
64 git clone
"$TOR_TRANSLATION_REMOTE" "$TOR_TRANSLATION_DIR"
67 # Checkout the correct branch
68 eval "$GIT_IN_TOR_TRANSLATION_DIR checkout \"$BRANCH\""
69 eval "$GIT_IN_TOR_TRANSLATION_DIR reset --hard \"origin/$BRANCH\""
71 # For each completely translated language, merge it,
72 # unless it is translated outside Transifex
73 if [ "$LANG_DOT_PO_LAYOUT" = yes ] ; then
74 find "$TOR_TRANSLATION_DIR" -name '*.po' |
while read po_file
; do
75 lang
=$
(basename "$po_file" |
tr - _ |
sed 's/\.po$//')
77 if ! lang_is_excluded
"$lang"; then
78 echo "Importing translation for $lang..."
79 cp "$po_file" "$TAILS_PO_DIR"
83 find "$TOR_TRANSLATION_DIR" -name '*.pot' |
while read po_file
; do
84 lang
=$
(basename $
(dirname "$po_file" |
tr - _ |
sed 's/\.pot$//'))
86 if ! lang_is_excluded
"$lang"; then
87 echo "Importing translation for $lang..."
88 cp "$po_file" "$TAILS_PO_DIR/${lang}.po"
94 if [ -n "${AFTER_IMPORT:-}" ]; then