File: update_localizations.sh

package info (click to toggle)
pytrainer 2.0.0~rc1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,916 kB
  • sloc: python: 15,815; perl: 6,084; xml: 195; sql: 151; makefile: 84; sh: 46
file content (21 lines) | stat: -rwxr-xr-x 861 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
LOCALE_BASE_PATH="locale"
cd ../
echo -n "Extracting translatable strings... "
xgettext glade/*.ui -o ./messages.pot
find ./ -iname "*.py" -exec xgettext -k_ -j -o ./messages.pot {} \;
echo "OK"

for LANGUAGE in `ls -l $LOCALE_BASE_PATH | awk {'print $9'}`; do
    echo -n "Creating new $LANGUAGE po file... "
    msginit --no-translator -i ./messages.pot -l $LANGUAGE -o ./locale/$LANGUAGE/LC_MESSAGES/pytrainer_$LANGUAGE.po_new
    echo -n "Merging with old po file... "
    cd ./$LOCALE_BASE_PATH/$LANGUAGE/LC_MESSAGES/
    msgmerge -q pytrainer_$LANGUAGE.po pytrainer_$LANGUAGE.po_new > pytrainer_$LANGUAGE.po.tmp
    echo "OK"
    mv pytrainer_$LANGUAGE.po.tmp pytrainer_$LANGUAGE.po
    rm pytrainer_$LANGUAGE.po_new
    echo -n "Statistics for $LANGUAGE: "
    msgfmt --statistics pytrainer_$LANGUAGE.po -o ./pytrainer.mo
    cd ../../../
done