Hi Brent,

I looked at the system preference setting panel and noticed there is "Spanish (Latin America)", which I think uses UN M.49 code ("es-419") as the designate region. Can you make changes to deal with it? (sorry I should have noticed this earlier, and it's unfortunate not to be able to upcall Locale.forLanguageTag()!)

Naoto

On 6/20/16 4:38 PM, Brent Christian wrote:
Hi,

I have an updated webrev at:
http://cr.openjdk.java.net/~bchristi/7131356/webrev.03/

The comments have been updated as Gerard suggested.

The code to process the languageString now accounts for 3-character
language codes, and 4-char script designations (line 86).

More extensive testing of languages with multiple scripts/regions
revealed that more changes were needed to maintain current behavior.
Without knowing the internal workings of how
JRSCopyCanonicalLanguageForPrimaryLanguage adjusts the language ID, I
believe the best options are to add a few more mappings as needed to
locale_aliases (locale_str.h), and to add a special case for Portuguese
(line 104).

OS X has 3 language options for Portuguese:
Portugues (Portugal)
Portugues (Brasil)
Portugues (Brasileiro)

CFLocaleCopyPreferredLanguages() gives the expected language code for
Portugues (Brasileiro) ("pt-BR"), but "Portugues (Brasil)" doesn't
include a region code (it's simply, "pt"), so gets mapped to the default
country, Portugal.  To maintain current behavior, I added a special case
to map "pt" to "pt_BR" when the Region system preference is set to Brazil.


This change introduces one notable behavior change, which I argue is
actually a fix.  The bug report and test case do not list the "Spanish
(Mexico)" language, but it is present on MaxOS 10.9 (presumably it was
added to the OS since the original investigation).  The old code mapped
this to "es_XL", XL being one of the "user-assigned" ISO 3166 country
codes.  The new code maps to "es_MX", MX being the country code for Mexico.


I've tested pretty thoroughly on MacOS 10.9; I'm pretty sure I tried
every language that includes multiple scripts/locales.  I also added a
couple updated tests to the bug report.

General testing has looked good so far.

Thanks,
-Brent

Reply via email to