Skip to content

Commit b084e76

Browse files
committed
Add script for generating mo files
Signed-off-by: Michal Čihař <michal@cihar.com>
1 parent bfcc89f commit b084e76

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

scripts/generate-mo

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
if [ x$1 = x--quiet ] ; then
3+
stats=""
4+
shift
5+
else
6+
stats="--statistics"
7+
fi
8+
9+
compile() {
10+
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
11+
if [ ! -z "$stats" ] ; then
12+
echo -n "$lang: "
13+
fi
14+
mkdir -p locale/$lang/LC_MESSAGES
15+
msgfmt $stats --check -o locale/$lang/LC_MESSAGES/sqlparser.mo $1
16+
return $?
17+
}
18+
19+
if [ ! -z "$1" ] ; then
20+
compile po/$1.po
21+
exit $?
22+
fi
23+
24+
result=0
25+
for x in po/*.po ; do
26+
compile $x
27+
ret=$?
28+
if [ $ret != 0 ] ; then
29+
tput setf 4 >&2
30+
echo Error when compiling $x >&2
31+
tput sgr0 >&2
32+
result=$ret
33+
fi
34+
done
35+
36+
exit $result

scripts/update-po

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ for loc in $LOCS ; do
4141
msgmerge --previous -U po/$loc.po po/sqlparser.pot
4242
done
4343

44+
# Generate mo files as well
45+
./scripts/generate-mo
46+
4447
# Commit changes
4548
git add po/*.po po/sqlparser.pot
46-
git commit -s -m 'Update po files
49+
git add locale
50+
git commit -s -m 'Update translations
4751
4852
[CI skip]'

0 commit comments

Comments
 (0)