8234347: "Turkey" meta time zone does not generate composed localized names

8236548: Localized time zone name inconsistency between English and other locales

Reviewed-by: joehw, rriggs
This commit is contained in:
Naoto Sato 2020-02-12 08:25:35 -08:00
parent 2fbbce2b23
commit 5c3a01591c
10 changed files with 177 additions and 254 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -4260,9 +4260,15 @@ public final class DateTimeFormatterBuilder {
char nextNextChar = text.charAt(position + 1);
if (context.charEquals(nextChar, 'U') && context.charEquals(nextNextChar, 'T')) {
if (length >= position + 3 && context.charEquals(text.charAt(position + 2), 'C')) {
return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
// There are localized zone texts that start with "UTC", e.g.
// "UTC\u221210:00" (MINUS SIGN instead of HYPHEN-MINUS) in French.
// Exclude those ZoneText cases.
if (!(this instanceof ZoneTextPrinterParser)) {
return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
}
} else {
return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
}
return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
} else if (context.charEquals(nextChar, 'G') && length >= position + 3 &&
context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) {
if (length >= position + 4 && context.charEquals(text.charAt(position + 3), '0')) {