Re: about multi-language support

Jonathan Revusky <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Tue, Jul 6, 2010 at 2:53 PM, PeiSong <[email protected]> wrote:
> Seems so. But I guess this class is for internal use?

No, it's not just for internal use. It was really just meant as an
example. It can also be directly used.


> So how can I use localizedString in the template? Any sample code? thank you.

Just new them and put them directly in your data model if you want.
Something like:

model.put("some_key", new ResourceBundleLocalizedString("some_key",
"my_resource_bundle_lookup_key"));

(Though the above is obviously verbose and you would probably
encapsulate this in your code somehow. Also you could define a
trivial subclass of DefaultObjectWrapper that actually wraps strings this way.)

JR

>
> On Jul 6, 2010, at 8:24 PM, Jonathan Revusky wrote:
>
>> It's certainly possible to do this quite cleanly. Just as an example,
>> look at the surce code for the class
>> freemarker.template.ResourceBundleLocalizedString
>>
>> JR
>>
>> On Tue, Jul 6, 2010 at 12:05 PM, PeiSong <[email protected]> wrote:
>>> Hi,
>>>
>>> Does freemarker support resouce bundle to load language keys/values?
>>>
>>> If we use multiple templates we hv to change each template when there are any changes, I don't think it's a good idea. Thank you.
>>>
>>> PeiSong
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by Sprint
>>> What will you do first with EVO, the first 4G phone?
>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>>> _______________________________________________
>>> FreeMarker-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> FreeMarker-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.