[go: up one dir, main page]

Menu

[r68]: / trunk / localize.sh  Maximize  Restore  History

Download this file

39 lines (35 with data), 1.2 kB

 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
#!/bin/bash
if [ "$1" != "update" ] && [ "$1" != "compile" ]; then
echo -e "Usage: $0 update|compile\n\tupdate: update po files\n\tcompile: compile po files to mo files\n"
exit 1;
elif [ "$(whereis intltool)" == "intltool:" ] || [ "$(whereis xgettext)" == "xgettext:" ] || [ "$(whereis msginit)" == "msginit:" ] || [ "$(whereis msgfmt)" == "msgfmt:" ]; then
echo "Error: you need to have intltool and gettext installed.";
exit 1;
fi;
# Add languages here!
LANGS="de fr it";
if [ "$1" == "update" ]; then
cd src;
intltool-extract --type=gettext/glade gimagereader.xml;
xgettext -k_ -kN_ -o ../po/gimagereader.pot *.py *.h;
cd ../po;
for l in $LANGS; do
if [ ! -e $l.po ]; then
echo -n "* Creating translation for $l...";
msginit --input=gimagereader.pot --locale=$l;
else
echo -n "* Updating translation for $l...";
msgmerge -U $l.po gimagereader.pot;
fi;
done;
rm -f ../src/gimagereader.xml.h;
elif [ "$1" == "compile" ]; then
cd po;
for l in $LANGS; do
echo "* Compiling translation for $l...";
mkdir -p ../src/locale/$l/LC_MESSAGES/;
msgfmt $l.po -o ../src/locale/$l/LC_MESSAGES/gimagereader.mo;
done;
fi;
echo "* Done!";
exit 0;