[slf4j-user] Yet another facility for SLF4J i18n

USHAKOV, Sergey s-n-ushakov at yandex.ru
Tue Jun 18 02:29:56 CEST 2013


Hi all,

to be frank, I hesitated for quite a while, whether I should better 
write to this list or to "cal10n-dev" :)  Still I decided to start with 
this one, and we can move to another list later, should it be appropriate...

Well, I have a news I would like to share with those interested in i18n 
topic. A new i18n library is available, and it has an interface to 
SLF4J, somewhat similar to org.slf4j.cal10n.

The main ideas behind the new i18n library are:
- doing without ResourceBundle and its codepage limitations;
- getting i18n resources compiler verifiable.

I have seen that CAL10N has addressed both of these issues successfully 
with latest JSR-269 support. Still my personal impression is that 
getting JSR-269 facilities doing their job is still somewhat tricky...

The new library uses an approach with all localized messages being 
bundled into special collections directly in Java code. Hence tight 
compiler integration. Hence IDE's autocompletion facilities available 
for i18n resources as a bonus :)

Everyone interested is welcome to visit my blog page at [ 
http://s-n-ushakov.blogspot.com/2013/06/look-ma-no-resourcebundle-step-2.html 
] for more approach and implementation details and for downloads.

In order to use the library, an application will need to subclass 
I18nHandler [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I18nHandler.html 
] or I18nHandlerInContext<TContext> [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I18nHandlerInContext.html 
] and implement an application-specific way of getting user and/or 
system locale preferences. Two ready-to-use subclasses ( [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I18nHandlerForServletRequest.html 
] and [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I18nHandlerForSingleUser.html 
] ) are available for some common cases.

SLF4J logging is taken care of by I15dLogger [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I15dLogger.html 
] and I15dLoggerFactory [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/I15dLoggerFactory.html 
] .

A minimalistic usage example is available from package summary page: [ 
http://s-n-ushakov.tw1.ru/downloads/java/usn-i18n-nobundle/last/javadocs/usn/i18n/nobundle/package-summary.html#package_description 
] .

Any comments are most welcome :)

Regards,
Sergey



More information about the slf4j-user mailing list