summaryrefslogtreecommitdiff
path: root/po-locations/regen.sh
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 21:42:39 -0300
committerPerberos <[email protected]>2011-12-01 21:42:39 -0300
commitfe8aea1c3b5348347633da18a02b0bffd3b266a1 (patch)
tree9881bf77df7572844707cc7c50bd8ca6b5a97076 /po-locations/regen.sh
downloadlibmateweather-fe8aea1c3b5348347633da18a02b0bffd3b266a1.tar.bz2
libmateweather-fe8aea1c3b5348347633da18a02b0bffd3b266a1.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'po-locations/regen.sh')
-rwxr-xr-xpo-locations/regen.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/po-locations/regen.sh b/po-locations/regen.sh
new file mode 100755
index 0000000..f47e480
--- /dev/null
+++ b/po-locations/regen.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# Find a file called Locations.xml.in.h which is newer than both
+# ../data/Locations.xml.in and extract.xsl, and if it's not found,
+# build it. In other words, regenerate Locations.xml.in.h if it's
+# missing or out of date.
+find . -name Locations.xml.in.h \
+ -newer ../data/Locations.xml.in \
+ -newer extract.xsl \
+ -print | grep -q . || {
+ echo "Rebuilding Locations.xml.in.h"
+ xsltproc extract.xsl ../data/Locations.xml.in > Locations.xml.in.h
+}
+
+# Likewise locations.pot
+find . -name locations.pot \
+ -newer Locations.xml.in.h \
+ -print | grep -q . || {
+ echo "Rebuilding locations.pot"
+ xgettext --add-comments --output=locations.pot --from-code=utf-8 \
+ --keyword=N_ --keyword=NC_:1c,2 --no-location Locations.xml.in.h
+}
+
+# Now rebuild po files given on command line, if any
+status=0
+if [ -n "$*" ]; then
+ for po in "$@"; do
+ if [ -f $po ]; then
+ echo "Rebuilding $po"
+ msgmerge -U $po locations.pot
+ elif [ -f $po.po ]; then
+ echo "Rebuilding $po.po"
+ msgmerge -U $po.po locations.pot
+ else
+ echo "No such file: $po" 1>&2
+ status=1
+ fi
+ done
+fi
+
+exit $status