[phpwebapp-commits] CVS: web_app/l10n xgettext.sh,NONE,1.1 web_app.po,NONE,1.1 msgmerge.sh,NONE,1.1
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2005-11-01 13:24:37
|
Update of /cvsroot/phpwebapp/web_app/l10n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1556/l10n Added Files: xgettext.sh web_app.po msgmerge.sh msginit.sh msgfmt.sh delete.sh README Log Message: i18n and l10n of web_app messages --- NEW FILE: xgettext.sh --- #!/bin/bash ### go to this dir cd $(dirname $0) function get_translatable_strings { dir=$1 module=$2 mkdir -p $dir/l10n/ touch $dir/l10n/$module.po find $dir -name '*.php' -o -name '*.js' -o -name '*.html' \ | xargs xgettext -C --keyword=T_ --join-existing \ --output-dir=$dir/l10n/ --output=$module.po # if it is not greater than zero, delete it if [ ! -s $dir/l10n/$module.po ] then rm -rf $dir/l10n/ fi } ### get the translatable strings of webobjects, webboxes and tools, ### from HTML, JS and PHP files path_list="../boxes ../webobjects ../tools" for path in $path_list do module_list=$(ls $path/) for module in $module_list do get_translatable_strings $path/$module $module done done ### get the translatable strings for the rest of the application app_name=$(./get_app_name.sh) touch web_app.po find .. -path '../boxes' -prune \ -o -path '../webobjects' -prune \ -o -path '../tools' -prune \ -o -name '*.php' -print \ -o -name '*.js' -print \ -o -name '*.html' -print \ | xargs xgettext -C --keyword=TF_ --join-existing --output=web_app.po --- NEW FILE: web_app.po --- # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2005-11-01 10:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../session/class.Session.php:200 msgid "DB var 'v_var_name' shadows an existing JS var with the same name." msgstr "" #: ../session/class.Session.php:210 msgid "" "JS var 'v_var_name' is shadowed by an existing DB var with the same name." msgstr "" #: ../session/class.Session.php:310 msgid "" "session DB vars saved as JS vars, there is no DB connection, make 'true' the " "USES_DB constant in 'config/const.Settings.php'." msgstr "" #: ../parser/class.Parser.php:95 msgid "file 'v_filename' does not exist" msgstr "" #: ../parser/class.Parser.php:630 ../parser/class.Parser.php:628 msgid "<IfEmpty> element can be used only inside a <Repeat> element" msgstr "" #: ../parser/class.Parser.php:661 ../parser/class.Parser.php:659 msgid "<Separator> element can be used only inside a <Repeat> element" msgstr "" #: ../parser/class.Parser.php:798 msgid "Redeclaration of <WebClass ID=\"v_id\">." msgstr "" #: ../parser/class.Parser.php:835 ../parser/class.Parser.php:839 msgid "<parameter/> can be used only inside a <webclass> element." msgstr "" #: ../parser/class.Parser.php:859 ../parser/class.Parser.php:863 msgid "<WebClass> 'v_class_name' is not defined." msgstr "" #: ../parser/class.Parser.php:931 ../parser/class.Parser.php:935 msgid "Recordset 'v_id': type 'v_type' is unknown" msgstr "" #: ../parser/class.WebObject.php:168 msgid "unreckognized \\$type 'v_type'" msgstr "" #: ../parser/class.WebPage.php:123 msgid "unidentified template" msgstr "" #: ../parser/class.WebPage.php:175 msgid "unidentified recordset" msgstr "" #: ../database/class.EditableRS.php:58 msgid "pointer is at EOF" msgstr "" #: ../database/class.EditableRS.php:64 msgid "pointer is at BOF" msgstr "" #: ../database/class.EditableRS.php:244 msgid "there is already a field named 'v_fld_name'" msgstr "" #: ../class.WebApp.php:62 msgid "File 'v_fname' not found" msgstr "" #: ../class.WebApp.php:494 msgid "the quote 'v_quote' is unknown" msgstr "" #: ../class.WebApp.php:546 msgid "dbCommand 'v_cmd_id' is undefined" msgstr "" #: ../class.WebApp.php:579 msgid "recordset 'v_rs_id' is undefined" msgstr "" #: ../parser/class.Parser.php:800 msgid "Redeclaration of <WebClass ID=\"v_id\"> in 'v_path'." msgstr "" #: ../timer/class.Timer.js:68 msgid "'v_proc_id' already exists." msgstr "" #: ../timer/class.Timer.js:79 msgid "'v_proc_id' does not exist." msgstr "" #: ../session/class.Session.js:69 msgid "" "There is a 'v_var_name' already in the list, use setVar to change its value." msgstr "" #: ../session/class.Session.js:85 ../session/class.Session.js:99 #: ../session/class.Session.js:112 msgid "'v_var_name' doesn't exist." msgstr "" #: ../timer/class.Timer.php:109 msgid "Time that spends the web-page to be transfered and loaded in browser" msgstr "" --- NEW FILE: msgmerge.sh --- #!/bin/bash ### update old *.po files with new messages extracted by xgettext.sh ### go to this directory cd $(dirname $0) if [ "$1" = "" ] then echo "Usage: $0 ll_CC" echo "where ll_CC is the language code, like en_US or sq_AL" exit 1 fi lng=$1 ### convert the *.po file of the application dir=$lng/LC_MESSAGES msgmerge --update $dir/web_app.po web_app.po ### convert the *.po files of the components path_list="../boxes ../webobjects ../tools" for path in $path_list do module_list=$(ls $path/) for module in $module_list do dir=$path/$module/l10n if [ -f $dir/$lng/LC_MESSAGES/$module.po ] then msgmerge --update $dir/$lng/LC_MESSAGES/$module.po $dir/$module.po fi done done --- NEW FILE: msginit.sh --- #!/bin/bash ### create initial translation files for a language ### go to this directory cd $(dirname $0) if [ "$1" = "" ] then echo "Usage: $0 ll_CC" echo "where ll_CC is the language code, like en_US or sq_AL" exit 1 fi lng=$1 ### create an initial *.po file for web_app mkdir -p $lng/LC_MESSAGES/ msginit --input=web_app.po --locale=$lng --no-translator \ --output-file=$lng/LC_MESSAGES/web_app.po ### create initial *.po files for the components path_list="../boxes ../webobjects ../tools" for path in $path_list do module_list=$(ls $path/) for module in $module_list do dir=$path/$module/l10n if [ -f $dir/$module.po ] then mkdir -p $dir/$lng/LC_MESSAGES/ msginit --input=$dir/$module.po --locale=$lng --no-translator \ --output-file=$dir/$lng/LC_MESSAGES/$module.po fi done done --- NEW FILE: msgfmt.sh --- #!/bin/bash ### convert translation files (*.po) to binary format (*.mo) ### go to this directory cd $(dirname $0) if [ "$1" = "" ] then echo "Usage: $0 ll_CC" echo "where ll_CC is the language code, like en_US or sq_AL" exit 1 fi lng=$1 ### convert the *.po file of the application dir=$lng/LC_MESSAGES msgfmt --output-file=$dir/web_app.mo $dir/web_app.po ### convert the *.po files of the components path_list="../boxes ../webobjects ../tools" for path in $path_list do module_list=$(ls $path/) for module in $module_list do dir=$path/$module/l10n/$lng/LC_MESSAGES/ if [ -f $dir/$module.po ] then msgfmt --output-file=$dir/$module.mo $dir/$module.po fi done done --- NEW FILE: delete.sh --- #!/bin/bash ### delete translation files for the components ### go to this directory cd $(dirname $0) if [ "$1" = "" ] then echo "Usage: $0 [ll_CC | all]" echo "where ll_CC is the language code, like en_US or sq_AL" exit 1 fi if [ "$1" = "all" ]; then lng=""; else lng=$1; fi path_list="../boxes ../webobjects ../tools" for path in $path_list do module_list=$(ls $path/) for module in $module_list do dir=$path/$module/l10n/$lng rm -rf $dir done done --- NEW FILE: README --- To translate the messages for a language, first initialize the translation files: --scr bash$ ./xgettext.sh bash$ ./msginit.sh ll_CC ---- ll_CC is the language and country code, like 'en_US' or 'sq_AL'. Then, translate the messages in the translation files: --scr bash$ find .. -name '*.po' ---- Finally, convert the translation files into binary format (*.mo): --scr bash$ ./msgfmt.sh ll_CC ---- To update the translation files (e.g. after a new release is out and the message strings may have changed), do: --scr bash$ ./xgettext.sh bash$ ./msgmerge.sh ll_CC ---- Then translate any new entries in the translation files, and then convert again to binary format: `./msgfmt.sh ll_CC`. Other gettext tools can be used as well, if needed. For more information about them see `info gettext`. |