RFR: 8016127 - NLS: logging.properties translatability recommendation

Naoto Sato naoto.sato at oracle.com
Tue Sep 3 22:27:58 UTC 2013

Hi Daniel,

Locale.Category was introduced in JDK7 where the user can set the 
default locales separately for UI display names and Formatting. In your 
case, the resource bundle seems to contain user visible localizable 
strings, so I suggested using getDefault() with Locale.Category.DISPLAY 
specifically. That way the user would see the string in the correct 
language even on any custom default locale environment.


On 9/3/13 2:59 PM, Daniel Fuchs wrote:
> 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(),
> this.getClass().getClassLoader())|,
> 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