-
Bug
-
Resolution: Unresolved
-
P4
-
9
The issue exists on locale:"ur", "ur-IN", "ur-PK", "ug", "ug-CN", "te", "te-IN", "pt-MO", "ko", "ko-KP", "ko-KR", "kn", "kn-IN", "hi", "hi-IN", "bn", "bn-BD", "bn-IN".
For example on ko locale. To get dayPeriod symbol 'a", there are both abbreviated and wide dayPeriod types in the ko.xml file, as CLDR defined it should get the abbreviated type, but actually Java return the wide type.
Use below code to get Java's output. Java's output is 96. 2. 8. 오전 11:45, but as CLDR defined. should be 96. 2. 8. AM 11:45
--------------------------------
Locale target = Locale.forLanguageTag("ko");
String format = FormatStyle.SHORT.toString();
LocalDateTime dateTime = LocalDateTime
.of(Integer.parseInt("1996"), Integer.parseInt("2"),
Integer.parseInt("8"), Integer.parseInt("11"),
Integer.parseInt("45"), Integer.parseInt("8"));
DateTimeFormatter formatter = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.valueOf(format));
formatter = formatter.withLocale(target);
String actualResult = dateTime.format(formatter);
System.out.println(actualResult);
-----------------------------------
For example on ko locale. To get dayPeriod symbol 'a", there are both abbreviated and wide dayPeriod types in the ko.xml file, as CLDR defined it should get the abbreviated type, but actually Java return the wide type.
Use below code to get Java's output. Java's output is 96. 2. 8. 오전 11:45, but as CLDR defined. should be 96. 2. 8. AM 11:45
--------------------------------
Locale target = Locale.forLanguageTag("ko");
String format = FormatStyle.SHORT.toString();
LocalDateTime dateTime = LocalDateTime
.of(Integer.parseInt("1996"), Integer.parseInt("2"),
Integer.parseInt("8"), Integer.parseInt("11"),
Integer.parseInt("45"), Integer.parseInt("8"));
DateTimeFormatter formatter = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.valueOf(format));
formatter = formatter.withLocale(target);
String actualResult = dateTime.format(formatter);
System.out.println(actualResult);
-----------------------------------
- duplicates
-
JDK-8201796 Improper retrieval of display names for AmPmMarkers for TextStyle.SHORT.
- Closed