[jifty-devel] Jifty::I18N meets XUL development

Agent Zhang yichun.zhang at alibaba-inc.com
Thu Oct 18 02:37:55 EDT 2007


Hello, my Jifty fellows,

I've just ported Jifty::I18N and something in Jifty::Script::Po over
to my XUL application framework, XUL::App. And my Perl-based Firefox
extension, SearchAll
(https://addons.mozilla.org/en-US/firefox/addon/5712), is already
using it.

Because XUL::App is also using Template::Delcare as its templating
language, the port is rather straightforward. For example, one of
SearchAll's view looks like this:

   http://svn.openfoundry.org/searchall/trunk/lib/SearchAll/View/Main.pm

Note that I'm also using _("...") calls in the view ;)

Extracting these string literals is a single command in XUL::App (just
like Jifty):

    bin/xulapp po --lang us_en

It will scan all the .pm files and generate po/us_en.po for you.

For example, here is the Po file directory for my SearchAll extension:

    http://svn.openfoundry.org/searchall/trunk/po/

Unlike Jifty, XUL::App tries to behave more like a compiler than a
runtime. So these po files won't appear in the final XPI bundle.
XUL::App will carefully convert these .po files to the corresponding
DTD entities required by XUL's own L10N mechanism. So still, there's
*0* Perl in the "runtime".

Testing I10N within Firefox is straightforward as well:

    bin/xulapp overlay --profile dev --lang zh_cn

Or just testing a particular .xul file in Firefox using a specified
profile named "dev":

    bin/xulapp searchall.xul --profile dev --lang zh_cn

See http://svn.openfoundry.org/searchall/trunk/README for more
"xulapp" usage in the SearchAll project if you're interested :)

In XUL::App, I've been trying very hard to follow Jifty's best
practices. Jifty is so great that every fundamental component has been
keeping me very excited ;)

Once XUL::App gets matured enough, I'll push it onto CPAN. If you like
to help, please let me know ;)

Thanks go to all of you for making Jifty such a lovely animal :D

-agentzh


More information about the jifty-devel mailing list