Hi Shinobu,

Have you looked at ResourceBundles?
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/ResourceBundle.html

It shouldn't be too hard to make a ViewTool for it using
ServletRequest#getLocale().
 http://jakarta.apache.org/velocity/tools/view/
 
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html#getLocale()

## Or does one exist already?

Best regards,
-- Shinobu Kawai


In my case information is loaded from a database. The thing I'm considering is that it would be easiest to access the information in a property kind of way, like normal Velocity code:

   $product.title

but this would infact invoke:
String product.getTitle(usersLocale);


or something of the sort. This would be how I would attempt to do it. Ofcourse I could also build a tool, like the 'localeTool' and do the following:

   $localeTool.getMessage($product.title)

where $product.title would return some object that contains a string for each locale, and LocaleTool would know how to extract the right string from the bunch. But I find this rather verbose, and it makes the code ugly.

The lost solution is ofcourse to store the locale in the model and do the follow:

   $product.getTitle($locale)

But I'm not content with that either, since I'm rather a purist in seperation of code and view.

I'm sure other people have struggled with the same problem, and I wish to know what their solution would be. Anyone has attempted to do the same?

Thanks,
Vincent







--
XIAM Solutions B.V.
Barchman Wuytierslaan 72A
3818 LK AMERSFOORT
tel. : +31(0)33 462 40 07
e-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]

WAARSCHUWING:
Dit bericht is UITSLUITEND bestemd voor de (rechts)perso(o)n(en) aan welke het 
bericht is gericht. Het kan vertrouwelijke of alleen voor deze 
rechts)perso(o)n(en) bestemde informatie bevatten, die niet mag worden 
geopenbaard. Als dit bericht niet voor u bestemd is, mag u de ontvangen 
informatie niet lezen, gebruiken, verspreiden of kopi�ren. Als u dit bericht 
per abuis heeft ontvangen, gelieve het bericht dan te vernietigen en contact op 
te nemen met de afzender.

WARNING:
This message is intended ONLY for the person(s) or entity to which it is 
addressed and may contain confidential and/or privileged information, the 
disclosure of which is prohibited. If you are not the intended recipient you 
may not read, use, disseminate or copy the information transmitted. If you have 
received this message by mistake, please contact the sender and delete the 
material from any computer.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to