summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-03 14:45:34 -0200
committerRenato Botelho <renato@netgate.com>2017-02-03 14:45:34 -0200
commit681264e0121c7a2e82c59dcc8e5d874b27da4078 (patch)
tree7b7c1d550f4a064b043c14d2b23b91df6bc1dafb /tools
parente64fed52290faedd180b82865de4b2b1f6e60086 (diff)
downloadpfsense-681264e0121c7a2e82c59dcc8e5d874b27da4078.zip
pfsense-681264e0121c7a2e82c59dcc8e5d874b27da4078.tar.gz
Add a script to update translations
Diffstat (limited to 'tools')
-rwxr-xr-xtools/scripts/update_translations.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/scripts/update_translations.sh b/tools/scripts/update_translations.sh
new file mode 100755
index 0000000..dd7adf6
--- /dev/null
+++ b/tools/scripts/update_translations.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+ldir=src/usr/local/share/locale
+: ${MSGFMT=$(which msgfmt)}
+
+if [ -z "${MSGFMT}" -o ! -e "${MSGFMT}" ]; then
+ echo "ERROR: msgfmt not found"
+ exit 1
+fi
+
+if [ ! -d $ldir ]; then
+ echo "ERROR: Locale dir (${ldir}) not found"
+ exit 1
+fi
+
+if ! ./tools/scripts/update_pot.sh; then
+ echo "ERROR: Unable to update pot"
+ exit 1
+fi
+
+if git status -s | grep -q "${ldir}/pot/pfSense.pot"; then
+ git add ${ldir}/pot/pfSense.pot
+ git commit -m "Regenerate pot"
+ if ! zanata-cli -B push; then
+ echo "ERROR: Unable to push pot to Zanata"
+ exit 1
+ fi
+fi
+
+#zanata-cli -B pull --min-doc-percent 75
+if ! zanata-cli -B pull; then
+ echo "ERROR: Unable to pull po files from Zanata"
+ exit 1
+fi
+
+unset commit
+for po in $(git status -s ${ldir}/*/*/pfSense.po | awk '{print $2}'); do
+ if ! $MSGFMT -o ${po%%.po}.mo ${po}; then
+ echo "ERROR: Error compiling ${po}"
+ exit 1
+ fi
+ git add $(dirname ${po})
+ commit=1
+done
+
+if [ -n "${commit}" ]; then
+ git commit -m "Update translation files"
+fi
OpenPOWER on IntegriCloud