RFR: 8016127 - NLS: logging.properties translatability recommendation

Daniel Fuchs daniel.fuchs at oracle.com
Tue Sep 3 21:59:20 UTC 2013

On 9/3/13 9:57 PM, Naoto Sato wrote:
> Hi Daniel,
> Just one comment. When you are retrieving the default locale, please 
> use Locale.getDefault(Locale.Category.DISPLAY) which returns the 
> default locale for displaying translatable names.
Hi Naoto - ResourceBundle.getBundle(String rbName) is documented as 
returning the
same thing than:
|     getBundle(baseName, Locale.getDefault(), 
So my changes which replaced ResourceBundle.getBundle(String rbName) with
ResourceBundle.getBundle(String rbName, Locale.getDefault()) didn't 
change anything in
that respect.

I am curious about why I should be using 
Locale.getDefault(Locale.Category.DISPLAY) rather
than plain |Locale.getDefault()| and perhaps more importantly - in which 
case I should
be using the one rather than the other?

best regards, and thanks for your insights!

-- daniel

> Naoto
> On 9/2/13 6:29 AM, Daniel Fuchs wrote:
>> Hi,
>> Please find below a fix for:
>> 8016127: NLS: logging.properties translatability recommendation
>> <http://cr.openjdk.java.net/~dfuchs/webrev_8016127/webrev.03/>
>> This fix corrects localized Level names in JDK 8.
>> It updates the logging.properties resource bundles to follow
>> internationalization guidelines: all caps words are usually considered
>> as constant names that must not be translated - and the base
>> resource bundle logging.properties - will no longer contain
>> capitalized names.
>> The changeset contains a test that will verify that
>> the logging.properties bundles are correct - which should
>> hopefully catch translation issues early int the process and avoid
>> last minutes fire-drills like we had in the past.
>> To make the test pass, I had to replace the untranslated bundles
>> from JDK 8 by their translated version from JDK 7u-dev.
>> The fix also makes sure that the Level names will still be printed
>> in all caps, even if their translation isn't.
>> As per Mandy's request I also took this opportunity to fix the
>> localized name caching mechanism which didn't take into account
>> possible changes of the default locale returned by
>> Locale.getDefault().
>> best regards,
>> -- daniel

More information about the core-libs-dev mailing list