Yuck, "_" has got to be the worst function name I've ever seen.

:-)

Sam

-----------------------------------------------
Blog: http://www.rewindlife.com
Charts: http://www.blinex.com/products/charting
-----------------------------------------------

> -----Original Message-----
> From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 17, 2003 10:45 AM
> To: CF-Talk
> Subject: Re: Best Practices
>
> Nick de Voil said:
> >
> >> 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/pgad
> min3/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]

Reply via email to