From 981aa2995e5c7f2d271a4a680568ff22a396fd2d Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Thu, 13 Mar 2014 21:28:06 +0000 Subject: page community converted to gettext + bug fix (sorry for nonatomic commit) --- tools/extract2gettext.php | 2 +- tools/rebuild_gettext_catalogs.sh | 4 +++- tools/translated_converter.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/extract2gettext.php b/tools/extract2gettext.php index 1cbdb3a17..55f841a0f 100644 --- a/tools/extract2gettext.php +++ b/tools/extract2gettext.php @@ -113,7 +113,7 @@ foreach ($strings as $domain => $strs) { foreach ($strs as $str => $info) { $str = str_replace(array("\'", '"'), array("'", '\"'), $str); - $f[] = sprintf('msgctxt "%s"', $info[0]); + $f[] = sprintf('#: "%s"', $info[0]); // location of string in the source (#: reference...) $f[] = 'msgid "' . $str . '"'; $f[] = 'msgstr ""'; $f[] = ''; diff --git a/tools/rebuild_gettext_catalogs.sh b/tools/rebuild_gettext_catalogs.sh index afe8564af..50e3331b0 100755 --- a/tools/rebuild_gettext_catalogs.sh +++ b/tools/rebuild_gettext_catalogs.sh @@ -16,6 +16,7 @@ fi for resource in "${!resources[@]}" do + difference= if [ -f ./langs/en/$resource.pot ]; then # do a temporary copy cp ./langs/en/$resource.pot ./langs/en/$resource.copy fi @@ -30,6 +31,7 @@ do if [ $? -eq 1 ]; then # there are differences errors[$php_source]=0 mv ./langs/en/$resource.tmp ./langs/en/$resource.pot + echo Changes in ./langs/en/$resource.pot else # Cleanup as there are no changes in $resource errors[$php_source]=5 rm ./langs/en/$resource.tmp @@ -54,7 +56,7 @@ do fi if [ -f $directory/$resource.po ] && [ -z $difference ]; then # update po file if it exists # msgfmt --statistics --verbose -c $directory/$resource.po -o /dev/null # usefull for debuging (msgctxt "/web/en/ or msgctxt "en/) - echo merging $directory + echo merging $directory/$resource.po msgmerge --quiet --no-wrap $directory/$resource.po ./langs/en/$resource.pot > $directory/$resource.tmp msgmerge_error_level=$? # catch msgmerge error level mv $directory/$resource.tmp $directory/$resource.po diff --git a/tools/translated_converter.py b/tools/translated_converter.py index 58e9d9bb5..6418ababd 100644 --- a/tools/translated_converter.py +++ b/tools/translated_converter.py @@ -74,7 +74,7 @@ for langfile in glob.glob(file_mask): # Strip ';' from msgid message_id = message_id.lstrip(';') potentry = polib.POEntry( - msgctxt = message_comment, +# msgctxt = message_comment, msgid = message_id.decode('utf-8'), msgstr = message_str.decode('utf-8'), occurrences=[(langfile,'')] -- cgit v1.2.1