Le 17 juil. 08 à 13:07, Ayhan Ulusoy a écrit :

>> [% loc('some message') %]
>> [% 'some message' | loc %]
>
>
> Is "loc" an exported function in that case?  Which module exports it  
> then?  Besides, how does "loc" know which language handle to use? I  
> am perplexed...


loc is common shorthand for $lh->maketext, where $lh is  
Locale::MakeText::get_handle($language)
The current $language is determined by your business logic (from user  
preference, cookie, or browser Accept-Language header, etc).
I usually subclass Template and override the process() method to  
supply the loc function to templates.

--
Éric Cholet





_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to