http://qs321.pair.com?node_id=1142468

skazat has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a webapp project that has many dozens of HTML::Template templates for all of its views. We'd like to add I18N/L10N support, so that say: we can ship versions of the web app in English, French, German - language would be a preference you could set up during the initial installation.

Right now, the base language is English. From my research, the best way to go about this is using gettext in some way, of some flavor.

All the examples I see for Perl apps are for strings in the Perl code itself, and not in any sort of template files. I'm unclear what the workflow is, to most easily make this work well.

Some ideas:

For template files, the first thing seems to be, to tag the strings in your templates that should be translated in some way that they can later be parsed out - for example: wrapping all your strings in brackets:

[This string should be translated!]

Then, run a script that finds these strings, for example, this weird find:

http://rp-www.cs.usyd.edu.au/~dcutting/photos/htmltmpl-1.22/tmpl-xgettext.pl

(I couldn't find this script in the current HTML::Template distribution.)

Once these strings are found, I'm then really fuzzy at what the workflow should be.

Do I then have a script, that makes alternative versions of my template files (one version for English, one for French, one for German), by replacing the base English strings with the French and German versions? Is there a place where this workflow is documented?