-
Notifications
You must be signed in to change notification settings - Fork 3
/
poter.sh
executable file
·34 lines (29 loc) · 1.05 KB
/
poter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#
# Script to create pot/po/mo files
basedir="$(pwd)/po"
cd "$(pwd)"
LANGLIST="en fr it ro pl_PL sr es cs_CZ de_DE ru zh_CN ar"
if [ "$1" = "cmo" ]; then
for lang in $LANGLIST; do
echo "genere le .mo $lang"
## finalise en creeant le .mo
mkdir -p $basedir/$lang/LC_MESSAGES &>/dev/null
msgfmt --output-file=$basedir/$lang/LC_MESSAGES/gmediafinder.mo $basedir/$lang.po
done
exit 0
fi
## cree pot fichier glade et des .py
xgettext -k_ -kN_ -o $basedir/gmediafinder.pot $(find /home/smo/Documents/gmediafinder | egrep "\.glade|[a-zA-Z].py$|\.pot" | xargs)
## create or update po files
for lang in $LANGLIST; do
if [ ! -e "$basedir"/$lang.po ]; then
msginit --input=$basedir/gmediafinder.pot --output=$basedir/$lang.po --locale=$lang_$(echo "$lang" | tr '[:lower:]' '[:upper:]')
else
msginit --input=$basedir/gmediafinder.pot --output=$basedir/$lang-update.po --locale=$lang_$(echo "$lang" | tr '[:lower:]' '[:upper:]')
msgmerge -U $basedir/$lang.po $basedir/$lang-update.po
## clean files
rm $basedir/$lang-update.po
rm $basedir/$lang.po~
fi
done