aboutsummaryrefslogtreecommitdiff
path: root/src/php-gettext/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/php-gettext/bin')
-rw-r--r--src/php-gettext/bin/gettexts.bat20
-rwxr-xr-xsrc/php-gettext/bin/gettexts.sh12
2 files changed, 32 insertions, 0 deletions
diff --git a/src/php-gettext/bin/gettexts.bat b/src/php-gettext/bin/gettexts.bat
new file mode 100644
index 0000000..3ee4252
--- /dev/null
+++ b/src/php-gettext/bin/gettexts.bat
@@ -0,0 +1,20 @@
+@echo off
+xgettext -kT_ngettext:1,2 -kT_ -L PHP -o ..\..\..\locales\messages.po ..\..\..\*.php ..\..\..\services\*.php ..\..\..\templates\*.php
+if /i "%1" == "-p" goto stats
+if exist "..\..\..\locales\%1.po" goto merge
+echo "Usage: $0 [-p|<basename>]"
+goto end
+
+:stats
+msgfmt --statistics ..\..\..\locales\messages.po
+goto end
+
+:merge
+msgmerge -o ..\..\..\locales\tmp%1.po ..\..\..\locales\%1.po ..\..\..\locales\messages.po
+if exist "..\..\..\locales\%1.po" rename ..\..\..\locales\%1.po %1.po.bak
+rename ..\..\..\locales\tmp%1.po %1.po
+if exist "..\..\..\locales\%1.po.bak" del ..\..\..\locales\%1.po.bak
+msgfmt --statistics "..\..\..\locales\%1.po"
+
+:end
+echo Finished
diff --git a/src/php-gettext/bin/gettexts.sh b/src/php-gettext/bin/gettexts.sh
new file mode 100755
index 0000000..267f670
--- /dev/null
+++ b/src/php-gettext/bin/gettexts.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+xgettext -kT_ngettext:1,2 -kT_ -L PHP -o ../../../locales/messages.po ../../../*.php ../../../services/*.php ../../../templates/*.php
+
+if [ -f "../../../locales/$1/LC_MESSAGES/messages.po" ]
+then
+msgmerge -o ../../../locales/$1/LC_MESSAGES/messages.po ../../../locales/$1/LC_MESSAGES/messages.po ../../../locales/messages.po
+
+msgfmt --statistics "../../../locales/$1/LC_MESSAGES/messages.po" -o "../../../locales/$1/LC_MESSAGES/messages.mo"
+else
+echo "gettexts.sh LANGUAGE_CODE"
+echo "example: 'gettexts fr_FR' to get text for French"
+fi