You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "B.J. Reed" <bj...@gmail.com> on 2008/02/26 16:30:14 UTC

using Resource Bundles for message strings

I have written a patch to get Geronimo messages from a common set of 
resource bundles.  Included in the patch is the 
GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the 
start of the  geronimo-messages.properties file.

The patch should be unzipped into the 
trunk/framework/modules/geronimo-common directory.  Please take a look 
and provide suggestions/comments/etc.  I would like to really begin 
moving messages into this common file - probably a module at a time.

Questions/Answers

1) How do I use the new class in the Geronimo code?  So that we don't 
load the list of messages and keys multiple times, the 
GeronimoMessageBundle is a singleton.  Simply make a call to 
GeronimoMessageBundle.getInstance() and then make the appropriate 
getMessage call.  For starters, I have made the message key the message 
number that will show up as part of the message.  Also provided is a way 
to substitute parts of the message with substitution strings.

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.

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.

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.  Right now, the 
machine locale is used.  After we have several translations, we may want 
to add something to the Admin Console to allow an administrator to set 
the locale.

5)  Is there a way to have the .properties file(s) outside of the jar?  
I'm sure there is, but I haven't stumbled across it yet.  That's 
actually where I've been banging my head the last few days.

6)  I also envision that when we have all the messages in the common 
file, that it will be very easy to have a troubleshooting section on our 
website that gives more in depth knowledge about each message.

I will begin writing 2.2 documentation from the above questions.

This is just for message translation, so I believe that we'll need to 
come up with other methods for the Admin Console and possibly the 
Eclipse plugin if we want to have everything translatable.

-- B.J. Reed

Re: using Resource Bundles for message strings

Posted by Dan Becker <da...@gmail.com>.
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

Re: LDAP server in 2.1.1

Posted by Hernan Cunico <hc...@gmail.com>.
That sample started during the time where we used to ship ApacheDS as one of the components and at that time we didn't provide an LDAP viewer feature. Anyway, it made sense then to try to configure the LDAP server "locally".

Now the LDAP server feature is optional, you can choose to install the plugin or not, but either way you still have the LDAP viewer from the console so I think we could go either way (remote or plugin) or even both. 

Cheers!
Hernan

Jarek Gawor wrote:
> FYI, I guess I forgot to update the wiki but you can run this sample
> with an external ldap server - i.e. you don't need to build or install
> the directory plugin. Just download Apache Directory Service binary,
> start the ldap server and load it up with the ldap-sample.ldif and
> follow the rest of the sample instructions.
> 
> Jarek
> 
> On 3/5/08, Dan Becker <da...@gmail.com> wrote:
>> I've been validating the LDAP Sample Application article that I am
>>  porting from the 2.0 docs to 2.1
>>  (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
>>  running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
>>  However I see no component org.apache.geronimo.configs/directory in the
>>  list of Installed System Modules.
>>
>>  Is the LDAP server component now a separate module install? Perhaps it
>>  is in another assembly? Perhaps I built it incorrectly? Can some one
>>  please point me to where I may start the LDAP server in 2.1.1?
>>
>> --
>>  Thanks, Dan Becker
>>
> 

Re: LDAP server in 2.1.1

Posted by Jarek Gawor <jg...@gmail.com>.
FYI, I guess I forgot to update the wiki but you can run this sample
with an external ldap server - i.e. you don't need to build or install
the directory plugin. Just download Apache Directory Service binary,
start the ldap server and load it up with the ldap-sample.ldif and
follow the rest of the sample instructions.

Jarek

On 3/5/08, Dan Becker <da...@gmail.com> wrote:
> I've been validating the LDAP Sample Application article that I am
>  porting from the 2.0 docs to 2.1
>  (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
>  running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
>  However I see no component org.apache.geronimo.configs/directory in the
>  list of Installed System Modules.
>
>  Is the LDAP server component now a separate module install? Perhaps it
>  is in another assembly? Perhaps I built it incorrectly? Can some one
>  please point me to where I may start the LDAP server in 2.1.1?
>
> --
>  Thanks, Dan Becker
>

Re: LDAP server in 2.1.1

Posted by Dan Becker <da...@gmail.com>.
Joe Bohn wrote:
> Were you able to get this working using the 2.1 released server and the 
> plugin from branches/1.0?  I'm thinking that we probably need to release 
> a version of this directory plugin for Geronimo 2.1.  Most users aren't 
> going to want to build it locally and I don't see it listed when looking 
> at the plugins for 2.1 on http://geronimo.apache.org/plugins/geronimo-2.1/

Hi Joe,

For the sample I did not try the plugin route, but rather the standalone 
directory server, and updated the docs with that suggestion. I look 
forward to retesting it and updating the docs with David Jencks' plugin 
1.0 for Apache Directory 1.5.1.

-- 
Thanks, Dan Becker

Re: LDAP server in 2.1.1

Posted by David Jencks <da...@yahoo.com>.
On Mar 11, 2008, at 2:52 PM, Joe Bohn wrote:

> Dan Becker wrote:
>> Jason Warner wrote:
>>> On Wed, Mar 5, 2008 at 3:03 PM, David Jencks  
>>> <da...@yahoo.com> wrote:
>>>> On Mar 5, 2008, at 11:41 AM, Jason Warner wrote:
>>>> On Wed, Mar 5, 2008 at 2:34 PM, David Jencks  
>>>> <da...@yahoo.com>
>>>> wrote:
>>>>
>>>>> On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
>>>>>
>>>>> I'm not sure if it's included with the server or not anymore,  
>>>>> but you
>>>>> can checkout the source for the ApacheDS plugin here:
>>>>> http://svn.apache.org/repos/asf/geronimo/plugins/directory/ 
>>>>> branches/1.0/
>>>>>
>>>>> That's for the 1.0 branch.
>>>>>
>>>>>
>>>>> That plugin is for geronimo 2.1 and apache directory 1.5.1.
>>>>>
>> Thanks for the replies. Now we see the value of revisiting and  
>> validating the 2.1 docs (especially by a newcomer like me). I will  
>> update the wording of the doc to take in all the helpful hints.
>
> Hi Dan,
>
> Were you able to get this working using the 2.1 released server and  
> the plugin from branches/1.0?  I'm thinking that we probably need  
> to release a version of this directory plugin for Geronimo 2.1.   
> Most users aren't going to want to build it locally and I don't see  
> it listed when looking at the plugins for 2.1 on http:// 
> geronimo.apache.org/plugins/geronimo-2.1/

On the off chance I can get a working genesis release out the  
directory plugin is the first use of it.  Hopefully I'll have a vote  
by tomorrow.

thanks
david jencks

>
> I see that you updated the ldap-sample-app for 2.1 but it wasn't  
> clear to me how you installed the directory plugin.  You reference  
> the svn for branches/1.0 so should I assume that you built it  
> locally?  Did it then install on Geronimo 2.1 without modification?
>
> Thanks,
> Joe
>


Re: LDAP server in 2.1.1

Posted by Joe Bohn <jo...@earthlink.net>.
Dan Becker wrote:
> Jason Warner wrote:
>> On Wed, Mar 5, 2008 at 3:03 PM, David Jencks <da...@yahoo.com> 
>> wrote:
>>> On Mar 5, 2008, at 11:41 AM, Jason Warner wrote:
>>> On Wed, Mar 5, 2008 at 2:34 PM, David Jencks <da...@yahoo.com>
>>> wrote:
>>>
>>>> On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
>>>>
>>>> I'm not sure if it's included with the server or not anymore, but you
>>>> can checkout the source for the ApacheDS plugin here:
>>>> http://svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/ 
>>>>
>>>>
>>>> That's for the 1.0 branch.
>>>>
>>>>
>>>> That plugin is for geronimo 2.1 and apache directory 1.5.1.
>>>>
> 
> 
> Thanks for the replies. Now we see the value of revisiting and 
> validating the 2.1 docs (especially by a newcomer like me). I will 
> update the wording of the doc to take in all the helpful hints.

Hi Dan,

Were you able to get this working using the 2.1 released server and the 
plugin from branches/1.0?  I'm thinking that we probably need to release 
a version of this directory plugin for Geronimo 2.1.  Most users aren't 
going to want to build it locally and I don't see it listed when looking 
at the plugins for 2.1 on http://geronimo.apache.org/plugins/geronimo-2.1/

I see that you updated the ldap-sample-app for 2.1 but it wasn't clear 
to me how you installed the directory plugin.  You reference the svn for 
branches/1.0 so should I assume that you built it locally?  Did it then 
install on Geronimo 2.1 without modification?

Thanks,
Joe


Re: LDAP server in 2.1.1

Posted by Dan Becker <da...@gmail.com>.
Jason Warner wrote:
> On Wed, Mar 5, 2008 at 3:03 PM, David Jencks <da...@yahoo.com> wrote:
>> On Mar 5, 2008, at 11:41 AM, Jason Warner wrote:
>> On Wed, Mar 5, 2008 at 2:34 PM, David Jencks <da...@yahoo.com>
>> wrote:
>>
>>> On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
>>>
>>> I'm not sure if it's included with the server or not anymore, but you
>>> can checkout the source for the ApacheDS plugin here:
>>> http://svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/
>>>
>>> That's for the 1.0 branch.
>>>
>>>
>>> That plugin is for geronimo 2.1 and apache directory 1.5.1.
>>>


Thanks for the replies. Now we see the value of revisiting and 
validating the 2.1 docs (especially by a newcomer like me). I will 
update the wording of the doc to take in all the helpful hints.
-- 
Thanks, Dan Becker

Re: LDAP server in 2.1.1

Posted by Jason Warner <ja...@gmail.com>.
On Wed, Mar 5, 2008 at 3:03 PM, David Jencks <da...@yahoo.com> wrote:

>
> On Mar 5, 2008, at 11:41 AM, Jason Warner wrote:
>
>
>
> On Wed, Mar 5, 2008 at 2:34 PM, David Jencks <da...@yahoo.com>
> wrote:
>
> >
> > On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
> >
> > Dan,
> >
> > I'm not sure if it's included with the server or not anymore, but you
> > can checkout the source for the ApacheDS plugin here:
> > http://svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/
> >
> > That's for the 1.0 branch.
> >
> >
> > That plugin is for geronimo 2.1 and apache directory 1.5.1.
> >
>
> I'm confused what you meant by this.  He's trying to update the sample
> document for 2.1, so doesn't that mean this is the version he should be
> using?
>
>
> My turn to be confused.  The plugin you pointed to is what he should be
> using.  I don't understand what you meant by "for the 1.0 branch".  Maybe
> we've had enough confusion :-)
>
> thanks
> david jencks
>

My fault, David.  I worded that poorly.  What I meant was that the link was
to the 1.0 branch of the plugin instead of to the trunk for the plugin.
Sorry!

>
>
>
> > Releasing this plugin is waiting on:
> > -release process vote
> > -genesis vote
> > -legal review by Kevan.
> >
> >
>
> > I encourage everyone and especially pmc members to take enough of an
> > interest in the future of geronimo to bother to vote on the first two.
> >
> > thanks
> > david jencks
> >
> >
> >
> > Hope this helps,
> >
> > On Wed, Mar 5, 2008 at 2:16 PM, Dan Becker <da...@gmail.com>
> > wrote:
> >
> > > I've been validating the LDAP Sample Application article that I am
> > > porting from the 2.0 docs to 2.1
> > > (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
> > > running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
> > > However I see no component org.apache.geronimo.configs/directory in
> > > the
> > > list of Installed System Modules.
> > >
> > > Is the LDAP server component now a separate module install? Perhaps it
> > > is in another assembly? Perhaps I built it incorrectly? Can some one
> > > please point me to where I may start the LDAP server in 2.1.1?
> > > --
> > > Thanks, Dan Becker
> > >
> >
> >
> >
> > --
> > ~Jason Warner
> >
> >
> >
>
>
> --
> ~Jason Warner
>
>
>


-- 
~Jason Warner

Re: LDAP server in 2.1.1

Posted by David Jencks <da...@yahoo.com>.
On Mar 5, 2008, at 11:41 AM, Jason Warner wrote:

>
>
> On Wed, Mar 5, 2008 at 2:34 PM, David Jencks  
> <da...@yahoo.com> wrote:
>
> On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
>
>> Dan,
>>
>> I'm not sure if it's included with the server or not anymore, but  
>> you can checkout the source for the ApacheDS plugin here: http:// 
>> svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/
>>
>> That's for the 1.0 branch.
>
> That plugin is for geronimo 2.1 and apache directory 1.5.1.
>
> I'm confused what you meant by this.  He's trying to update the  
> sample document for 2.1, so doesn't that mean this is the version  
> he should be using?

My turn to be confused.  The plugin you pointed to is what he should  
be using.  I don't understand what you meant by "for the 1.0  
branch".  Maybe we've had enough confusion :-)

thanks
david jencks

>
>
> Releasing this plugin is waiting on:
> -release process vote
> -genesis vote
> -legal review by Kevan.
>
>
> I encourage everyone and especially pmc members to take enough of  
> an interest in the future of geronimo to bother to vote on the  
> first two.
>
> thanks
> david jencks
>
>>
>>
>> Hope this helps,
>>
>> On Wed, Mar 5, 2008 at 2:16 PM, Dan Becker  
>> <da...@gmail.com> wrote:
>> I've been validating the LDAP Sample Application article that I am
>> porting from the 2.0 docs to 2.1
>> (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html).  
>> I am
>> running a Tomcat 6/Java EE5 assembly that I built from the 2.1  
>> branch.
>> However I see no component org.apache.geronimo.configs/directory  
>> in the
>> list of Installed System Modules.
>>
>> Is the LDAP server component now a separate module install?  
>> Perhaps it
>> is in another assembly? Perhaps I built it incorrectly? Can some one
>> please point me to where I may start the LDAP server in 2.1.1?
>> --
>> Thanks, Dan Becker
>>
>>
>>
>> -- 
>> ~Jason Warner
>
>
>
>
> -- 
> ~Jason Warner


Re: LDAP server in 2.1.1

Posted by Jason Warner <ja...@gmail.com>.
On Wed, Mar 5, 2008 at 2:34 PM, David Jencks <da...@yahoo.com> wrote:

>
> On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:
>
> Dan,
>
> I'm not sure if it's included with the server or not anymore, but you can
> checkout the source for the ApacheDS plugin here:
> http://svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/
>
> That's for the 1.0 branch.
>
>
> That plugin is for geronimo 2.1 and apache directory 1.5.1.
>

I'm confused what you meant by this.  He's trying to update the sample
document for 2.1, so doesn't that mean this is the version he should be
using?

>
> Releasing this plugin is waiting on:
> -release process vote
> -genesis vote
> -legal review by Kevan.
>
>

> I encourage everyone and especially pmc members to take enough of an
> interest in the future of geronimo to bother to vote on the first two.
>
> thanks
> david jencks
>
>
>
> Hope this helps,
>
> On Wed, Mar 5, 2008 at 2:16 PM, Dan Becker <da...@gmail.com> wrote:
>
> > I've been validating the LDAP Sample Application article that I am
> > porting from the 2.0 docs to 2.1
> > (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
> > running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
> > However I see no component org.apache.geronimo.configs/directory in the
> > list of Installed System Modules.
> >
> > Is the LDAP server component now a separate module install? Perhaps it
> > is in another assembly? Perhaps I built it incorrectly? Can some one
> > please point me to where I may start the LDAP server in 2.1.1?
> > --
> > Thanks, Dan Becker
> >
>
>
>
> --
> ~Jason Warner
>
>
>


-- 
~Jason Warner

Re: LDAP server in 2.1.1

Posted by David Jencks <da...@yahoo.com>.
On Mar 5, 2008, at 11:24 AM, Jason Warner wrote:

> Dan,
>
> I'm not sure if it's included with the server or not anymore, but  
> you can checkout the source for the ApacheDS plugin here: http:// 
> svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/
>
> That's for the 1.0 branch.

That plugin is for geronimo 2.1 and apache directory 1.5.1.

Releasing this plugin is waiting on:
-release process vote
-genesis vote
-legal review by Kevan.

I encourage everyone and especially pmc members to take enough of an  
interest in the future of geronimo to bother to vote on the first two.

thanks
david jencks

>
>
> Hope this helps,
>
> On Wed, Mar 5, 2008 at 2:16 PM, Dan Becker <da...@gmail.com>  
> wrote:
> I've been validating the LDAP Sample Application article that I am
> porting from the 2.0 docs to 2.1
> (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
> running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
> However I see no component org.apache.geronimo.configs/directory in  
> the
> list of Installed System Modules.
>
> Is the LDAP server component now a separate module install? Perhaps it
> is in another assembly? Perhaps I built it incorrectly? Can some one
> please point me to where I may start the LDAP server in 2.1.1?
> --
> Thanks, Dan Becker
>
>
>
> -- 
> ~Jason Warner


Re: LDAP server in 2.1.1

Posted by Jason Warner <ja...@gmail.com>.
Dan,

I'm not sure if it's included with the server or not anymore, but you can
checkout the source for the ApacheDS plugin here:
http://svn.apache.org/repos/asf/geronimo/plugins/directory/branches/1.0/

That's for the 1.0 branch.

Hope this helps,

On Wed, Mar 5, 2008 at 2:16 PM, Dan Becker <da...@gmail.com> wrote:

> I've been validating the LDAP Sample Application article that I am
> porting from the 2.0 docs to 2.1
> (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am
> running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch.
> However I see no component org.apache.geronimo.configs/directory in the
> list of Installed System Modules.
>
> Is the LDAP server component now a separate module install? Perhaps it
> is in another assembly? Perhaps I built it incorrectly? Can some one
> please point me to where I may start the LDAP server in 2.1.1?
> --
> Thanks, Dan Becker
>



-- 
~Jason Warner

Re: LDAP server in 2.1.1

Posted by Joe Bohn <jo...@earthlink.net>.
Dan Becker wrote:
> I've been validating the LDAP Sample Application article that I am 
> porting from the 2.0 docs to 2.1 
> (http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am 
> running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch. 
> However I see no component org.apache.geronimo.configs/directory in the 
> list of Installed System Modules.
> 
> Is the LDAP server component now a separate module install? Perhaps it 
> is in another assembly? Perhaps I built it incorrectly? Can some one 
> please point me to where I may start the LDAP server in 2.1.1?

Dan,

Just a word of warning ... you might have a difficult time attempting to 
use the samples at the moment (see this thread: 
http://www.nabble.com/samples-for-2.1--td15692598s134.html )

For now, I have updated 
https://svn.apache.org/repos/asf/geronimo/samples/branches/2.1/ so that 
the samples are dependent upon Geronimo 2.1 (not 2.1.1-SNAPSHOT).  This 
might not be the right thing to do but for now it provided a quick way 
to be able to make the samples function on 2.1 even though we have not 
yet released 2.1 versions of them.

Joe


LDAP server in 2.1.1

Posted by Dan Becker <da...@gmail.com>.
I've been validating the LDAP Sample Application article that I am 
porting from the 2.0 docs to 2.1 
(http://cwiki.apache.org/GMOxDOC21/ldap-sample-application.html). I am 
running a Tomcat 6/Java EE5 assembly that I built from the 2.1 branch. 
However I see no component org.apache.geronimo.configs/directory in the 
list of Installed System Modules.

Is the LDAP server component now a separate module install? Perhaps it 
is in another assembly? Perhaps I built it incorrectly? Can some one 
please point me to where I may start the LDAP server in 2.1.1?
-- 
Thanks, Dan Becker

Re: using Resource Bundles for message strings

Posted by "B.J. Reed" <bj...@gmail.com>.
ok. We'll use simple phrases as keys for the properties strings.

I haven't been clear about what the numbering scheme is for.  My concern 
isn't for collisions in the code, it's really for collisions and ease of 
finding info when a user asks "I'm getting message xxx, what do I need 
to do about it?".  My thinking is that it is easier to reference an 
error code rather than a whole message.  If there is some numbering 
scheme, that would help us in answering that question or we could use 
that numbering scheme on the web for easy user searches.  I'm thinking 
that the numbering should only be in the .properties files....or am I 
trying to solve a problem that hasn't been a problem - maybe we don't 
need a numbering scheme at all?

-- B.J.

Alan D. Cabrera wrote:
> Jarek's statements reflect my own sentiments as well.
>
> To address your concern about key collisions, I don't think that it 
> will happen if modules get their own resource file.  It was never a 
> problem for me.
>
>
> Regards,
> Alan
>
> On Feb 27, 2008, at 7:57 AM, B.J. Reed wrote:
>
>> Thanks, each plugin/module will have its own resource file in the 
>> plugin/module jar now.
>>
>> The MessageFormat and varargs were very helpful.  The code is much 
>> simpler now.
>>
>> For the message keys, I'm just looking for some way to have a unique 
>> naming scheme and the group id/module/abbreviations should do that 
>> (for now at least).  With a scheme not based on the module name, I'm 
>> afraid of the following: since each module has its own resource 
>> bundle, keys in different modules could have the same name and 
>> everything would work fine, but if users reference a key and it's not 
>> unique.....what else can we use to help make these keys unique across 
>> modules?
>>
>> --B.J. Reed
>>
>>
>> Jarek Gawor wrote:
>>> Some thoughts:
>>>
>>> 1) Each module or plugin should have its own resource file.
>>>
>>> 2) Messages should be formatted using java.text.MessageFormat. The
>>> substitution arguments should be arbitrary objects (not just strings)
>>> and should be passed using varargs.
>>>
>>> 3) As soon as we encode the module or group id into the key or
>>> whatever, it will become invalid or inaccurate. It's a maintenance
>>> mess in my opinion. I think the key should just be a simple string
>>> without any additional encoded information. We can inject some extra
>>> info as the message is displayed but the key should be very simple.
>>>
>>> Jarek
>


Re: using Resource Bundles for message strings

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
Jarek's statements reflect my own sentiments as well.

To address your concern about key collisions, I don't think that it  
will happen if modules get their own resource file.  It was never a  
problem for me.


Regards,
Alan

On Feb 27, 2008, at 7:57 AM, B.J. Reed wrote:

> Thanks, each plugin/module will have its own resource file in the  
> plugin/module jar now.
>
> The MessageFormat and varargs were very helpful.  The code is much  
> simpler now.
>
> For the message keys, I'm just looking for some way to have a unique  
> naming scheme and the group id/module/abbreviations should do that  
> (for now at least).  With a scheme not based on the module name, I'm  
> afraid of the following: since each module has its own resource  
> bundle, keys in different modules could have the same name and  
> everything would work fine, but if users reference a key and it's  
> not unique.....what else can we use to help make these keys unique  
> across modules?
>
> --B.J. Reed
>
>
> Jarek Gawor wrote:
>> Some thoughts:
>>
>> 1) Each module or plugin should have its own resource file.
>>
>> 2) Messages should be formatted using java.text.MessageFormat. The
>> substitution arguments should be arbitrary objects (not just strings)
>> and should be passed using varargs.
>>
>> 3) As soon as we encode the module or group id into the key or
>> whatever, it will become invalid or inaccurate. It's a maintenance
>> mess in my opinion. I think the key should just be a simple string
>> without any additional encoded information. We can inject some extra
>> info as the message is displayed but the key should be very simple.
>>
>> Jarek

Re: using Resource Bundles for message strings

Posted by "B.J. Reed" <bj...@gmail.com>.
Thanks, each plugin/module will have its own resource file in the 
plugin/module jar now.

The MessageFormat and varargs were very helpful.  The code is much 
simpler now.

For the message keys, I'm just looking for some way to have a unique 
naming scheme and the group id/module/abbreviations should do that (for 
now at least).  With a scheme not based on the module name, I'm afraid 
of the following: since each module has its own resource bundle, keys in 
different modules could have the same name and everything would work 
fine, but if users reference a key and it's not unique.....what else can 
we use to help make these keys unique across modules?

--B.J. Reed


Jarek Gawor wrote:
> Some thoughts:
>
> 1) Each module or plugin should have its own resource file.
>
> 2) Messages should be formatted using java.text.MessageFormat. The
> substitution arguments should be arbitrary objects (not just strings)
> and should be passed using varargs.
>
> 3) As soon as we encode the module or group id into the key or
> whatever, it will become invalid or inaccurate. It's a maintenance
> mess in my opinion. I think the key should just be a simple string
> without any additional encoded information. We can inject some extra
> info as the message is displayed but the key should be very simple.
>
> Jarek
>
> On Tue, Feb 26, 2008 at 10:30 AM, B.J. Reed <bj...@gmail.com> wrote:
>   
>> I have written a patch to get Geronimo messages from a common set of
>>  resource bundles.  Included in the patch is the
>>  GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the
>>  start of the  geronimo-messages.properties file.
>>
>>  The patch should be unzipped into the
>>  trunk/framework/modules/geronimo-common directory.  Please take a look
>>  and provide suggestions/comments/etc.  I would like to really begin
>>  moving messages into this common file - probably a module at a time.
>>
>>  Questions/Answers
>>
>>  1) How do I use the new class in the Geronimo code?  So that we don't
>>  load the list of messages and keys multiple times, the
>>  GeronimoMessageBundle is a singleton.  Simply make a call to
>>  GeronimoMessageBundle.getInstance() and then make the appropriate
>>  getMessage call.  For starters, I have made the message key the message
>>  number that will show up as part of the message.  Also provided is a way
>>  to substitute parts of the message with substitution strings.
>>
>>  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.
>>
>>  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.
>>
>>  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.  Right now, the
>>  machine locale is used.  After we have several translations, we may want
>>  to add something to the Admin Console to allow an administrator to set
>>  the locale.
>>
>>  5)  Is there a way to have the .properties file(s) outside of the jar?
>>  I'm sure there is, but I haven't stumbled across it yet.  That's
>>  actually where I've been banging my head the last few days.
>>
>>  6)  I also envision that when we have all the messages in the common
>>  file, that it will be very easy to have a troubleshooting section on our
>>  website that gives more in depth knowledge about each message.
>>
>>  I will begin writing 2.2 documentation from the above questions.
>>
>>  This is just for message translation, so I believe that we'll need to
>>  come up with other methods for the Admin Console and possibly the
>>  Eclipse plugin if we want to have everything translatable.
>>
>>  -- B.J. Reed
>>
>>     
>
>   


Re: using Resource Bundles for message strings

Posted by Jarek Gawor <jg...@gmail.com>.
Some thoughts:

1) Each module or plugin should have its own resource file.

2) Messages should be formatted using java.text.MessageFormat. The
substitution arguments should be arbitrary objects (not just strings)
and should be passed using varargs.

3) As soon as we encode the module or group id into the key or
whatever, it will become invalid or inaccurate. It's a maintenance
mess in my opinion. I think the key should just be a simple string
without any additional encoded information. We can inject some extra
info as the message is displayed but the key should be very simple.

Jarek

On Tue, Feb 26, 2008 at 10:30 AM, B.J. Reed <bj...@gmail.com> wrote:
> I have written a patch to get Geronimo messages from a common set of
>  resource bundles.  Included in the patch is the
>  GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the
>  start of the  geronimo-messages.properties file.
>
>  The patch should be unzipped into the
>  trunk/framework/modules/geronimo-common directory.  Please take a look
>  and provide suggestions/comments/etc.  I would like to really begin
>  moving messages into this common file - probably a module at a time.
>
>  Questions/Answers
>
>  1) How do I use the new class in the Geronimo code?  So that we don't
>  load the list of messages and keys multiple times, the
>  GeronimoMessageBundle is a singleton.  Simply make a call to
>  GeronimoMessageBundle.getInstance() and then make the appropriate
>  getMessage call.  For starters, I have made the message key the message
>  number that will show up as part of the message.  Also provided is a way
>  to substitute parts of the message with substitution strings.
>
>  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.
>
>  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.
>
>  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.  Right now, the
>  machine locale is used.  After we have several translations, we may want
>  to add something to the Admin Console to allow an administrator to set
>  the locale.
>
>  5)  Is there a way to have the .properties file(s) outside of the jar?
>  I'm sure there is, but I haven't stumbled across it yet.  That's
>  actually where I've been banging my head the last few days.
>
>  6)  I also envision that when we have all the messages in the common
>  file, that it will be very easy to have a troubleshooting section on our
>  website that gives more in depth knowledge about each message.
>
>  I will begin writing 2.2 documentation from the above questions.
>
>  This is just for message translation, so I believe that we'll need to
>  come up with other methods for the Admin Console and possibly the
>  Eclipse plugin if we want to have everything translatable.
>
>  -- B.J. Reed
>

Re: using Resource Bundles for message strings

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On Feb 26, 2008, at 7:30 AM, B.J. Reed wrote:

> I have written a patch to get Geronimo messages from a common set of  
> resource bundles.  Included in the patch is the  
> GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the  
> start of the  geronimo-messages.properties file.

Neat!

> 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've had a fair bit of i18n experience.  Using codes for for i18n has  
never went well.  It obfuscates code.  I've never run into a situation  
where having a code made it easer than a terse phrase:

return getMessage ("COMMW0002", key);

instead of

return getMessage ("tooManySubstitutions", key);

> 5)  Is there a way to have the .properties file(s) outside of the  
> jar?  I'm sure there is, but I haven't stumbled across it yet.   
> That's actually where I've been banging my head the last few days.

OSGi fragments?  :D


Regards,
Alan


Re: using Resource Bundles for message strings

Posted by "B.J. Reed" <bj...@gmail.com>.
I will implement both suggestions for the message key naming convention: 
Dan's idea to move the I/E/W to the end to make it stand out more and 
Donald's use the groupid + abbreviated class name for the prefix.  I'll 
also use Dan's suggestion to remove the key from the message in the 
.properties file and just prepend it onto the message in the code.

I had started off looking at using one property file per module, but ran 
into some early trouble with getting that to work.  (I was trying to run 
before I was walking).  Now that I'm this far, I just tried and it is 
pretty easy to set up so that each module/plugin will have its own 
properties file in its own .jar.

-- B.J.

Donald Woods wrote:
> Wasn't clear, but are you proposing a properties files per module?  If 
> not, then placing all of the possible strings in one common file will 
> become a nightmare to maintain and breaks from our plugin architecture.
>
> As far as the message prefix, how about using an abbreviated maven 
> artifact groupid along with a abbreviated class name?
> ie. framework/modules/geronimo-core would be GFMCRxxxx, where
> G = Geronimo
> F = Framework
> M = Modules
> CR = geronimo-core and CM = geronimo-common
>
> and plugins/axis2/axis2-deployer would be GPCADxxxx, where
> G = Geronimo
> P = Plugin
> C = Config and M = Module
> AD = Axis2-deployer and AX = axis2
>
>
> -Donald
>
> B.J. Reed wrote:
>> I have written a patch to get Geronimo messages from a common set of 
>> resource bundles.  Included in the patch is the 
>> GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the 
>> start of the  geronimo-messages.properties file.
>>
>> The patch should be unzipped into the 
>> trunk/framework/modules/geronimo-common directory.  Please take a 
>> look and provide suggestions/comments/etc.  I would like to really 
>> begin moving messages into this common file - probably a module at a 
>> time.
>>
>> Questions/Answers
>>
>> 1) How do I use the new class in the Geronimo code?  So that we don't 
>> load the list of messages and keys multiple times, the 
>> GeronimoMessageBundle is a singleton.  Simply make a call to 
>> GeronimoMessageBundle.getInstance() and then make the appropriate 
>> getMessage call.  For starters, I have made the message key the 
>> message number that will show up as part of the message.  Also 
>> provided is a way to substitute parts of the message with 
>> substitution strings.
>>
>> 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.
>>
>> 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.
>>
>> 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.  Right now, 
>> the machine locale is used.  After we have several translations, we 
>> may want to add something to the Admin Console to allow an 
>> administrator to set the locale.
>>
>> 5)  Is there a way to have the .properties file(s) outside of the 
>> jar?  I'm sure there is, but I haven't stumbled across it yet.  
>> That's actually where I've been banging my head the last few days.
>>
>> 6)  I also envision that when we have all the messages in the common 
>> file, that it will be very easy to have a troubleshooting section on 
>> our website that gives more in depth knowledge about each message.
>>
>> I will begin writing 2.2 documentation from the above questions.
>>
>> This is just for message translation, so I believe that we'll need to 
>> come up with other methods for the Admin Console and possibly the 
>> Eclipse plugin if we want to have everything translatable.
>>
>> -- B.J. Reed


Re: using Resource Bundles for message strings

Posted by Donald Woods <dw...@apache.org>.
Wasn't clear, but are you proposing a properties files per module?  If 
not, then placing all of the possible strings in one common file will 
become a nightmare to maintain and breaks from our plugin architecture.

As far as the message prefix, how about using an abbreviated maven 
artifact groupid along with a abbreviated class name?
ie. framework/modules/geronimo-core would be GFMCRxxxx, where
G = Geronimo
F = Framework
M = Modules
CR = geronimo-core and CM = geronimo-common

and plugins/axis2/axis2-deployer would be GPCADxxxx, where
G = Geronimo
P = Plugin
C = Config and M = Module
AD = Axis2-deployer and AX = axis2


-Donald

B.J. Reed wrote:
> I have written a patch to get Geronimo messages from a common set of 
> resource bundles.  Included in the patch is the 
> GeronimoMessageBundle.java, GeronimoMessageBundleTest.java, and the 
> start of the  geronimo-messages.properties file.
> 
> The patch should be unzipped into the 
> trunk/framework/modules/geronimo-common directory.  Please take a look 
> and provide suggestions/comments/etc.  I would like to really begin 
> moving messages into this common file - probably a module at a time.
> 
> Questions/Answers
> 
> 1) How do I use the new class in the Geronimo code?  So that we don't 
> load the list of messages and keys multiple times, the 
> GeronimoMessageBundle is a singleton.  Simply make a call to 
> GeronimoMessageBundle.getInstance() and then make the appropriate 
> getMessage call.  For starters, I have made the message key the message 
> number that will show up as part of the message.  Also provided is a way 
> to substitute parts of the message with substitution strings.
> 
> 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.
> 
> 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.
> 
> 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.  Right now, the 
> machine locale is used.  After we have several translations, we may want 
> to add something to the Admin Console to allow an administrator to set 
> the locale.
> 
> 5)  Is there a way to have the .properties file(s) outside of the jar?  
> I'm sure there is, but I haven't stumbled across it yet.  That's 
> actually where I've been banging my head the last few days.
> 
> 6)  I also envision that when we have all the messages in the common 
> file, that it will be very easy to have a troubleshooting section on our 
> website that gives more in depth knowledge about each message.
> 
> I will begin writing 2.2 documentation from the above questions.
> 
> This is just for message translation, so I believe that we'll need to 
> come up with other methods for the Admin Console and possibly the 
> Eclipse plugin if we want to have everything translatable.
> 
> -- B.J. Reed