geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Becker <dan.o.bec...@gmail.com>
Subject Re: using Resource Bundles for message strings
Date Tue, 26 Feb 2008 17:02:03 GMT
Hey B.J.,

I think this is a great beginning, and it will go a long way to creating 
a robust and internationalized server. I can provide a couple of 
answers/comments to your questions.

B.J. Reed wrote:
> Questions/Answers
> 2) Is there a numbering standard for the key?  The standard that I have 
> started for the message key is as follows:
> mmmmlxxxx
>    mmmm - 4 char module name abbreviation
>    l - one char level (E - error, W - warning, I - information
>    xxxx - 4 digit error number
> Since I haven't gotten very far...if there is a better suggestion, then 
> it will be easier to change this sooner rather than later.

I think this is a good prefix system, but I would put the message level 
after the message number. I think COMM001W is easier to read than 
COMMW001 and understand the level. Especially when an E or W or I ends 
the module name prefix. Compare GJEEE0001 to GJEE0001E.

Also, since you provide an API for fetching these messages, I would 
prefer not to include the message prefix and level in the message 
itself. Use the provided GeronimoMessageBundle API to change messages in 
a standard way. This also makes message writing easier as this first 
message is easier to write than the second:
COMM0003E=Unable to find message for {0}.
COMM0003E=COMM0003E Error: Unable to find message for {0}.

> 3)  Tell me more about the string substitutions.  To make messages more 
> flexible, placeholders can be put in the messages that look like {0} {1} 
> etc.  An ArrayList can be passed in to the getMessage method that will 
> be used to replace the placeholders.  This way, if a language needs the 
> replacements in a different order, the code will not need to be changed.

Very useful and definitely needed for messages such as
COMM0022E=Could not find the resource named {0}.
The translators will have to move these placeholders around, as 
different languages have different orders for Subject/Verb/Object etc.

> 4)  How do I add a language?  At this time, the 
> geronimo-messages.properties is included in the geronimo-common.jar.  
> The easiest thing that I have found is to copy the .properties file to 
> an apprpriate locale named file  (geronimo-messages_de.properties (for 
> German) or geronimo-messages_de_CH.properties for German in 
> Switzerland).  Re-create the geronimo-common.jar file.

I think eventually all message translations are going to go in there. 
Different users are going to want different language messages served to 
them from the same server assembly.

-- 
Thanks, Dan Becker

Mime
View raw message