mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
classlib: fix toLowerCase
/toUpperCase
on Locale.ROOT
(#862)
This commit is contained in:
parent
fa5fa3df47
commit
4fc43a5597
|
@ -278,7 +278,7 @@ public final class TLocale implements TCloneable, TSerializable {
|
||||||
|
|
||||||
public TString toLanguageTag() {
|
public TString toLanguageTag() {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
result.append(languageCode);
|
result.append(languageCode.isEmpty() ? "und" : languageCode);
|
||||||
if (!countryCode.isEmpty()) {
|
if (!countryCode.isEmpty()) {
|
||||||
result.append('-');
|
result.append('-');
|
||||||
result.append(countryCode);
|
result.append(countryCode);
|
||||||
|
|
|
@ -328,6 +328,7 @@ public class StringTest {
|
||||||
assertEquals("İSTANBUL", turkish.toUpperCase(new Locale("tr", "TR")));
|
assertEquals("İSTANBUL", turkish.toUpperCase(new Locale("tr", "TR")));
|
||||||
assertNotEquals(common.toUpperCase(Locale.US), turkish.toUpperCase(new Locale("tr", "TR")));
|
assertNotEquals(common.toUpperCase(Locale.US), turkish.toUpperCase(new Locale("tr", "TR")));
|
||||||
assertEquals(common.toUpperCase(Locale.US), common.toUpperCase(Locale.CANADA));
|
assertEquals(common.toUpperCase(Locale.US), common.toUpperCase(Locale.CANADA));
|
||||||
|
assertEquals(common.toUpperCase(Locale.US), common.toUpperCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -70,5 +70,6 @@ public class LocaleTest {
|
||||||
assertEquals("zh-CN", Locale.SIMPLIFIED_CHINESE.toLanguageTag());
|
assertEquals("zh-CN", Locale.SIMPLIFIED_CHINESE.toLanguageTag());
|
||||||
assertEquals("en-GB", Locale.UK.toLanguageTag());
|
assertEquals("en-GB", Locale.UK.toLanguageTag());
|
||||||
assertEquals("en-US", Locale.US.toLanguageTag());
|
assertEquals("en-US", Locale.US.toLanguageTag());
|
||||||
|
assertEquals("und", Locale.ROOT.toLanguageTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user