Re: I18n/l10n

Ted Husted <[email protected]>
Newsgroups gmane.comp.web.maverick.general
Organization Apache Software Foundation - Jakarta Project
Message-ID <[email protected]>
Jaap van Hengstum wrote:
 > Again, correct me if I'm wrong :-)
 >
 > But what if there would not be just one message but instead one 
message (selected at runtime) out of a possible number of messages. The 
view would then have to either [1] select the localized message at 
runtime or [2] include every possible message at compiletime and display 
one of them based on some property returned at runtime.
 >
 > And [2] - if I realize correctly - is just like [1], it would still 
require some ResourceBundle-like functionality (which ofcourse could be 
implemented using Velocity macros).
 >
 > Anyway, it's not really a problem, just something I was thinking 
about since your "build-time" approach looks interesting enough to consider.

----

You might want to take a look at the Resources package in Jakarta Commons.

http://jakarta.apache.org/commons/sandbox/resources/index.html

This is based on the idea of using a Resource Bundle to back a list of 
error messages, which can take standard replaceable parameters. It's 
based on interfaces, so you should also be able to do things like use a 
database for the messages instead of a text file bundle.

For Velocity, this should plug into the existing error tool in the 
standard Tools distribution.

You'd probably want to combine this with shunting to get an end to end 
solution. The trick would be to have a controller maintain a locale 
attribute in the session context that could be used for shunting and 
then by Velocity.


-Ted.





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
[INVALID FOOTER]
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.