commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <>
Subject Re: Commons Configuration for i18n
Date Wed, 06 Jan 2010 00:28:41 GMT
Funny you should ask.  This is on my list of things to do and I have a meeting on my calendar
for later in the week to discuss this for one of our projects.

Basically, Commons Configuration provides a great foundation because of the way it can interpolate
variables. Typical I18N implementations allow variable replacement, but only with values provided
by the application, not with values defined in other keys.  In my use case we need to use
"tiering" so that a default file can reference values specified for a particular client. 
To do this the normal search algorithm has to change. java.util.ResourceBundle describes the
search algorithm as:

baseName + "_" + language1 + "_" + country1 + "_" + variant1
baseName + "_" + language1 + "_" + country1
baseName + "_" + language1

In my case we need it to be

clientDir/baseName + "_" + language1 + "_" + country1 + "_" + variant1
defaultDir/baseName + "_" + language1 + "_" + country1 + "_" + variant1
clientDir/baseName + "_" + language1 + "_" + country1
defaultDir/baseName + "_" + language1 + "_" + country1
clientDir/baseName + "_" + language1
defaultDir/baseName + "_" + language1

Since the bundles would all leverage the XML properties file format (because XML can specify
the encoding while "normal" property files cannot) I was thinking of doing this by creating
a factory class that returns a wrapper around a DynamicCompositeConfiguration (a new class
that would be similar to DynamicCombinedConfiguration) with only the methods appropriate for
I18N messages and then building adapters for GWT, Spring, etc. A dynamic configuration is
needed so that the correct locale and client dir(s) are used on each request. I wouldn't want
to use a CombinedConfiguration for this because message files can get to be quite large and
because each instance includes all the data memory usage could get out of hand


On Jan 5, 2010, at 10:51 AM, Yogesh Rao wrote:

> Hi,
> I need to know if anyone has used configuration for internationalization purposes. Any
pointers on how this has been achieved would be great. The two source where i think i would
like to have this data configured would either be properties or database.
> Thanks in advance.
> Information transmitted by this e-mail is proprietary to MphasiS, its associated companies
and/ or its customers and is intended 
> for use only by the individual or entity to which it is addressed, and may contain information
that is privileged, confidential or 
> exempt from disclosure under applicable law. If you are not the intended recipient or
it appears that this mail has been forwarded 
> to you without proper authority, you are notified that any use or dissemination of this
information in any manner is strictly 
> prohibited. In such cases, please notify us immediately at and
delete this mail from your records.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message