[WG: I18N & L10N] Velocity and internationalization

Jim Eng jimeng at umich.edu
Thu Sep 17 06:49:20 PDT 2009


The most common way I've seen this done is to get the fully formatted  
string from the ResourceLoader in the Java code and pass it into the  
template as a simple string variable, but it would also work to pass  
an array to getFormattedMessage() from the template, as Beth suggests.

Jim



On Sep 17, 2009, at 9:14 AM, Beth Kirschner wrote:

> Since you can easily call java methods from within velocity
> (ResourceLoader.getString() is frequently used within velocity
> templates, the real question is how to pass an array argument (used by
> getFormattedMessage). Depending on where you get your arguments from,
> you can pass the argument array to the velocity template by setting a
> context variable ( context.put( "variable-name", argArray) ) or create
> the array within the template itself (http://velocity.apache.org/engine/devel/developer-guide.html#objectscreatedinthetemplate
> ).
>
> Disclaimer: I haven't actually tried either method -- but let me know
> if you find something that works and I'll add it to the Best Practices
> page.
>
> - Beth
>
> On Sep 16, 2009, at 5:07 AM, Jean-Francois Leveque wrote:
>
>> Hi
>>
>> I was reading
>> http://confluence.sakaiproject.org/display/I18N/Best+Practices+for+Internationalized+Tools+in+Sakai
>> and I can't find something I'd like to know. I don't know much about
>> Velocity and
>> org.sakaiproject.util.ResourceLoader.getFormattedMessage(),
>> so this may be easy or hard to answer.
>>
>> I would like to know how
>> org.sakaiproject.util.ResourceLoader.getFormattedMessage() could be
>> used
>> with Velocity.
>>
>> Cheers,
>>
>> Jean-Francois
>> _______________________________________________
>> i18n mailing list
>> i18n at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/i18n
>>
>> TO UNSUBSCRIBE: send email to i18n-
>> unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>>
>>
>
> _______________________________________________
> i18n mailing list
> i18n at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/i18n
>
> TO UNSUBSCRIBE: send email to i18n- 
> unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>
>



More information about the i18n mailing list