[Catalyst] Localizing Perl Catalyst applications

Perry Valdez perry at domains.ph
Thu Feb 15 10:58:15 GMT 2007


May I ask for an advice on how to best implement localization? I
created a language file called "en-us.yml" that will be read by the
application from a config file. If the config file says "lang =
en-us", then the application will pick up the file en-us.yml. If the
config file says "lang = ja", then the application will pick up
ja.yml. The content of my language files looks something like this:

=====
welcome_message   :    Welcome %1. Last login on: %2
one_or_more_credits  :    You have %1 prepaid credit(s) left. Buy
prepaid credits now!
username          :    Username:
password          :    Password:
submit_button     :    Sign in
...
=====

The left column contains the string identifiers, and the right column
contains the actual strings expressed in the specified language (e.g.,
for the file en-us.yml, the strings are in American English; for
ja.yml, the strings are in Japanese, etc).

I used to think that this is the best format, but when I read some
articles about gettext and MakeText, I casted doubt on what I'm doing
right now for localization. Do I have to use gettext/MakeText, then?
Using these modules seem complex, however.

Also, I'm going to design my application to be "pluggable", meaning
any person can create a "plugin" if he/she wants extra functionality
in my application. But some plugins would be displaying an interface,
so there must be room for localization for plugins, too. How should I
design my language files then? Should every plugin have its own set of
language files? Or should there be only one set of language files for
the whole application?

Are there any good Catalyst modules I can use for this?

I apologize for being a newbie in implementing localization in my
applications. Please bear with me.



More information about the Catalyst mailing list