aboutsummaryrefslogtreecommitdiff
path: root/po/make-template.sh
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2010-09-13 19:24:53 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2010-09-13 19:24:53 +0200
commitb230b69539c1ec84c425da9808dceb5b13a37bb0 (patch)
tree11e0eb6338f03246ed7fc38d5dad6ccd649f1686 /po/make-template.sh
downloadlogdiag-b230b69539c1ec84c425da9808dceb5b13a37bb0.tar.gz
logdiag-b230b69539c1ec84c425da9808dceb5b13a37bb0.tar.xz
logdiag-b230b69539c1ec84c425da9808dceb5b13a37bb0.zip
Initial commit
Diffstat (limited to 'po/make-template.sh')
-rwxr-xr-xpo/make-template.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/po/make-template.sh b/po/make-template.sh
new file mode 100755
index 0000000..e688847
--- /dev/null
+++ b/po/make-template.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# This script makes a translation template
+# The reason for this not being inside CMakeLists.txt
+# is that the translator should not need to run
+# the whole configure process to get this single stupid file.
+
+# Get the package name from CMakeLists.txt
+PACKAGE=$(sed -n '/^[ \t]*[pP][rR][oO][jJ][eE][cC][tT][ \t]*([ \t]*\([^ \t)]\{1,\}\).*).*/{s//\1/p;q}' \
+ ../CMakeLists.txt)
+
+# Get the package version from CMakeLists.txt
+EXP_BEG='/^[ \t]*[sS][eE][tT][ \t]*([ \t]*'$PACKAGE'_VERSION_'
+EXP_END='[ \t]\{1,\}"\{0,1\}\([^)"]\{1,\}\)"\{0,1\}).*/{s//\1/p;q}'
+
+MAJOR=$(sed -n "${EXP_BEG}MAJOR${EXP_END}" ../CMakeLists.txt)
+MINOR=$(sed -n "${EXP_BEG}MINOR${EXP_END}" ../CMakeLists.txt)
+PATCH=$(sed -n "${EXP_BEG}PATCH${EXP_END}" ../CMakeLists.txt)
+
+if [ "$MAJOR" != "" ]; then
+ VERSION=$MAJOR
+ if [ "$MINOR" != "" ]; then
+ VERSION=$VERSION.$MINOR
+ if [ "$PATCH" != "" ]; then
+ VERSION=$VERSION.$PATCH
+ fi
+ fi
+fi
+
+# Finally make the template
+xgettext -LC -k_ -kN_:1,2 -kG_ ../src/*.c -o "$PACKAGE".pot \
+ --package-name="$PACKAGE" --package-version="$VERSION" \
+ --copyright-holder="Přemysl Janouch"
+