3 # This var comes from the TBB locale list.
4 # XXX: Find some way to keep this, tor-launcher, and Tor Browser in sync
5 BUNDLE_LOCALES
="ar de es fa fr it ko nl pl pt ru tr vi zh-CN"
7 # XXX: Basque (eu) by request in #10687.
8 # This is not used for official builds, but should remain
9 # so Basque XPIs can be build independently. We can do
10 # this for other languages too, if anyone requests this
11 # and translations are available.
12 BUNDLE_LOCALES
="$BUNDLE_LOCALES eu ja sv"
14 LOCALE_DIR
=..
/src
/chrome
/locale
16 # FILEMAP is an array of "localeFile:translationBranch" strings.
17 FILEMAP
=( "aboutDialog.dtd:torbutton-aboutdialogdtd"
18 "aboutTor.dtd:abouttor-homepage"
19 "aboutTor.properties:torbutton-abouttorproperties"
20 "aboutTBUpdate.dtd:torbutton-abouttbupdatedtd"
21 "brand.dtd:torbutton-branddtd"
22 "brand.properties:torbutton-brandproperties"
23 "torbutton.dtd:torbutton-torbuttondtd"
24 "torbutton.properties:torbutton-torbuttonproperties"
27 # Verify that the FILEMAP contains an entry for each Torbutton file.
29 for DEST_PATH
in $LOCALE_DIR/en
/*.dtd
$LOCALE_DIR/en
/*.properties
;
32 DEST_FILE
=${DEST_PATH##*/}
33 for KEYVAL
in "${FILEMAP[@]}";
36 if [ $FILE = $DEST_FILE ];
43 if [ $IS_FILE_IN_MAP -eq 0 ];
45 echo "Please add $DEST_FILE to FILEMAP." 1>&2
50 if [ $FILES_ARE_MISSING -ne 0 ];
55 # Clone or update our translation repo.
56 if [ -d translation
];
62 git clone https
://git.torproject.org
/translation.git
65 # Update each translated file for each locale.
66 echo "Locales: $BUNDLE_LOCALES"
68 for KEYVAL
in "${FILEMAP[@]}"; do
69 DEST_FILE
="${KEYVAL%%:*}"
70 BRANCH
="${KEYVAL##*:}"
71 echo "Updating ${DEST_FILE}..."
72 git checkout
-q "$BRANCH"
73 git merge
-q origin
/"$BRANCH"
74 for i
in $BUNDLE_LOCALES;
77 mkdir
-p ..
/$LOCALE_DIR/$i/
78 # Some file names are lowercase in Transifex.
79 if [ -f $UL/"$DEST_FILE" ]; then
82 SRCFILE
="`echo $DEST_FILE | tr '[:upper:]' '[:lower:]'`"
84 # Use sed to work around a Transifex "double entity" issue.
85 sed -e 's/\&brandShortName;/\&brandShortName;/g' \
86 -e 's/\&vendorShortName;/\&vendorShortName;/g' \
87 $UL/"$SRCFILE" > ..
/$LOCALE_DIR/$i/"$DEST_FILE"