summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/xgettext.bat33
-rwxr-xr-xtools/xgettext.sh23
2 files changed, 56 insertions, 0 deletions
diff --git a/tools/xgettext.bat b/tools/xgettext.bat
new file mode 100644
index 0000000..18403db
--- /dev/null
+++ b/tools/xgettext.bat
@@ -0,0 +1,33 @@
+@echo off
+setlocal
+
+set me=%~n0
+
+rem # Uncomment the following line if gettext is not in your PATH.
+rem # Value must be absolute and end in a backslash.
+rem set gtprefix=C:\path\to\gettext\bin\
+
+if "%1" == "" (
+ echo Usage: %me% FILE... 1>&2
+ exit 1
+)
+
+set xgettext=%gtprefix%xgettext.exe
+set msgmerge=%gtprefix%msgmerge.exe
+
+md locale > nul 2>&1
+echo Generating template... 1>&2
+echo %xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
+%xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
+if %ERRORLEVEL% neq 0 goto done
+
+cd locale
+
+for %%f in (*.po) do (
+ echo Updating %%f... 1>&2
+ %msgmerge% --update %%f template.pot
+)
+
+echo DONE! 1>&2
+
+:done
diff --git a/tools/xgettext.sh b/tools/xgettext.sh
new file mode 100755
index 0000000..6de353c
--- /dev/null
+++ b/tools/xgettext.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+me=$(basename "${BASH_SOURCE[0]}");
+
+if [[ $# -lt 1 ]]; then
+ echo "Usage: $me FILE..." >&2;
+ exit 1;
+fi
+
+mkdir -p locale;
+echo "Generating template..." >&2;
+xgettext --from-code=UTF-8 -kS -kNS:1,2 -k_ \
+ -o locale/template.pot "$@" \
+ || exit;
+
+cd locale;
+
+for file in *.po; do
+ echo "Updating $file..." >&2;
+ msgmerge --update "$file" template.pot;
+done
+
+echo "DONE!" >&2;