tmpl_process3.pl - Alternative version of tmpl_process.pl using gettext-compatible translation files
./tmpl_process3.pl [ tmpl_process.pl options ]
This is an alternative version of the tmpl_process.pl script, using standard gettext-style PO files. While there still might be changes made to the way it extracts strings, at this moment it should be stable enough for general use; it is already being used for the Chinese and Polish translations.
Currently, the create, update, and install actions have all been reimplemented and seem to work.
Translation files in standard Uniforum PO format. All standard tools including all gettext tools, plus PO file editors like kbabel(1) etc. can be used.
Minor changes in whitespace in source templates do not generally require strings to be re-translated.
Able to handle <TMPL_VAR> variables in the templates; <TMPL_VAR> variables are usually extracted in proper context, represented by a short %s placeholder.
Able to handle text input and radio button INPUT elements in the templates; these INPUT elements are also usually extracted in proper context, represented by a short %S or %p placeholder.
Automatic comments in the generated PO files to provide even more context (line numbers, and the names and types of the variables).
The %n$s (or %n$p, etc.) notation can be used for change the ordering of the variables, if such a reordering is required for correct translation.
If a particular <TMPL_VAR> should not appear in the translation, it can be suppressed with the %0.0s notation.
Using the PO format also means translators can add their own comments in the translation files, if necessary.
Create, update, and install actions are all based on the same scanner module. This ensures that update and install have the same idea of what is a translatable string; attribute names in tags, for example, will not be accidentally translated.
Anchors are represented by an <An> notation. The meaning of this non-standard notation might not be obvious.
The create action calls xgettext.pl to do the actual work; the update action calls xgettext.pl and msgmerge(1) to do the actual work.
xgettext.pl must be present in the current directory; the msgmerge(1) command must also be present in the search path. The script currently does not check carefully whether these dependent commands are present.
Locale::PO(3) has a lot of bugs. It can neither parse nor generate GNU PO files properly; a couple of workarounds have been written in TmplTokenizer and more is likely to be needed (e.g., to get rid of the "Strange line" warning for #~).
This script may not work in Windows.
There are probably some other bugs too, since this has not been tested very much.
xgettext.pl, TmplTokenizer.pm, msgmerge(1), Locale::PO(3), translator_doc.txt