commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias Jiderhamn <>
Subject [i18n] Remaining issues (updated 2005-06-18)
Date Sat, 18 Jun 2005 07:53:33 GMT
[A few entries have been removed and a comment has beedn added to the list 
of remaining issues previously posted]

Here is a list of what I think needs to be done before i18n is moved to 
proper/released as 1.0:

* If the id ("parent") exists, but the entry ("child") does not, the 
ResourceBundleMessageProvider throws an exception (erroneously claiming "No 
message entries found for bundle with key ..."), while the 
XMLMessageProvider returns null.
Proposed fix: Make all implementations of MessageProvider.getText() return 
null if message is not found and have MessageManager.getText() throw the 
Exception instead. We can then remove the try/catch in MessageManager.
Also consider renaming MessageProvider.getText() to 
 for implementors.

* The ResourceBundleMessageProvider and the XMLMessageProvider behave 
differently when an entry does not exist in a non-default language. With 
ResourceBundles, if there is an entry, say
   helloWorld.notTranslated=This entry is not translated to any other languages
that only exists in the default locale file, the entry will be included 
when calling getEntries() for *any* locale. Whereas for XML, only the 
entries defined for the given locale will be returned.
Proposed fix: First of all, I am not sure I personally think this needs 
should normally be translated. Secondly, I 
don't know which behaviour I believe is most correct, but since we cannot 
change the implementation of ResourceBundle, the only option would be to 
make XMLMessageProvider (and any other MessageProvider) behave the same way 
as the ResourceBundleMessageProvider. If we decide this does not need to be 
fixed, we need to document the difference in behaviour somewhere (JavaDoc?).

* Consider the semi-circular dependency between MessageManager and the 
MessageProvider implementations. The implementations are used, via the 
interface, by the MessageManager and the MessageManager is used by the 
implementations for install/uninstall through static methods, and for 
internal error messages.
Proposed fix(es):
   1. Remove the static install/uninstall/update methods on the 
MessageProvider implementations.
   2. Move the MessageManager.INTERNAL_MESSAGES and the internal message 
keys to a utitly class, say I18nUtils. I have ideas for other stuff to put 
there too. Another alternative would be to consider whether we actually 
need these error messages in the MessageProvider implementations. As of the 
above proposal, at least the use of MessageManager.NO_MESSAGE_ENTRIES_FOUND 
should be moved to MessageManager instead.

* Consider the circular depency between the "org.apache.commons.i18n" and 
"org.apache.commons.i18n.bundles" packages. For example 
.i18n.LocalizedException uses 
org.apache.commons.i18n.bundles.ErrorBundle which is a subclass to 
Proposed fix: Personally I think the org.apache.commons.i18n.bundles 
packages is a bit overkill; why not remove it altogether? Otherwise, move 
the LocalizedException/RuntimeException/Error into the bundles package (or 
another package such as "org.apache.commons.i18n.exceptions").

* Synchronize Maven (project.xml) and Ant (build.xml).
Proposed fix: Add jcoverage test coverage to build.xml. (I have EMMA test 
coverage with Ant locally). This might imply adding jcoverage jars to a lib 

* Create a database/JDBC MessageProvider to be used out-of-the-box, 
subclassed or as an example.
Proposed fix: I have it in my head, just need to find the time to code it.
Update 2005-06-18: Preliminary version e-mailed to Daniel Florey.

* Consider examples with qualified entries.
Proposed fix: Create code example that use my modification with qualified 

* Consider adding check style plugin in project.xml and fix whatever it 

Addition 2005-06-18:
* Consider adding Commons Resources MessageProvider.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message