[
https://issues.apache.org/jira/browse/LUCENE-6978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15101744#comment-15101744
]
Uwe Schindler commented on LUCENE-6978:
---------------------------------------
The list of language tags in Java 8 is: [ar, ar-AE, ar-BH, ar-DZ, ar-EG, ar-IQ,
ar-JO, ar-KW, ar-LB, ar-LY, ar-MA, ar-OM, ar-QA, ar-SA, ar-SD, ar-SY, ar-TN,
ar-YE, be, be-BY, bg, bg-BG, ca, ca-ES, cs, cs-CZ, da, da-DK, de, de-AT, de-CH,
de-DE, de-GR, de-LU, el, el-CY, el-GR, en, en-AU, en-CA, en-GB, en-IE, en-IN,
en-MT, en-NZ, en-PH, en-SG, en-US, en-ZA, es, es-AR, es-BO, es-CL, es-CO,
es-CR, es-CU, es-DO, es-EC, es-ES, es-GT, es-HN, es-MX, es-NI, es-PA, es-PE,
es-PR, es-PY, es-SV, es-US, es-UY, es-VE, et, et-EE, fi, fi-FI, fr, fr-BE,
fr-CA, fr-CH, fr-FR, fr-LU, ga, ga-IE, he, he-IL, hi, hi-IN, hr, hr-HR, hu,
hu-HU, id, id-ID, is, is-IS, it, it-CH, it-IT, ja, ja-JP,
ja-JP-u-ca-japanese-x-lvariant-JP, ko, ko-KR, lt, lt-LT, lv, lv-LV, mk, mk-MK,
ms, ms-MY, mt, mt-MT, nl, nl-BE, nl-NL, nn-NO, no, no-NO, pl, pl-PL, pt, pt-BR,
pt-PT, ro, ro-RO, ru, ru-RU, sk, sk-SK, sl, sl-SI, sq, sq-AL, sr, sr-BA, sr-CS,
sr-Latn, sr-Latn-BA, sr-Latn-ME, sr-Latn-RS, sr-ME, sr-RS, sv, sv-SE, th,
th-TH, th-TH-u-nu-thai-x-lvariant-TH, tr, tr-TR, uk, uk-UA, und, vi, vi-VN, zh,
zh-CN, zh-HK, zh-SG, zh-TW]
> Make LuceneTestCase use language tags instead of parsing locales by hand
> ------------------------------------------------------------------------
>
> Key: LUCENE-6978
> URL: https://issues.apache.org/jira/browse/LUCENE-6978
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/test-framework
> Reporter: Uwe Schindler
> Assignee: Uwe Schindler
> Fix For: Trunk
>
> Attachments: LUCENE-6978.patch
>
>
> Since we are on Java 7, the JDK supports standardized language tags as
> identifiers for Locales. Previous versions of JDK were missing a constructor
> from {{Locale#toString()}} back to a locale, so we had our own, which was
> broken several times after the JDK changed their Locale internals.
> This patch will do the following:
> - When printing the reproduce line, it will use {{Locale#getLanguageTag()}},
> so you can identify the locale in standardized form. Most notable change is
> (next to more flexibility around asian languages) the change away from
> undescores. So it prints "en-US", not "en_US".
> - The code that parses a locale uses Locale's Builder and sets the language
> tag. This will fail if the tag is invalid! A trap is
> {{Locale#forLanguageTag}}, because this one silently returns root locale if
> unparseable...
> - The random locale is choosen from all language tags, which are extracted
> from the JDK as a {{String[]}} array.
> I would also like to place {{Locale#forLanguageTag}} on the forbidden list
> and disallow directly calling {{Locale#toString()}}, the latter is legacy API
> (according to Java 7 Javadocs). This would fail code that calls toString()
> directly, e.g. when formatting stuff like {{"my Locale: " + locale}}. Of
> course we cannot catch all bad uses.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]