[Catalyst] I18N with variables

Nicholas Wehr catalyst at bionikchickens.com
Wed Aug 4 15:30:17 GMT 2010


Check out Catalyst::Plugin::Localize::Simple

http://search.cpan.org/~wehr/Catalyst-Plugin-Localize-Simple-1.1/lib/Cataly=
st/Plugin/Localize/Simple.pm

I made it to overcome the learning curve of i18n, and it works very well.
Used it to translate English to Spanish, French, Japanese, Italian,
Portuguese, and Chinese Simplified. I provided a CMS for the translation
team to create and modify these translation files. Very simple and straight
forward. Let me know if you have questions on usage.

-nw


On Wed, Aug 4, 2010 at 1:04 AM, Ton Voon <ton.voon at opsera.com> wrote:

>
> On 2 Aug 2010, at 06:08, Julien Sobrier wrote:
>
>  Hello,
>> I've started to translate my website using Catalyst::Plugin::I18N. It
>> works fine for static text. Bu I can't make it work for variables. For
>> example, I need to a translation for [% foo %] where for can take a
>> set of values defined in a database.
>>
>> I'm sot sure what is the best way to translate such variables, and
>> what is possible:
>> * add a msgid for each possible value in messages.po =3D> those gets
>> removed every time I run xgettext.pl
>> * Make the translation in my Database layer =3D> unfortunately I use the
>> old Class::DBI, and could not find a plugin for it
>> * any other option?
>>
>
> What I do is use the variable to work out the dynamic name, and then in a
> dummy template file, have the possible options. Eg:
>
> [% menu_name=3D"Configuration"; c.loc(menu_name) %]
>
> Then in a dummy template file, have:
>
> [% c.loc("Configuration") %]
>
> This way xgettext.pl will always find it to put into messages.po. It means
> having to write in the dummy template all the possibilities, but it would
> have to be captured somewhere, so it might as well be in something that
> xgettext.pl can process.
>
> Ton
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100804/50866=
be2/attachment.htm


More information about the Catalyst mailing list