updated PO files
[tails/vicves.git] / import-translations
blob3791b0102d0dd7de66fcb796aa26e481766edb1e
1 #!/bin/sh
3 set -e
4 set -u
6 EXCLUDE_LANGS='fr pt_BR'
7 TAILS_PO_DIR='po'
8 TOR_TRANSLATION_REMOTE='https://git.torproject.org/translation.git'
9 TOR_TRANSLATION_DIR='tmp/tor-translation'
10 GIT_IN_TOR_TRANSLATION_DIR="git \
11 --work-tree=$TOR_TRANSLATION_DIR \
12 --git-dir=$TOR_TRANSLATION_DIR/.git"
14 ### External libraries
15 . config/chroot_local-includes/usr/local/lib/tails-shell-library/po.sh
17 lang_is_excluded () {
18 local lang="$1"
19 echo -n "$EXCLUDE_LANGS" | grep -qs -w "$lang"
22 # Clone or update the translation repository
23 if [ -d "$TOR_TRANSLATION_DIR" ]; then
24 $GIT_IN_TOR_TRANSLATION_DIR fetch origin
25 else
26 mkdir -p tmp
27 git clone $TOR_TRANSLATION_REMOTE $TOR_TRANSLATION_DIR
30 # Checkout the correct branch
31 $GIT_IN_TOR_TRANSLATION_DIR checkout tails-misc_completed
32 $GIT_IN_TOR_TRANSLATION_DIR reset --hard origin/tails-misc_completed
34 # For each completely translated language, merge it,
35 # unless it is translated outside Transifex
36 for po_file in $TOR_TRANSLATION_DIR/*.po; do
37 lang=$(basename "$po_file" | tr - _ | sed 's/\.po$//')
39 if ! lang_is_excluded "$lang"; then
40 echo "Importing translation for $lang..."
41 cp "$po_file" "$TAILS_PO_DIR"
43 done
45 # Update PO files
46 intltool_update_po $(po_languages)