<i18n dev> RFR: 8341366: Suspicious check in Locale.getDisplayName(Locale inLocale) [v2]

Naoto Sato naoto at openjdk.org
Tue Oct 8 22:18:59 UTC 2024


On Tue, 8 Oct 2024 21:42:38 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Please review this PR which modifies a suspicious check in the fallback of `Locale.getDisplayName(Locale inLocale)`.
>> 
>> As a fallback, a hard coded pattern is used. The previous code outputted the qualifiers if the `displayNames` array had length greater than 2. Just a few lines above, the array is initialized with a length of 3 and so the check is pointless.
>> 
>> It would be better, if replaced with a null check for the last element of the `displayNames` array, as that element may be null if there are no qualifiers. See L2317 ,
>> 
>> `qualifierNames.length != 0 ? formatList(qualifierNames, listCompositionPattern) : null`
>> 
>> For example, now a fallback (with no qualifiers) might look like: `German` instead of `German (null)`.
>> But will remain the same (with qualifiers): `German (Germany)`.
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   reflect review - chain appends

Marked as reviewed by naoto (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/21298#pullrequestreview-2355635836


More information about the i18n-dev mailing list