summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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]'