Re: about multi-language support
Daniel López <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi there, In our case, all of our applications have to be localised, as we have two official languages in the region, and what we do is what Johnatan suggested. The messages are passed as Strings inside the data model and we build the data moder depending on the chosen language, so there is no localisation inside the templates but previously, when building the data model. Of course, that's one option and it's what it works for us, but just as an example of how it can be solved... I hope it helps, D. ------------------------------------------- Daniel Lopez Janariz ([email protected]) Web Services Centre for Information and Technology Balearic Islands University (SPAIN) ------------------------------------------- Jonathan Revusky escribió: > On Tue, Jul 6, 2010 at 3:41 PM, PeiSong <[email protected]> wrote: >> Does it affect the performance? > > Well, yes. Of course it does. There are probably two extra hash > lookups (possibly synchronized). Whether the difference is important > is just a practical question. You'd have to measure it. > >> On a website there may be hundreds of translations, if all turn into dynamic keys/values, may slow down the speed right? > > Well, it certainly is slower. The code in the class I pointed to can > be adapted, of course. If it comes down to one or two extra hash table > lookups, it will probably not be a performance bottleneck in most web > applications. Probably. > > But I can't really answer that. It is something you have to measure in > your application. > >> Also need inject the resources manually in each controller. >> What's the best practice for it? Thank you. > > I don't know what most people do. I wrote that > ResourceBundleLocalizedString class a long time ago and nobody ever > asks about it. You know, I think that what most multilingual web apps > do (and really, I'm just guessing) is that they build up the data > model each time for each page request, and based on the preferred > locale of the page request, the data model contains different strings. > So, probably most people aren't using the approach that you see in > that class. > > But... in the above, I am just guessing. I really do not know what > most people do. :-) > > Maybe some people will tell you now. (I hope.) > > JR ------------------------------------------------------------------------------ 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