summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-03-01 16:22:53 +0100
committerMichal Čihař <michal@cihar.com>2016-12-21 15:02:38 +0100
commitb084e76773685e1000c45aa9f610fd496123b521 (patch)
treeb1edf8008a87e29d7a9d5196aef7191c0ce39969
parentbfcc89fd5578824f96baf2a19bba102f001f96e3 (diff)
downloadsql-parser-b084e76773685e1000c45aa9f610fd496123b521.zip
sql-parser-b084e76773685e1000c45aa9f610fd496123b521.tar.gz
sql-parser-b084e76773685e1000c45aa9f610fd496123b521.tar.bz2
Add script for generating mo files
Signed-off-by: Michal Čihař <michal@cihar.com>
-rwxr-xr-xscripts/generate-mo36
-rwxr-xr-xscripts/update-po6
2 files changed, 41 insertions, 1 deletions
diff --git a/scripts/generate-mo b/scripts/generate-mo
new file mode 100755
index 0000000..7192105
--- /dev/null
+++ b/scripts/generate-mo
@@ -0,0 +1,36 @@
+#!/bin/sh
+if [ x$1 = x--quiet ] ; then
+ stats=""
+ shift
+else
+ stats="--statistics"
+fi
+
+compile() {
+ lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
+ if [ ! -z "$stats" ] ; then
+ echo -n "$lang: "
+ fi
+ mkdir -p locale/$lang/LC_MESSAGES
+ msgfmt $stats --check -o locale/$lang/LC_MESSAGES/sqlparser.mo $1
+ return $?
+}
+
+if [ ! -z "$1" ] ; then
+ compile po/$1.po
+ exit $?
+fi
+
+result=0
+for x in po/*.po ; do
+ compile $x
+ ret=$?
+ if [ $ret != 0 ] ; then
+ tput setf 4 >&2
+ echo Error when compiling $x >&2
+ tput sgr0 >&2
+ result=$ret
+ fi
+done
+
+exit $result
diff --git a/scripts/update-po b/scripts/update-po
index 7612db3..4d96140 100755
--- a/scripts/update-po
+++ b/scripts/update-po
@@ -41,8 +41,12 @@ for loc in $LOCS ; do
msgmerge --previous -U po/$loc.po po/sqlparser.pot
done
+# Generate mo files as well
+./scripts/generate-mo
+
# Commit changes
git add po/*.po po/sqlparser.pot
-git commit -s -m 'Update po files
+git add locale
+git commit -s -m 'Update translations
[CI skip]'