[go: up one dir, main page]

Menu

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

Download this file

47 lines (43 with data), 1.4 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
39
40
41
42
43
44
45
46
#!/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;
rm -f *~;
elif [ "$1" == "compile" ]; then
cd po;
mkdir -p utf8 iso8859;
for l in $LANGS; do
mkdir -p ../src/locale/$l/LC_MESSAGES/ utf8/$l iso8859/$l;
echo "* Compiling translation for $l...";
# UTF-8
msgfmt $l.po -o utf8/$l/gimagereader.mo;
cp utf8/$l/gimagereader.mo ../src/locale/$l/LC_MESSAGES/gimagereader.mo;
# ISO-8859-1
sed 's/charset=UTF-8/charset=ISO-8859-1/' < $l.po > $l.iso8859.po
msgfmt $l.iso8859.po -o iso8859/$l/gimagereader.mo;
rm $l.iso8859.po
done;
fi;
echo "* Done!";
exit 0;