forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_mo.sh
executable file
·53 lines (49 loc) · 1.49 KB
/
compile_mo.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
if [ ! -d lang/po ]
then
if [ -d ../lang/po ]
then
cd ..
else
echo "Error: Could not find lang/po subdirectory."
exit 1
fi
fi
# Check output dir here
# Backward compatibility
if [ -z $LOCALE_DIR ]
then
LOCALE_DIR="lang/mo"
fi
os="$(uname -s)"
# compile .mo file for each specified language
if [ $# -gt 0 ] && [ $1 != "all" ]
then
for n in $@
do
f="lang/po/${n}.po"
if ( [ "$n" == "en" ]) && ((! [ "${os##CYGWIN*}" ]) || (! [ "${os##MINGW*}" ])); then
# English is special: we do not actually need translation for English,
# but due to a libintl bug (https://savannah.gnu.org/bugs/index.php?58006),
# gettext would be extremely slow on MinGW targets if we do not compile
# a .mo file.
lang/update_pot.sh
msgen lang/po/cataclysm-dda.pot --output-file=${f}
fi
mkdir -p $LOCALE_DIR/${n}/LC_MESSAGES
msgfmt -f -o $LOCALE_DIR/${n}/LC_MESSAGES/cataclysm-dda.mo ${f}
done
else
# if nothing specified, compile .mo file for every .po file in lang/po
# English is special: see comments above
if (! [ "${os##CYGWIN*}" ]) || (! [ "${os##MINGW*}" ]); then
lang/update_pot.sh
msgen lang/po/cataclysm-dda.pot --output-file=lang/po/en.po
fi
for f in lang/po/*.po
do
n=`basename $f .po`
mkdir -p $LOCALE_DIR/${n}/LC_MESSAGES
msgfmt -f -o $LOCALE_DIR/${n}/LC_MESSAGES/cataclysm-dda.mo ${f}
done
fi