>
>> unfortunately CFML doesn't allow the clean syntax PHP and C allow
>
> cfscript?
Underscore "_" is not an allowed function name in CFML. And that is
too bad, because it would have allowed i18n of code using a lot of
tools for PHP.
Suppose i18n of the following line of code is required:
<tr><th>Issue</th><td>#issue#</td></tr>
<tr><th>Date of publication</th><td>#pubdate#</td></tr>
When using gettext in PHP as a model one would simply change it to:
<tr><th>#_("Issue")#</th><td>#issue#</td></tr>
<tr><th>#_("Date of publication")#</th><td>#pubdate#</td></tr>
Afterwards you run a parser over the code and it extracts all the
strings used as arguments for the _() function. These are all placed
in a string template named a portable object [1], which you can then
manage and translate using tools like poEdit [2].
The big advantage of this approach is that your code remains extremely
readable and flexible (for instance, if a particular string is missing
from the translation you have automatic fallback to the string in the
original language).
I would have loved to copy this straight from PHP, but I will have to
use a different name for the function.
[1] For an example (sorry, webmail wraps):
http://cvs.pgadmin.org/cgi-bin/viewcvs.cgi/*checkout*/www/pgadmin3/locale/fr_FR/LC_MESSAGES/pgadmin3_website.po?rev=1.21
[2] http://poedit.sourceforge.net/screenshots.php
Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

