[Dancer-users] Dancer and i18n
patrick sanchez
pack.sanchez at gmail.com
Mon Jun 13 12:47:32 CEST 2011
Hello,
I need to display my Dancer app in at least 2 languages. Tried the i18n
plugin, but i dont' need the full power of gettext/make text (plus, being a
java guy -nobody is perfect- , i feel quite lost with it !).
I found this method in PM :
----
In our app we take the language preferences of a user from his settings,
cookie or guess it based on his browser headings or failing all, guess his
language by his IP. In the head of .tt's we PROCESS the proper language
template which holds the translations by key:
The template inclusion is done via a:
[%- PROCESS "locale/${user.lang}/lang.tt"; %]
<http://www.perlmonks.org/?abspart=1;displaytype=displaycode;node_id=466456;part=1>
The language files look like:
[%
lang.label.status = "Status";
....
lang.phrase.sure = "Are you sure";
%]
and a tag is simply called using:
[% lang.label.status %]
---
It seems to perfectly suit my needs, but i can't make it work :
[% lang.label.status %] would generate nothing.
Has anyone tested a similar approach for i18n with Dancer ?
Thanks.
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110613/d1ca9517/attachment.htm>
More information about the Dancer-users
mailing list