-
Notifications
You must be signed in to change notification settings - Fork 0
/
localize
executable file
·53 lines (39 loc) · 1.33 KB
/
localize
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
CLEAN_LANGUAGES="en"
LANGUAGES="cs da de en es id it pl pt_BR ru zh_CN"
cd $(dirname $0)
if [ -n "$1" ] && [ "$1" = "refresh" ]; then
for f in data/tunnelmanager.glade.h msg/tunnelmanager.pot; do
if [ -e $f ]; then
rm -f $f
fi
done
for lang in $CLEAN_LANGUAGES; do
rm -f msg/$lang/tunnelmanager.po
done
fi
if [ ! -e msg/tunnelmanager.pot ]; then
if [ ! -e data/tunnelmanager.glade.h ]; then
intltool-extract --type=gettext/glade --update data/tunnelmanager.glade
[ $? -ne 0 ] && exit 1
fi
xgettext --language=Python --keyword=_ --keyword=N_ --output=msg/tunnelmanager.pot TunnelManager/*.py data/tunnelmanager.glade.h
[ $? -ne 0 ] && exit 1
fi
for lang in $LANGUAGES; do
if [ ! -d msg/$lang ]; then
mkdir msg/$lang || exit 1
fi
if [ ! -e msg/$lang/tunnelmanager.po ]; then
msginit --input=msg/tunnelmanager.pot --output-file=msg/$lang/tunnelmanager.po --locale=$lang
[ $? -ne 0 ] && exit 1
fi
if [ ! -d msg/$lang/LC_MESSAGES ]; then
mkdir msg/$lang/LC_MESSAGES || exit 1
fi
if [ -e msg/$lang/LC_MESSAGES/tunnelmanager.mo ]; then
rm -f msg/$lang/LC_MESSAGES/tunnelmanager.mo
fi
msgfmt --output-file=msg/$lang/LC_MESSAGES/tunnelmanager.mo msg/$lang/tunnelmanager.po
[ $? -ne 0 ] && exit 1
done