[phpwebapp-commits] CVS: web_app/l10n/app xgettext.sh,NONE,1.1 msgmerge.sh,NONE,1.1 msginit.sh,NONE,
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2005-06-21 08:47:53
|
Update of /cvsroot/phpwebapp/web_app/l10n/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26967/l10n/app Added Files: xgettext.sh msgmerge.sh msginit.sh msgfmt.sh get_app_name.sh README-FIRST README Log Message: these files are usually placed in the directory 'l10n/' of the application --- NEW FILE: xgettext.sh --- #!/bin/bash ### go to this dir cd $(dirname $0) ### get the translatable strings of search, admin and docbook ### from HTML and PHP files module_list="search admin docbook" for module in $module_list do dir=../templates/$module 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 done ### get the translatable strings for the rest of the application app_name=$(./get_app_name.sh) touch $app_name.po find ../templates/ -path '../templates/search' -prune \ -o -path '../templates/admin' -prune \ -o -path '../templates/docbook' -prune \ -o -name '*.php' -print \ -o -name '*.js' -print \ -o -name '*.html' -print \ | xargs xgettext -C --keyword=T_ --join-existing --output=$app_name.po --- 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 app_name=$(./get_app_name.sh) dir=$lng/LC_MESSAGES msgmerge --update $dir/$app_name.po $app_name.po ### convert the *.po files of search, admin and docbook module_list="search admin docbook" for module in $module_list do dir=../templates/$module/l10n msgmerge --update $dir/$lng/LC_MESSAGES/$module.po $dir/$module.po 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 the application app_name=$(./get_app_name.sh) msginit --input=$app_name.po --locale=$lng --no-translator \ --output-file=$lng/LC_MESSAGES/$app_name.po ### create initial *.po files for search, admin and docbook module_list="search admin docbook" for module in $module_list do dir=../templates/$module/l10n mkdir -p $dir/$lng/LC_MESSAGES/ msginit --input=$dir/$module.po --locale=$lng --no-translator \ --output-file=$dir/$lng/LC_MESSAGES/$module.po 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 app_name=$(./get_app_name.sh) dir=$lng/LC_MESSAGES msgfmt --output-file=$dir/$app_name.mo $dir/$app_name.po ### convert the *.po files of search, admin and docbook module_list="search admin docbook" for module in $module_list do dir=../templates/$module/l10n/$lng/LC_MESSAGES/ msgfmt --output-file=$dir/$module.mo $dir/$module.po done --- NEW FILE: get_app_name.sh --- #!/bin/bash ### get and output the name of the application cd $(dirname $0) l10n_dir=$(pwd) app_dir=$(dirname $l10n_dir) app_name=$(basename $app_dir) echo $app_name --- NEW FILE: README-FIRST --- These files should be copied in the folder 'l10n/' of the application, and then they can be modified according to the application. --- 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: * ./ll_CC/LC_MESSAGES/book.po * ../templates/search/ll_CC/LC_MESSAGES/search.po * ../templates/admin/ll_CC/LC_MESSAGES/admin.po * ../templates/docbook/ll_CC/LC_MESSAGES/docbook.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`. |