Re: about multi-language support
PeiSong <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Does it affect the performance? On a website there may be hundreds of translations, if all turn into dynamic keys/values, may slow down the speed right? Also need inject the resources manually in each controller. What's the best practice for it? Thank you. On Jul 6, 2010, at 9:17 PM, Jonathan Revusky wrote: > 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 > _______________________________________________ > 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