On Sat, Aug 29, 2009 at 5:07 AM, Justin
Hileman<jus...@justinhileman.info> wrote:
>
> For bonus points, I'm a fan of something this:
>
> function _($string) { echo htmlspecialchars(l10n($string)); }
>

Be careful... _() is already defined as an alias for gettext()

I have a feeling that would cause a ton of compatibility issues.  Some
time ago, I looked at the magento source code, and they were using
__(), which seems like a reasonable alternative.

When internationalizing an app, you often need to write code like:

printf(l10n('<b>%s</b> wants to be your friend'),
htmlspecialchars($friend_name) );

It is handy to make your shortcut behave like printf when there is
more than 1 argument.

-John Campbell
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/show_participation.php

Reply via email to