From 3c96a981e55eaf063b3cb3c5a5758178904d62b5 Mon Sep 17 00:00:00 2001 From: btangmu Date: Sun, 15 Dec 2024 17:51:07 -0500 Subject: [PATCH] CLDR-15830 Rename some NameGetter methods; use NameOpt.COMPOUND_ONLY instead of boolean -Rename getNameFromBCP47 to getNameFromIdentifier, since may not be only BCP47; change some comments accordingly -Avoid boolean parameter onlyConstructCompound; use enum NameGetter.NameOpt instead, values COMPOUND_ONLY and DEFAULT --- .../java/org/unicode/cldr/web/LocaleTree.java | 3 +- .../cldr/draft/GenerateLanguageData.java | 5 +- .../java/org/unicode/cldr/draft/Misc.java | 10 +- .../java/org/unicode/cldr/test/CLDRTest.java | 2 +- .../unicode/cldr/test/ConsoleCheckCLDR.java | 6 +- .../cldr/test/EmojiSubdivisionNames.java | 4 +- .../unicode/cldr/test/ExampleGenerator.java | 6 +- .../org/unicode/cldr/test/QuickCheck.java | 3 +- .../java/org/unicode/cldr/test/TestMisc.java | 2 +- .../cldr/test/TestSupplementalData.java | 2 +- .../unicode/cldr/tool/ChartAnnotations.java | 4 +- .../org/unicode/cldr/tool/ChartCollation.java | 6 +- .../unicode/cldr/tool/ChartDayPeriods.java | 2 +- .../org/unicode/cldr/tool/ChartDelta.java | 2 +- .../cldr/tool/ChartGrammaticalForms.java | 4 +- .../cldr/tool/ChartLanguageMatching.java | 10 +- .../unicode/cldr/tool/ChartPersonName.java | 2 +- .../cldr/tool/ChartSubdivisionNames.java | 4 +- .../unicode/cldr/tool/ChartSupplemental.java | 2 +- .../cldr/tool/CheckEnglishCurrencyNames.java | 2 +- .../cldr/tool/CheckLanguageNameCoverage.java | 2 +- .../unicode/cldr/tool/CompareSuppress.java | 2 +- .../cldr/tool/ConvertLanguageData.java | 10 +- .../org/unicode/cldr/tool/CountItems.java | 2 +- .../org/unicode/cldr/tool/DeriveScripts.java | 2 +- .../org/unicode/cldr/tool/DiffWithParent.java | 4 +- .../unicode/cldr/tool/ExtractMessages.java | 4 +- .../cldr/tool/FindPluralDifferences.java | 2 +- .../unicode/cldr/tool/FixTransformNames.java | 4 +- .../cldr/tool/GenerateChangeChart.java | 6 +- .../unicode/cldr/tool/GenerateComparison.java | 4 +- .../cldr/tool/GenerateCoverageLevels.java | 12 +- .../cldr/tool/GenerateDayPeriodChart.java | 2 +- .../cldr/tool/GenerateDerivedAnnotations.java | 2 +- .../org/unicode/cldr/tool/GenerateEnums.java | 2 +- .../org/unicode/cldr/tool/GenerateG2xG2.java | 8 +- .../unicode/cldr/tool/GenerateKaraList.java | 2 +- .../cldr/tool/GenerateLanguageData.java | 2 +- .../cldr/tool/GenerateLikelySubtags.java | 2 +- .../cldr/tool/GenerateLocaleIDTestData.java | 32 ++--- .../cldr/tool/GeneratePluralRanges.java | 2 +- .../cldr/tool/GenerateSeedDurations.java | 4 +- .../cldr/tool/GenerateSidewaysView.java | 2 +- .../unicode/cldr/tool/GenerateStatistics.java | 4 +- .../org/unicode/cldr/tool/GetChanges.java | 2 +- .../unicode/cldr/tool/GetLanguageData.java | 3 +- .../java/org/unicode/cldr/tool/LSRSource.java | 4 +- .../unicode/cldr/tool/ListGrammarData.java | 2 +- .../unicode/cldr/tool/ListGrammarInfo.java | 4 +- .../main/java/org/unicode/cldr/tool/Misc.java | 2 +- .../unicode/cldr/tool/ScriptPopulations.java | 2 +- .../org/unicode/cldr/tool/ShowChildren.java | 4 +- .../java/org/unicode/cldr/tool/ShowData.java | 9 +- .../unicode/cldr/tool/ShowLanguageData.java | 2 +- .../org/unicode/cldr/tool/ShowLanguages.java | 10 +- .../unicode/cldr/tool/ShowLocaleCoverage.java | 13 ++- .../org/unicode/cldr/tool/ShowPlurals.java | 2 +- .../cldr/tool/ShowRegionalVariants.java | 10 +- .../cldr/tool/ShowStarredCoverage.java | 4 +- .../org/unicode/cldr/tool/VettingAdder.java | 2 +- .../tool/WritePluralRulesSpreadsheets.java | 2 +- .../org/unicode/cldr/util/CLDRLocale.java | 25 ++-- .../org/unicode/cldr/util/CLDRTransforms.java | 2 +- .../unicode/cldr/util/DateTimeFormats.java | 4 +- .../unicode/cldr/util/DayPeriodsCheck.java | 4 +- .../cldr/util/GlossonymConstructor.java | 7 +- .../org/unicode/cldr/util/LanguageGroup.java | 2 +- .../org/unicode/cldr/util/NameGetter.java | 109 ++++++++++-------- .../org/unicode/cldr/util/PluralSnapshot.java | 2 +- .../org/unicode/cldr/util/TestUtilities.java | 4 +- .../cldr/util/VerifyCompactNumbers.java | 4 +- .../org/unicode/cldr/util/VerifyZones.java | 5 +- .../org/unicode/cldr/util/VettingViewer.java | 5 +- .../cldr/util/WikipediaOfficialLanguages.java | 4 +- .../unittest/CheckLanguageCodeConverter.java | 2 +- .../org/unicode/cldr/unittest/CheckYear.java | 4 +- .../cldr/unittest/LanguageInfoTest.java | 2 +- .../cldr/unittest/StandardCodesTest.java | 2 +- .../org/unicode/cldr/unittest/TestBasic.java | 6 +- .../unicode/cldr/unittest/TestCLDRFile.java | 2 +- .../cldr/unittest/TestCLDRLocaleCoverage.java | 8 +- .../unicode/cldr/unittest/TestCLDRUtils.java | 10 +- .../unicode/cldr/unittest/TestCheckCLDR.java | 2 +- .../unicode/cldr/unittest/TestCoverage.java | 2 +- .../unicode/cldr/unittest/TestDayPeriods.java | 2 +- .../cldr/unittest/TestExampleGenerator.java | 5 +- .../cldr/unittest/TestInheritance.java | 4 +- .../cldr/unittest/TestLanguageGroup.java | 2 +- .../org/unicode/cldr/unittest/TestLocale.java | 44 ++++--- .../unittest/TestPersonNameFormatter.java | 2 +- .../cldr/unittest/TestSupplementalInfo.java | 4 +- .../unicode/cldr/unittest/TestValidity.java | 7 +- .../tool/GenerateLanguageContainment.java | 4 +- 93 files changed, 320 insertions(+), 247 deletions(-) diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/LocaleTree.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/LocaleTree.java index aa890d2883c..b30319ff781 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/LocaleTree.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/LocaleTree.java @@ -8,6 +8,7 @@ import java.util.TreeMap; import org.unicode.cldr.util.CLDRLocale; import org.unicode.cldr.util.CLDRLocale.CLDRFormatter; +import org.unicode.cldr.util.NameGetter; public class LocaleTree { CLDRFormatter displayLocale; @@ -97,7 +98,7 @@ public CLDRLocale getLocaleCode(String localeName) { } public String getLocaleDisplayName(CLDRLocale locale) { - return displayLocale.getDisplayName(locale, true, null); + return displayLocale.getDisplayName(locale, NameGetter.NameOpt.COMPOUND_ONLY, null); } public Map getMap() { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/GenerateLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/GenerateLanguageData.java index 06f8eab1953..192e417d1bc 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/GenerateLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/GenerateLanguageData.java @@ -48,7 +48,8 @@ private void run() throws IOException { Map languageNameToCode = new TreeMap<>(); NameGetter nameGetter = english.nameGetter(); for (String languageCode : info.getLanguages()) { - languageNameToCode.put(nameGetter.getNameFromBCP47(languageCode), languageCode); + languageNameToCode.put( + nameGetter.getNameFromIdentifier(languageCode), languageCode); } out.println("\n@sheet:CLDR County Data"); out.println("code\tgdp\tlit-pop\tpopulation\tliteracy"); @@ -74,7 +75,7 @@ private void run() throws IOException { Map> langToCountriesOfficial = new TreeMap<>(); for (String languageCode : info.getLanguages()) { - String languageName = nameGetter.getNameFromBCP47(languageCode); + String languageName = nameGetter.getNameFromIdentifier(languageCode); String baseLanguage = languageCode; ltp.set(languageCode); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/Misc.java b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/Misc.java index b7455bfab2a..628e4187e8d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/draft/Misc.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/draft/Misc.java @@ -139,7 +139,11 @@ private static void showDefaultContent(String... strings) { } } System.out.println( - string + "\t" + defCon + "\t" + english.nameGetter().getNameFromBCP47(defCon)); + string + + "\t" + + defCon + + "\t" + + english.nameGetter().getNameFromIdentifier(defCon)); } } @@ -329,7 +333,7 @@ private static void showExemplarSize() { if (temp != null) { baseLanguage = temp.get0().get(0); } - String englishName = english.nameGetter().getNameFromBCP47(baseLanguage); + String englishName = english.nameGetter().getNameFromIdentifier(baseLanguage); CLDRFile cldrFile = factory.make(baseLanguage, false); UnicodeSet set = cldrFile.getExemplarSet("", WinningChoice.WINNING); int script = -1; @@ -340,7 +344,7 @@ private static void showExemplarSize() { break; } } - String nativeName = cldrFile.nameGetter().getNameFromBCP47(baseLanguage); + String nativeName = cldrFile.nameGetter().getNameFromIdentifier(baseLanguage); nameAndInfo.add( englishName + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java index 1e4d04bb4b6..6080d9738e0 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CLDRTest.java @@ -413,7 +413,7 @@ public String getLocaleName(String locale) { String name = localeNameCache.get(locale); if (name != null) return name; if (english == null) english = cldrFactory.make("en", true); - String result = english.nameGetter().getNameFromBCP47(locale); + String result = english.nameGetter().getNameFromIdentifier(locale); /* * Collection c = Utility.splitList(locale, '_', false, null); * String[] pieces = new String[c.size()]; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java index e2c9793d101..edebf507cda 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ConsoleCheckCLDR.java @@ -1986,7 +1986,7 @@ private static String getEnglishPathValue(String path) { */ private static String getLocaleAndName(String locale) { String localizedName = - CheckCLDR.getDisplayInformation().nameGetter().getNameFromBCP47(locale); + CheckCLDR.getDisplayInformation().nameGetter().getNameFromIdentifier(locale); if (localizedName == null || localizedName.equals(locale)) return locale; return locale + " [" + localizedName + "]"; } @@ -2000,7 +2000,7 @@ private static String getLocaleAndName(String locale) { */ private static String getNameAndLocale(String locale, boolean linkToXml) { String localizedName = - CheckCLDR.getDisplayInformation().nameGetter().getNameFromBCP47(locale); + CheckCLDR.getDisplayInformation().nameGetter().getNameFromIdentifier(locale); if (localizedName == null || localizedName.equals(locale)) return locale; if (linkToXml) { locale = @@ -2015,7 +2015,7 @@ private static String getNameAndLocale(String locale, boolean linkToXml) { private static String getLocaleName(String locale) { String localizedName = - CheckCLDR.getDisplayInformation().nameGetter().getNameFromBCP47(locale); + CheckCLDR.getDisplayInformation().nameGetter().getNameFromIdentifier(locale); if (localizedName == null || localizedName.equals(locale)) return locale; return localizedName; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/EmojiSubdivisionNames.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/EmojiSubdivisionNames.java index 80ec98f243d..ca5babaebed 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/EmojiSubdivisionNames.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/EmojiSubdivisionNames.java @@ -146,7 +146,7 @@ public static void main(String[] args) { + "\t" + rank + "\t" - + nameGetter.getNameFromBCP47(locale) + + nameGetter.getNameFromIdentifier(locale) + "\t" + locale); for (String sd : SUBDIVISIONS) { @@ -173,7 +173,7 @@ public static void main(String[] args) { + "\t" + rank + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + locale); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java index 0f6f5098f29..9f42460130a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java @@ -759,7 +759,7 @@ private void handlePersonName(XPathParts parts, String value, List examp final String name = localeId.equals("und") ? "«any other»" - : nameGetter2.getNameFromBCP47(localeId); + : nameGetter2.getNameFromIdentifier(localeId); examples.add(localeId + " = " + name); } break; @@ -3116,9 +3116,9 @@ private void handleDisplayNames( for (int i = 0; i < locales.size(); i++) { examples.add( invertBackground( - nameGetter.getNameFromBCP47Etc( + nameGetter.getNameFromIdentifierEtc( locales.get(i), - false, + NameGetter.NameOpt.DEFAULT, localeKeyTypePattern, localePattern, localeSeparator))); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java index da0f4c9d30c..ebdbdbe0852 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/QuickCheck.java @@ -208,7 +208,8 @@ private static void checkPaths() { DisplayAndInputProcessor displayAndInputProcessor = new DisplayAndInputProcessor(file, false); - System.out.println(locale + "\t-\t" + english.nameGetter().getNameFromBCP47(locale)); + System.out.println( + locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); DtdType dtdType = null; for (Iterator it = file.iterator(); it.hasNext(); ) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMisc.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMisc.java index 89d24824692..e68f24e4679 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMisc.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestMisc.java @@ -239,7 +239,7 @@ private static void testWeights() { } NameGetter nameGetter = english.nameGetter(); for (Pair p : rel) { - System.out.println(p + "\t" + nameGetter.getNameFromBCP47(p.getSecond())); + System.out.println(p + "\t" + nameGetter.getNameFromIdentifier(p.getSecond())); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestSupplementalData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestSupplementalData.java index 796ac506ce5..85db6736682 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestSupplementalData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestSupplementalData.java @@ -168,7 +168,7 @@ static void checkAgainstLanguageScript() { nameGetter.getNameFromTypeEnumCode(NameType.TERRITORY, territory); if (otherLanguagesLeftover.size() != 0) { for (String other : otherLanguagesLeftover) { - String name = nameGetter.getNameFromBCP47(other); + String name = nameGetter.getNameFromIdentifier(other); System.out.println( territoryString + "\t" + territory + "\t" + name + "\t" + other); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartAnnotations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartAnnotations.java index 3609c4ae6f7..de5117f2ae6 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartAnnotations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartAnnotations.java @@ -178,7 +178,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { if (locale.startsWith("en")) { int debug = 0; } - String name = nameGetter.getNameFromBCP47Bool(locale, true); + String name = nameGetter.getNameFromIndentifierCompoundOnly(locale); int baseEnd = locale.indexOf('_'); ULocale loc = new ULocale(baseEnd < 0 ? locale : locale.substring(0, baseEnd)); LanguageGroup group = LanguageGroup.get(loc); @@ -189,7 +189,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { for (Entry>> groupPairs : groupToNameAndCodeSorted.keyValuesSet()) { LanguageGroup group = groupPairs.getKey(); - String ename = nameGetter.getNameFromBCP47Bool("en", true); + String ename = nameGetter.getNameFromIndentifierCompoundOnly("en"); nameToCode.clear(); nameToCode.put(ename, "en"); // always have english first diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartCollation.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartCollation.java index 77c3836466e..fba82cc34ed 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartCollation.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartCollation.java @@ -29,6 +29,7 @@ import org.unicode.cldr.util.CLDRPaths; import org.unicode.cldr.util.Factory; import org.unicode.cldr.util.FileCopier; +import org.unicode.cldr.util.NameGetter; import org.unicode.cldr.util.Pair; import org.unicode.cldr.util.PatternCache; import org.unicode.cldr.util.XMLFileReader; @@ -230,7 +231,10 @@ public void writeSubcharts(Anchors anchors) throws IOException { } new Subchart( ENGLISH.nameGetter() - .getNameFromBCP47BoolAlt(locale, true, CLDRFile.SHORT_ALTS), + .getNameFromIdentifierOptAlt( + locale, + NameGetter.NameOpt.COMPOUND_ONLY, + CLDRFile.SHORT_ALTS), locale, data) .writeChart(anchors); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDayPeriods.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDayPeriods.java index 3ade180472c..0c2ccc8d5de 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDayPeriods.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDayPeriods.java @@ -92,7 +92,7 @@ public void writeContents(FormattedFileWriter pw) throws IOException { tablePrinter .addRow() .addCell(group) - .addCell(ENGLISH.nameGetter().getNameFromBCP47(locale)) + .addCell(ENGLISH.nameGetter().getNameFromIdentifier(locale)) .addCell(locale) // .addCell(type) .addCell(df.format(time)) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDelta.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDelta.java index 1dee949d50b..80f44a23bca 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDelta.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartDelta.java @@ -1011,7 +1011,7 @@ private void writeDiffs( .addCell(coverageLevel) .finishRow(); } - String title = ENGLISH.nameGetter().getNameFromBCP47(file) + " " + chartNameCap; + String title = ENGLISH.nameGetter().getNameFromIdentifier(file) + " " + chartNameCap; writeTable(anchors, file, tablePrinter, title, tsvFile); diff.clear(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java index 37a5c68cf32..a6c6b35a37a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartGrammaticalForms.java @@ -166,7 +166,7 @@ private TablePrinter getFormattedGrammarInfo(Set localeIds) { } Set failures = new LinkedHashSet<>(); GrammarInfo grammarInfo = SDI.getGrammarInfo(localeId, false); - String localeName = CONFIG.getEnglish().nameGetter().getNameFromBCP47(localeId); + String localeName = CONFIG.getEnglish().nameGetter().getNameFromIdentifier(localeId); for (GrammaticalFeature feature : GrammaticalFeature.values()) { Map> scopeToValues = grammarInfo.get(GrammaticalTarget.nominal, feature); @@ -905,7 +905,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { powerTable)); if (!info.isEmpty()) { - String name = ENGLISH.nameGetter().getNameFromBCP47(locale); + String name = ENGLISH.nameGetter().getNameFromIdentifier(locale); new Subchart(name + ": Unit Grammar Info", locale, info).writeChart(anchors); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartLanguageMatching.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartLanguageMatching.java index 7fc3a5b4b97..ee50acfc899 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartLanguageMatching.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartLanguageMatching.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.List; import org.unicode.cldr.util.CLDRFile; +import org.unicode.cldr.util.NameGetter; public class ChartLanguageMatching extends Chart { @@ -80,7 +81,8 @@ public void writeContents(FormattedFileWriter pw) throws IOException { private String getName(String codeWithStars, boolean user) { if (!codeWithStars.contains("*") && !codeWithStars.contains("$")) { return ENGLISH.nameGetter() - .getNameFromBCP47BoolAlt(codeWithStars, true, CLDRFile.SHORT_ALTS); + .getNameFromIdentifierOptAlt( + codeWithStars, NameGetter.NameOpt.COMPOUND_ONLY, CLDRFile.SHORT_ALTS); } String[] parts = codeWithStars.split("_"); if (parts[0].equals("*")) { @@ -100,8 +102,10 @@ private String getName(String codeWithStars, boolean user) { } String result = ENGLISH.nameGetter() - .getNameFromBCP47BoolAlt( - String.join("_", parts), true, CLDRFile.SHORT_ALTS); + .getNameFromIdentifierOptAlt( + String.join("_", parts), + NameGetter.NameOpt.COMPOUND_ONLY, + CLDRFile.SHORT_ALTS); if (user) { result = result.replace("Xxxx", "any-script") diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartPersonName.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartPersonName.java index 8c665759606..db6d825c60a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartPersonName.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartPersonName.java @@ -34,7 +34,7 @@ public String getDirectory() { @Override public String getTitle() { - return ENGLISH.nameGetter().getNameFromBCP47(locale) + ": Person Names"; + return ENGLISH.nameGetter().getNameFromIdentifier(locale) + ": Person Names"; } @Override diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSubdivisionNames.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSubdivisionNames.java index f4baa19e5b4..f73bfa0f46a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSubdivisionNames.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSubdivisionNames.java @@ -102,7 +102,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { if (locale.startsWith("en")) { int debug = 0; } - String name = ENGLISH.nameGetter().getNameFromBCP47Bool(locale, true); + String name = ENGLISH.nameGetter().getNameFromIndentifierCompoundOnly(locale); int baseEnd = locale.indexOf('_'); ULocale loc = new ULocale(baseEnd < 0 ? locale : locale.substring(0, baseEnd)); LanguageGroup group = LanguageGroup.get(loc); @@ -113,7 +113,7 @@ public void writeSubcharts(Anchors anchors) throws IOException { for (Entry>> groupPairs : groupToNameAndCodeSorted.keyValuesSet()) { LanguageGroup group = groupPairs.getKey(); - String ename = ENGLISH.nameGetter().getNameFromBCP47Bool("en", true); + String ename = ENGLISH.nameGetter().getNameFromIndentifierCompoundOnly("en"); nameToCode.clear(); nameToCode.put(ename, "en"); // always have english first diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java index 6a12e82218a..6fdfc9e92bf 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ChartSupplemental.java @@ -34,7 +34,7 @@ public String getDirectory() { @Override public String getTitle() { - return ENGLISH.nameGetter().getNameFromBCP47(locale) + ": Overall Errors"; + return ENGLISH.nameGetter().getNameFromIdentifier(locale) + ": Overall Errors"; } @Override diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEnglishCurrencyNames.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEnglishCurrencyNames.java index 8c149529ebd..62f02dd3dcd 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEnglishCurrencyNames.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckEnglishCurrencyNames.java @@ -157,7 +157,7 @@ public static void main(String[] args) { + "\t" + language + "\t" - + englishNameGetter.getNameFromBCP47(language) + + englishNameGetter.getNameFromIdentifier(language) + "\t" + symbol); // TODO add script diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckLanguageNameCoverage.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckLanguageNameCoverage.java index e53abb351bb..f1d1c137542 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckLanguageNameCoverage.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CheckLanguageNameCoverage.java @@ -41,7 +41,7 @@ public static void main(String[] args) { + "\t" + level + "\t" - + config.getEnglish().nameGetter().getNameFromBCP47(langCode)); + + config.getEnglish().nameGetter().getNameFromIdentifier(langCode)); } for (String langCode : map.keySet()) { String path = NameType.LANGUAGE.getKeyPath(langCode); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareSuppress.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareSuppress.java index d1af049b1ca..1f4dbc7d569 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareSuppress.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CompareSuppress.java @@ -108,7 +108,7 @@ public static void main(String[] args) { } public static String langAndName(CLDRFile english, String base) { - return base + "\t" + english.nameGetter().getNameFromBCP47(base); + return base + "\t" + english.nameGetter().getNameFromIdentifier(base); } public static String scriptAndName(CLDRFile english, String suppressScript) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java index da438ad2a86..bfcd04cef12 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ConvertLanguageData.java @@ -262,7 +262,7 @@ public static void main(String[] args) throws IOException, ParseException { public static String getLanguageCodeAndName(String code) { if (code == null) return null; - return englishNameGetter.getNameFromBCP47(code) + " [" + code + "]"; + return englishNameGetter.getNameFromIdentifier(code) + " [" + code + "]"; } private static String getReplacement(String oldDefault, Set defaultLocaleContent) { @@ -384,7 +384,8 @@ private static void writeNewBasicData2(PrintWriter out, Set sortedInput "changing ", languageSubtag + "\t" - + englishNameGetter.getNameFromBCP47(languageSubtag), + + englishNameGetter.getNameFromIdentifier( + languageSubtag), problem)); } } @@ -991,7 +992,8 @@ public String getLanguageCode() { public String getLanguageName() { String cldrResult = - getExcelQuote(englishNameGetter.getNameFromBCP47Bool(languageCode, true)); + getExcelQuote( + englishNameGetter.getNameFromIndentifierCompoundOnly(languageCode)); // String result = getLanguageName2(); // if (!result.equalsIgnoreCase(cldrResult)) { // if (null == oldToFixed.put(result, cldrResult)) { @@ -2559,7 +2561,7 @@ private static String fixCountryCode(String countryCode, List row) { } private static String getULocaleLocaleName(String languageCode) { - return englishNameGetter.getNameFromBCP47Bool(languageCode, true); + return englishNameGetter.getNameFromIndentifierCompoundOnly(languageCode); // return new ULocale(languageCode).getDisplayName(); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java index 1e089f50989..1b416490f17 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CountItems.java @@ -1105,7 +1105,7 @@ public static void showZoneInfo() throws IOException { System.out.println( locale + "\t" - + nameGetter.getNameFromBCP47(locale) + + nameGetter.getNameFromIdentifier(locale) + "\t" + onlyLocales.get(locale)); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DeriveScripts.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DeriveScripts.java index b7255bde183..01481996e23 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DeriveScripts.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DeriveScripts.java @@ -206,7 +206,7 @@ public static void main(String[] args) { + "\t" + lang + "\t" - + english.nameGetter().getNameFromBCP47(lang) + + english.nameGetter().getNameFromIdentifier(lang) + "\t" + scripts + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java index 1b447671161..4fcd0227a2d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/DiffWithParent.java @@ -36,7 +36,7 @@ public static void main(String[] args) throws IOException { for (String locale : cldrFactory.getAvailable()) { if (fileMatcher.reset(locale).matches()) { System.out.println( - locale + "\t" + english.nameGetter().getNameFromBCP47(locale)); + locale + "\t" + english.nameGetter().getNameFromIdentifier(locale)); CLDRFile file = cldrFactory.make(locale, false); String parentLocale = LocaleIDParser.getParent(locale); CLDRFile parent = cldrFactory.make(parentLocale, true); // use @@ -78,7 +78,7 @@ public static void main(String[] args) throws IOException { String title = locale + " " - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + " Diff with Parent"; out.println( "" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ExtractMessages.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ExtractMessages.java index f692d3ce8e3..752a96f9de0 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ExtractMessages.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ExtractMessages.java @@ -92,7 +92,7 @@ public static void main(String[] args) throws IOException { "Skipping, no CLDR locale file: " + name + "\t" - + english.nameGetter().getNameFromBCP47(name) + + english.nameGetter().getNameFromIdentifier(name) + "\t" + e1.getClass().getName() + "\t" @@ -163,7 +163,7 @@ public static void main(String[] args) throws IOException { "\tSkipping, no CLDR locale file: " + name + "\t" - + englishNameGetter.getNameFromBCP47(name)); + + englishNameGetter.getNameFromIdentifier(name)); } double deltaTime = System.currentTimeMillis() - startTime; System.out.println("Elapsed: " + deltaTime / 1000.0 + " seconds"); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPluralDifferences.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPluralDifferences.java index 1b19d1d6437..963b288a38d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPluralDifferences.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FindPluralDifferences.java @@ -137,7 +137,7 @@ public static void diff() { + ToolConfig.getToolInstance() .getEnglish() .nameGetter() - .getNameFromBCP47(locale) + .getNameFromIdentifier(locale) + "\t" + locale + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FixTransformNames.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FixTransformNames.java index 7ebb5e4af96..9d415713030 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FixTransformNames.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/FixTransformNames.java @@ -42,7 +42,7 @@ public static void main(String[] args) { private void run(String[] args) { CLDRFile file = testInfo.getEnglish(); for (String lang : StandardCodes.make().getAvailableCodes(CodeType.language)) { - String name = file.nameGetter().getNameFromBCP47(lang); + String name = file.nameGetter().getNameFromIdentifier(lang); if (!name.equals(lang)) { fieldToCode.put(name, lang); languageCodes.add(lang); @@ -252,7 +252,7 @@ private String getName(String target) { } return result; } - return english.nameGetter().getNameFromBCP47(target.replace('-', '_')); + return english.nameGetter().getNameFromIdentifier(target.replace('-', '_')); } private String add(String result, NameType type, String code) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java index 57c8432061d..ee549e29290 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateChangeChart.java @@ -107,7 +107,7 @@ public static void main(String[] args) throws IOException { final String summaryLine = locale + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(locale) + + ENGLISH.nameGetter().getNameFromIdentifier(locale) + "\t" + counter; System.out.println(summaryLine); @@ -230,7 +230,7 @@ void add( String newValue, String engValue, int votes) { - final String name = ENGLISH.nameGetter().getNameFromBCP47(locale.toString()); + final String name = ENGLISH.nameGetter().getNameFromIdentifier(locale.toString()); PageId pageId = pathHeader.getPageId(); String header = pathHeader.getHeader(); String code = pathHeader.getCode(); @@ -301,7 +301,7 @@ void add( String newValue, String engValue, int votes) { - final String name = ENGLISH.nameGetter().getNameFromBCP47(locale.toString()); + final String name = ENGLISH.nameGetter().getNameFromIdentifier(locale.toString()); PageId pageId = pathHeader.getPageId(); String header = pathHeader.getHeader(); String code = pathHeader.getCode(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java index 14a8385d0b4..ef14f1e7f7c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateComparison.java @@ -106,7 +106,7 @@ public static void main(String[] args) throws IOException { unifiedList.addAll(newList); Set<R2<String, String>> pairs = new TreeSet<>(); for (String code : unifiedList) { - pairs.add(Row.of(english.nameGetter().getNameFromBCP47(code), code)); + pairs.add(Row.of(english.nameGetter().getNameFromIdentifier(code), code)); } prettyPathMaker = new PrettyPath(); @@ -205,7 +205,7 @@ public static void main(String[] args) throws IOException { // href='likely_subtags.html#und_{0}'>{0}</a>", // "class='source'", true) - final String localeDisplayName = english.nameGetter().getNameFromBCP47(locale); + final String localeDisplayName = english.nameGetter().getNameFromIdentifier(locale); TablePrinter table = new TablePrinter() .setCaption("Changes in " + localeDisplayName + " (" + locale + ")") diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java index 3babf6d51f6..f6be968132a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateCoverageLevels.java @@ -343,7 +343,7 @@ private static void summarizeCoverage( localesFound.clear(); for (String locale : rbnfFactory.getAvailable()) { if (localeFilter.skipLocale(locale, null)) continue; - System.out.println(locale + "\t" + englishNameGetter.getNameFromBCP47(locale)); + System.out.println(locale + "\t" + englishNameGetter.getNameFromIdentifier(locale)); getRBNFData(locale, rbnfFactory.make(locale, true), ordinals, spellout, localesFound); } markData( @@ -381,7 +381,7 @@ private static void summarizeCoverage( localesFound.clear(); for (String locale : collationFactory.getAvailable()) { if (localeFilter.skipLocale(locale, null)) continue; - System.out.println(locale + "\t" + englishNameGetter.getNameFromBCP47(locale)); + System.out.println(locale + "\t" + englishNameGetter.getNameFromIdentifier(locale)); getCollationData(locale, collationFactory.make(locale, true), localesFound); } markData( @@ -395,7 +395,7 @@ private static void summarizeCoverage( System.out.println("gathering main data"); for (String locale : mainAvailable) { - System.out.println(locale + "\t" + englishNameGetter.getNameFromBCP47(locale)); + System.out.println(locale + "\t" + englishNameGetter.getNameFromIdentifier(locale)); LevelData levelData = mapLevelData.get(locale); getMainData(locale, levelData, cldrFactory.make(locale, true)); } @@ -433,7 +433,7 @@ private static void summarizeCoverage( } // Now print the information samples2.println(); - samples2.println(locale + "\t" + englishNameGetter.getNameFromBCP47(locale)); + samples2.println(locale + "\t" + englishNameGetter.getNameFromIdentifier(locale)); double weightedFound = 0; double weightedMissing = 0; long missingCountTotal = 0; @@ -500,7 +500,7 @@ private static void summarizeCoverage( summary.println( locale + "\t" - + englishNameGetter.getNameFromBCP47(locale) + + englishNameGetter.getNameFromIdentifier(locale) + "\t" + summaryLine2); if (header != null) { @@ -564,7 +564,7 @@ private static void markData( System.out.println( locale + "\t" - + englishNameGetter.getNameFromBCP47(locale) + + englishNameGetter.getNameFromIdentifier(locale) + "\t" + "missing " + title); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriodChart.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriodChart.java index d44e002f5d5..15316ec9136 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriodChart.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDayPeriodChart.java @@ -108,7 +108,7 @@ public static void main(String[] args) { + "\t" + locale + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(locale)); + + ENGLISH.nameGetter().getNameFromIdentifier(locale)); DayPeriodInfo dayPeriod = getFixedDayPeriodInfo(type, locale); doRow(dayPeriod); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java index a77d697897c..e9343f996e1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateDerivedAnnotations.java @@ -219,7 +219,7 @@ public static void main(String[] args) throws IOException { + "\t" + level + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + failures.size() + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java index de66c241f79..25bbca99bd8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateEnums.java @@ -674,7 +674,7 @@ private void showRegionCodeInfo() throws IOException { format(popData.getPopulation()), format(popData.getLiteratePopulation() / popData.getPopulation()), (count == 0 ? ";" : ""), - englishNameGetter.getNameFromBCP47(language)); + englishNameGetter.getNameFromIdentifier(language)); } } Log.close(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java index dfc8db01052..1adbaa4a0d2 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateG2xG2.java @@ -220,7 +220,7 @@ private static boolean showLocales(int choice) throws Exception { if (territory.charAt(0) < 'A') continue; String locale = "haw-" + territory; System.out.print( - locale + ": " + english.nameGetter().getNameFromBCP47(locale) + ", "); + locale + ": " + english.nameGetter().getNameFromIdentifier(locale) + ", "); } if (true) return true; } @@ -339,9 +339,9 @@ static void checkItems( + "\t" + sourceLocale + "\t(" - + english.nameGetter().getNameFromBCP47(sourceLocale) + + english.nameGetter().getNameFromIdentifier(sourceLocale) + ": " - + sourceData.nameGetter().getNameFromBCP47(sourceLocale) + + sourceData.nameGetter().getNameFromIdentifier(sourceLocale) + ")" + "\t" + priorityMap.get(item) @@ -389,7 +389,7 @@ private static String getTypeName(String item) { private static String getItemName(CLDRFile data, NameType type, String item) { String result; if (type == NameType.LANGUAGE) { - result = data.nameGetter().getNameFromBCP47(item); + result = data.nameGetter().getNameFromIdentifier(item); } else if (type != NameType.TZ_EXEMPLAR) { result = data.nameGetter().getNameFromTypeEnumCode(type, item); } else { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateKaraList.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateKaraList.java index 0534bb72db0..36b4d610c7f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateKaraList.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateKaraList.java @@ -132,7 +132,7 @@ private static void printCodes( + locale + "</tlanguage>\t<!-- " + TransliteratorUtilities.toXML.transliterate( - english.nameGetter().getNameFromBCP47(locale)) + english.nameGetter().getNameFromIdentifier(locale)) + " -->"); // We do use // non-ISO // values but diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLanguageData.java index 47783f9abe4..5e4c5e8d79b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLanguageData.java @@ -71,7 +71,7 @@ public static void main(String[] args) throws IOException { xpp.setAttribute(-1, LDMLConstants.TYPE, languageCode); String xpath = xpp.toString(); - newEn.add(xpp.toString(), oldEn.nameGetter().getNameFromBCP47(languageCode)); + newEn.add(xpp.toString(), oldEn.nameGetter().getNameFromIdentifier(languageCode)); String oldValue = oldEn.getStringValue(xpath); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLikelySubtags.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLikelySubtags.java index 3473bdbc281..d23e1cdc440 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLikelySubtags.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLikelySubtags.java @@ -667,7 +667,7 @@ private String replaceMissing(String field, String ifEqual, String replacement) public static String getNameSafe(String oldValue) { try { if (oldValue != null) { - String result = english.nameGetter().getNameFromBCP47(oldValue); + String result = english.nameGetter().getNameFromIdentifier(oldValue); if (result.startsWith("Unknown language ")) { result = result.substring("Unknown language ".length()); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLocaleIDTestData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLocaleIDTestData.java index 8c44fc4e501..e7ae7d38820 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLocaleIDTestData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateLocaleIDTestData.java @@ -25,6 +25,7 @@ import org.unicode.cldr.util.Level; import org.unicode.cldr.util.LsrvCanonicalizer; import org.unicode.cldr.util.LsrvCanonicalizer.TestDataTypes; +import org.unicode.cldr.util.NameGetter; import org.unicode.cldr.util.StandardCodes.LstrType; import org.unicode.cldr.util.SupplementalDataInfo; import org.unicode.cldr.util.TempPrintWriter; @@ -116,15 +117,16 @@ public static void main(String[] args) throws IOException { + "@locale=en\n" + "@languageDisplay=standard\n"); pw.println("\n# Simple cases: Language, script, region, variants\n"); - showDisplayNames(pw, ENGLISH, true, testInputLocales); + showDisplayNames(pw, ENGLISH, NameGetter.NameOpt.COMPOUND_ONLY, testInputLocales); pw.println( "\n#Note that the order of the variants is alphabetized before generating names\n"); - showDisplayNames(pw, ENGLISH, true, "en-Latn-GB-scouse-fonipa"); + showDisplayNames( + pw, ENGLISH, NameGetter.NameOpt.COMPOUND_ONLY, "en-Latn-GB-scouse-fonipa"); pw.println("\n# Add extensions, and verify their order\n"); showDisplayNames( pw, ENGLISH, - true, + NameGetter.NameOpt.COMPOUND_ONLY, "en-u-nu-thai-ca-islamic-civil", "hi-u-nu-latn-t-en-h0-hybrid", "en-u-nu-deva-t-de"); @@ -132,7 +134,7 @@ public static void main(String[] args) throws IOException { showDisplayNames( pw, ENGLISH, - true, + NameGetter.NameOpt.COMPOUND_ONLY, "fr-z-zz-zzz-v-vv-vvv-u-uu-uuu-t-ru-Cyrl-s-ss-sss-a-aa-aaa-x-u-x"); pw.println( @@ -185,7 +187,8 @@ public static void main(String[] args) throws IOException { if (upper.containsSome(value)) { System.err.println("** FIX NAME: " + sampleLocale); } else { - showDisplayNames(pw, ENGLISH, true, sampleLocale); + showDisplayNames( + pw, ENGLISH, NameGetter.NameOpt.COMPOUND_ONLY, sampleLocale); } } } @@ -196,7 +199,8 @@ public static void main(String[] args) throws IOException { Factory factory = CLDR_CONFIG.getCldrFactory(); CoverageInfo coverageInfo = CLDR_CONFIG.getCoverageInfo(); for (String locale : factory.getAvailableLanguages()) { - for (boolean onlyConstructCompound : List.of(true, false)) { + for (NameGetter.NameOpt nameOpt : + List.of(NameGetter.NameOpt.COMPOUND_ONLY, NameGetter.NameOpt.DEFAULT)) { CLDRFile cldrFile = factory.make( locale, @@ -213,10 +217,11 @@ public static void main(String[] args) throws IOException { } Map<String, String> displayNames = - prepareDisplayNames(cldrFile, onlyConstructCompound, testInputLocales); + prepareDisplayNames(cldrFile, nameOpt, testInputLocales); pw.println("\n@locale=" + locale); - String languageDisplayVal = onlyConstructCompound ? "standard" : "dialect"; + String languageDisplayVal = + nameOpt == NameGetter.NameOpt.COMPOUND_ONLY ? "standard" : "dialect"; pw.println("@languageDisplay=" + languageDisplayVal + "\n"); showDisplayNames(pw, displayNames); @@ -227,13 +232,11 @@ public static void main(String[] args) throws IOException { } private static Map<String, String> prepareDisplayNames( - CLDRFile formattingLocaleFile, boolean onlyConstructCompound, String... locales) { + CLDRFile formattingLocaleFile, NameGetter.NameOpt nameOpt, String... locales) { Map<String, String> displayNames = new TreeMap<>(); for (String locale : locales) { String name = - formattingLocaleFile - .nameGetter() - .getNameFromBCP47Bool(locale, onlyConstructCompound); + formattingLocaleFile.nameGetter().getNameFromIndentifierOpt(locale, nameOpt); if (name.contains("null")) { System.err.println("** REPLACE: " + locale + "; " + name); } else { @@ -250,10 +253,9 @@ private static Map<String, String> prepareDisplayNames( private static void showDisplayNames( TempPrintWriter pw, CLDRFile formattingLocaleFile, - boolean onlyConstructCompound, + NameGetter.NameOpt nameOpt, String... locales) { - showDisplayNames( - pw, prepareDisplayNames(formattingLocaleFile, onlyConstructCompound, locales)); + showDisplayNames(pw, prepareDisplayNames(formattingLocaleFile, nameOpt, locales)); } private static void showDisplayNames(TempPrintWriter pw, Map<String, String> displayNames) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GeneratePluralRanges.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GeneratePluralRanges.java index 129fd2c22b0..3f56f0b90b5 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GeneratePluralRanges.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GeneratePluralRanges.java @@ -99,7 +99,7 @@ private void generateSamples(CLDRFile english, Factory factory) { System.out.println( locale + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + rangeSample.start + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSeedDurations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSeedDurations.java index 90b69b00014..b6a7c955d3b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSeedDurations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSeedDurations.java @@ -44,7 +44,9 @@ public static void main(String[] args) { for (String locale : cldrFactory.getAvailableLanguages()) { CLDRFile cldrFile = cldrFactory.make(locale, true); String localeString = - locale + "\t" + testInfo.getEnglish().nameGetter().getNameFromBCP47(locale); + locale + + "\t" + + testInfo.getEnglish().nameGetter().getNameFromIdentifier(locale); System.out.println("\n" + localeString); DateTimeFormats formats = new DateTimeFormats().set(cldrFile, "gregorian"); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java index 34f58d9140b..4d2089707ac 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateSidewaysView.java @@ -612,7 +612,7 @@ private static String cleanLocale(String item, boolean name) { String core = item; item = toHTML.transform(item); if (name) { - item = english.nameGetter().getNameFromBCP47(core); + item = english.nameGetter().getNameFromIdentifier(core); item = item == null ? "<i>null</i>" : toHTML.transform(item); } if (draft) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateStatistics.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateStatistics.java index d34d392f3b7..5c339924272 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateStatistics.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GenerateStatistics.java @@ -310,7 +310,7 @@ private static void addCounts( String nativeName, englishName; draftLanguages.add(lang); nativeName = getFixedLanguageName(localeID, langScript); - englishName = english.nameGetter().getNameFromBCP47(langScript); + englishName = english.nameGetter().getNameFromIdentifier(langScript); if (!lang.equals("en") && nativeName.equals(englishName)) { Log.logln( (isDraft ? "D" : "") @@ -400,7 +400,7 @@ private static String getFixedLanguageName(String localeID, String lang) { } } CLDRFile cldr = factory.make(localeID, true); - return cldr.nameGetter().getNameFromBCP47(lang); + return cldr.nameGetter().getNameFromIdentifier(lang); } /** diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java index 79f945e03fe..8437e67e25c 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetChanges.java @@ -340,7 +340,7 @@ private void old() { + "\t" + locale + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + ph + "\t«" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetLanguageData.java index c5e38c2d05c..a5dd53545ab 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/GetLanguageData.java @@ -28,7 +28,8 @@ private void run() { System.out.println("Code\tLang\tLpop\tApprox. Gdp"); for (String language : sdata.getLanguages()) { final long pop = languageToPop.getCount(language); - System.out.print(language + "\t" + english.nameGetter().getNameFromBCP47(language)); + System.out.print( + language + "\t" + english.nameGetter().getNameFromIdentifier(language)); if (pop > 0) { Pair<OfficialStatus, String> status = isOfficialLanguageOfEUCountry(language); System.out.print( diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/LSRSource.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/LSRSource.java index 71b42335efc..91764bcb574 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/LSRSource.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/LSRSource.java @@ -88,9 +88,9 @@ public String line(String source) { + (getSources().isEmpty() ? "" : "\" origin=\"" + getSourceString()) + "\"/>" + "\t<!-- " - + english.nameGetter().getNameFromBCP47(source) + + english.nameGetter().getNameFromIdentifier(source) + " ➡︎ " - + english.nameGetter().getNameFromBCP47(target) + + english.nameGetter().getNameFromIdentifier(target) + " -->"; return result; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarData.java index 8e70f94822f..2c90aea270a 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarData.java @@ -124,7 +124,7 @@ public static void main(String[] args) { continue; } // System.out.println(locale); - final String names = locale + "\t" + ENGLISH.nameGetter().getNameFromBCP47(locale); + final String names = locale + "\t" + ENGLISH.nameGetter().getNameFromIdentifier(locale); for (Entry<PathHeader, String> entry : pathHeaderToValue.entrySet()) { final PathHeader ph = entry.getKey(); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarInfo.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarInfo.java index 3c79d093cc1..59b6c71915b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarInfo.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ListGrammarInfo.java @@ -71,7 +71,7 @@ public static void main(String[] args) { private static String format( String locale, Collection<String> genders, Collection<String> rawCases) { - return english.nameGetter().getNameFromBCP47(locale) + return english.nameGetter().getNameFromIdentifier(locale) + " (" + locale + "/" @@ -82,7 +82,7 @@ private static String format( } public static String format(String locale, Collection<String> genders) { - return english.nameGetter().getNameFromBCP47(locale) + return english.nameGetter().getNameFromIdentifier(locale) + " (" + locale + "/" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java index 798d997f2fe..b087b8d0417 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/Misc.java @@ -357,7 +357,7 @@ private static void printAllZoneLocalizations() throws IOException { // do the header for (Iterator<String> it2 = priorities.iterator(); it2.hasNext(); ) { String locale = it2.next(); - String englishLocaleName = english.nameGetter().getNameFromBCP47(locale); + String englishLocaleName = english.nameGetter().getNameFromIdentifier(locale); out.println("<th>" + locale + " (" + englishLocaleName + ")" + "</th>"); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ScriptPopulations.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ScriptPopulations.java index e63d6b8f587..e8b663e2a67 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ScriptPopulations.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ScriptPopulations.java @@ -64,7 +64,7 @@ public static void main(String[] args) { + "\t" + langScriptLitPop.getCount(lang) + "\t" - + english.nameGetter().getNameFromBCP47(baseLanguage) + + english.nameGetter().getNameFromIdentifier(baseLanguage) + "\t" + english.nameGetter().getNameFromTypeEnumCode(NameType.SCRIPT, script) + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java index e23dcf16d99..483ac610e93 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowChildren.java @@ -42,7 +42,7 @@ public static void main(String[] args) { for (Entry<String, Set<String>> entry : parent2children.keyValuesSet()) { Map<String, Relation<String, String>> path2value2locales = new TreeMap<>(); String parent = entry.getKey(); - String parentName = english.nameGetter().getNameFromBCP47(parent); + String parentName = english.nameGetter().getNameFromIdentifier(parent); CLDRFile parentFile = cldrFactory.make(parent, true); Set<String> children = entry.getValue(); @@ -99,7 +99,7 @@ public static void main(String[] args) { deviations.add(parent, path2value2locales.size()); } for (String locale : deviations.getKeysetSortedByKey()) { - String parentName = english.nameGetter().getNameFromBCP47(locale); + String parentName = english.nameGetter().getNameFromIdentifier(locale); System.out.println(parentName + "\t" + locale + "\t" + deviations.get(locale)); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java index 7bb39298795..58ef130dfd1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowData.java @@ -40,6 +40,7 @@ import org.unicode.cldr.util.LanguageTagParser; import org.unicode.cldr.util.Level; import org.unicode.cldr.util.LocaleIDParser; +import org.unicode.cldr.util.NameGetter; import org.unicode.cldr.util.NameType; import org.unicode.cldr.util.PathHeader; import org.unicode.cldr.util.PathHeader.SectionId; @@ -518,13 +519,13 @@ private static void getScripts() throws IOException { System.out.println(locale); CLDRFile file = cldrFactory.make(locale, false); if (file.isNonInheriting()) continue; - String localeName = file.nameGetter().getNameFromBCP47(locale); + String localeName = file.nameGetter().getNameFromIdentifier(locale); getScripts(localeName, scripts); if (!scripts.contains("Latn")) { out.println( locale + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + localeName); } @@ -756,7 +757,9 @@ public static String getLinkedLocaleName(String locale) { } public static String getEnglishLocaleName(String locale) { - return english.nameGetter().getNameFromBCP47BoolAlt(locale, true, CLDRFile.SHORT_ALTS); + return english.nameGetter() + .getNameFromIdentifierOptAlt( + locale, NameGetter.NameOpt.COMPOUND_ONLY, CLDRFile.SHORT_ALTS); } private static String getLocaleNameAndCode(String locale) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguageData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguageData.java index 251e75b723a..c557de8353d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguageData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguageData.java @@ -51,7 +51,7 @@ public static void main(String[] args) { System.out.println( language + "\t" - + english.nameGetter().getNameFromBCP47(language) + + english.nameGetter().getNameFromIdentifier(language) + "\t" + territory + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java index 5acc4fe25e8..fb765086efe 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLanguages.java @@ -1372,8 +1372,8 @@ private String getLanguagePluralMessage(String msg, String languageCode) { private String getLanguageName(String languageCode) { String result = - englishNameGetter.getNameFromBCP47BoolAlt( - languageCode, true, CLDRFile.SHORT_ALTS); + englishNameGetter.getNameFromIdentifierOptAlt( + languageCode, NameGetter.NameOpt.COMPOUND_ONLY, CLDRFile.SHORT_ALTS); if (!result.equals(languageCode)) return result; Set<String> names = Iso639Data.getNames(languageCode); if (names != null && names.size() != 0) { @@ -1561,8 +1561,10 @@ public void showTabbedOrgLevels( final String name = locale.equals("*") ? "ALL" - : englishNameGetter.getNameFromBCP47BoolAlt( - locale, true, CLDRFile.SHORT_ALTS); + : englishNameGetter.getNameFromIdentifierOptAlt( + locale, + NameGetter.NameOpt.COMPOUND_ONLY, + CLDRFile.SHORT_ALTS); coverageGoalsTsv.println( String.format( "%s\t;\t%s\t;\t%s\t;\t%s", organization, locale, level, name)); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLocaleCoverage.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLocaleCoverage.java index 9478256932a..640b76950d3 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLocaleCoverage.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowLocaleCoverage.java @@ -51,6 +51,7 @@ import org.unicode.cldr.util.LanguageTagParser; import org.unicode.cldr.util.Level; import org.unicode.cldr.util.LocaleNames; +import org.unicode.cldr.util.NameGetter; import org.unicode.cldr.util.NameType; import org.unicode.cldr.util.Organization; import org.unicode.cldr.util.PathHeader; @@ -892,9 +893,11 @@ private static void showCoverage( .addCell(language) .addCell( ENGLISH.nameGetter() - .getNameFromBCP47BoolAlt( - language, true, CLDRFile.SHORT_ALTS)) - .addCell(file.nameGetter().getNameFromBCP47(language)) + .getNameFromIdentifierOptAlt( + language, + NameGetter.NameOpt.COMPOUND_ONLY, + CLDRFile.SHORT_ALTS)) + .addCell(file.nameGetter().getNameFromIdentifier(language)) .addCell(script) .addCell(defRegion) .addCell(sublocales.size()) @@ -920,7 +923,7 @@ private static void showCoverage( + " ;\t" + visibleLevelComputed + " ;\t" - + ENGLISH.nameGetter().getNameFromBCP47(locale)); + + ENGLISH.nameGetter().getNameFromIdentifier(locale)); // TODO decide whether to restore this // Level higher = Level.UNDETERMINED; // switch (computed) { @@ -1179,7 +1182,7 @@ private static String spreadsheetLine( specialFlag + language + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(language) + + ENGLISH.nameGetter().getNameFromIdentifier(language) + "\t" + ENGLISH.nameGetter().getNameFromTypeEnumCode(NameType.SCRIPT, script) + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPlurals.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPlurals.java index 46d293fe00c..4f9f97313de 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPlurals.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowPlurals.java @@ -168,7 +168,7 @@ public void printPluralTable( if (localeFilter != null && !localeFilter.equals(locale) || locale.equals("root")) { continue; } - final String name = english.nameGetter().getNameFromBCP47(locale); + final String name = english.nameGetter().getNameFromIdentifier(locale); String canonicalLocale = canonicalizer.transform(locale); if (!locale.equals(canonicalLocale)) { String redirect = diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java index 9cca8f42cc4..a58e0844aaa 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowRegionalVariants.java @@ -27,6 +27,7 @@ import org.unicode.cldr.util.Counter; import org.unicode.cldr.util.Factory; import org.unicode.cldr.util.LanguageTagParser; +import org.unicode.cldr.util.NameGetter; import org.unicode.cldr.util.PathHeader; import org.unicode.cldr.util.PathHeader.SectionId; import org.unicode.cldr.util.StandardCodes; @@ -200,7 +201,7 @@ public static void main(String[] args) throws IOException { grandSummary.println( parent + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(parent.toString()) + + ENGLISH.nameGetter().getNameFromIdentifier(parent.toString()) + "\t" + totalChildDiffs + "\t" @@ -213,13 +214,13 @@ public static void main(String[] args) throws IOException { summary.println( parent + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(parent.toString()) + + ENGLISH.nameGetter().getNameFromIdentifier(parent.toString()) + "\t" + childDiffValue + "\t" + s + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(s.toString())); + + ENGLISH.nameGetter().getNameFromIdentifier(s.toString())); } ArrayList<CLDRFile> parentChain = new ArrayList<>(); @@ -325,7 +326,8 @@ private static String nameForLocale(CLDRLocale key) { country = "(" + ltp.getRegion() + ")"; } return ENGLISH.nameGetter() - .getNameFromBCP47BoolAlt(key.toString(), false, CLDRFile.SHORT_ALTS) + .getNameFromIdentifierOptAlt( + key.toString(), NameGetter.NameOpt.DEFAULT, CLDRFile.SHORT_ALTS) + "\t" + key + "\t" diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java index 375e0478d41..b248e771f14 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ShowStarredCoverage.java @@ -581,14 +581,14 @@ private void getLanguageTags() { } public String getName(final String written) { - String result = CldrConfig.getEnglish().nameGetter().getNameFromBCP47(written); + String result = CldrConfig.getEnglish().nameGetter().getNameFromIdentifier(written); if (result.equals(written)) { R2<List<String>, String> alias = languageFix.get(written); if (alias != null) { result = CldrConfig.getEnglish() .nameGetter() - .getNameFromBCP47(alias.get0().get(0)); + .getNameFromIdentifier(alias.get0().get(0)); } } return result; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java index 13cb5943cc3..e445cb1cca2 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/VettingAdder.java @@ -292,7 +292,7 @@ public void showFiles(Factory cldrFactory, String targetDir) throws IOException Log.logln( locale + " \t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\texample: " + fullPath); break; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/WritePluralRulesSpreadsheets.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/WritePluralRulesSpreadsheets.java index e3b3523fe20..79e11e2d6ca 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/WritePluralRulesSpreadsheets.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/WritePluralRulesSpreadsheets.java @@ -253,7 +253,7 @@ private static void writeRanges( private static String getName(String missing) { return missing + "\t" - + CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromBCP47(missing); + + CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromIdentifier(missing); } private static String getSamplePattern(PluralMinimalPairs samplePatterns, String start) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRLocale.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRLocale.java index 85c09d102ab..8e2d968fa61 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRLocale.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRLocale.java @@ -31,7 +31,7 @@ public interface NameFormatter { String getDisplayName( CLDRLocale cldrLocale, - boolean onlyConstructCompound, + NameGetter.NameOpt nameOpt, Transform<String, String> altPicker); String getDisplayLanguage(CLDRLocale cldrLocale); @@ -113,7 +113,7 @@ public String getDisplayLanguage(CLDRLocale cldrLocale) { @Override public String getDisplayName( CLDRLocale cldrLocale, - boolean onlyConstructCompound, + NameGetter.NameOpt nameOpt, Transform<String, String> altPicker) { return getDisplayName(cldrLocale); } @@ -161,21 +161,22 @@ public String getDisplayVariant(CLDRLocale cldrLocale) { public String getDisplayName(CLDRLocale cldrLocale) { if (file != null) return file.nameGetter() - .getNameFromBCP47BoolAlt(cldrLocale.toDisplayLanguageTag(), true, null); + .getNameFromIdentifierOptAlt( + cldrLocale.toDisplayLanguageTag(), + NameGetter.NameOpt.COMPOUND_ONLY, + null); return super.getDisplayName(cldrLocale); } @Override public String getDisplayName( CLDRLocale cldrLocale, - boolean onlyConstructCompound, + NameGetter.NameOpt nameOpt, Transform<String, String> altPicker) { if (file != null) return file.nameGetter() - .getNameFromBCP47BoolAlt( - cldrLocale.toDisplayLanguageTag(), - onlyConstructCompound, - altPicker); + .getNameFromIdentifierOptAlt( + cldrLocale.toDisplayLanguageTag(), nameOpt, altPicker); return super.getDisplayName(cldrLocale); } @@ -557,8 +558,8 @@ public String getDisplayVariant() { return getDisplayVariant(getDefaultFormatter()); } - public String getDisplayName(boolean combined, Transform<String, String> picker) { - return getDisplayName(getDefaultFormatter(), combined, picker); + public String getDisplayName(NameGetter.NameOpt nameOpt, Transform<String, String> picker) { + return getDisplayName(getDefaultFormatter(), nameOpt, picker); } /** @@ -659,8 +660,8 @@ public interface SublocaleProvider { } public String getDisplayName( - NameFormatter engFormat, boolean combined, Transform<String, String> picker) { - return engFormat.getDisplayName(this, combined, picker); + NameFormatter engFormat, NameGetter.NameOpt nameOpt, Transform<String, String> picker) { + return engFormat.getDisplayName(this, nameOpt, picker); } /** diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRTransforms.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRTransforms.java index 2e560d82545..c41e451bdf1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRTransforms.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRTransforms.java @@ -604,7 +604,7 @@ private String getDisplaySourceOrTarget(String sourceOrTarget) { CLDRConfig.getInstance() .getEnglish() .nameGetter() - .getNameFromBCP47(sourceOrTarget); + .getNameFromIdentifier(sourceOrTarget); return name; } catch (Exception e) { return sourceOrTarget; diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java index 24faaa268e2..cc28adbe847 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DateTimeFormats.java @@ -1100,7 +1100,9 @@ public static void main(String[] args) throws IOException { System.out.println("Skipping default content: " + localeID); continue; } - sorted.put(englishFile.nameGetter().getNameFromBCP47Bool(localeID, true), localeID); + sorted.put( + englishFile.nameGetter().getNameFromIndentifierCompoundOnly(localeID), + localeID); } writeCss(DIR); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodsCheck.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodsCheck.java index 8dde478596a..2f036264f6d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodsCheck.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DayPeriodsCheck.java @@ -33,7 +33,7 @@ public static void main(String[] args) { case "groups": StandardCodes sc = StandardCodes.make(); CLDRFile english = CLDRConfig.getInstance().getEnglish(); - english.nameGetter().getNameFromBCP47(LanguageGroup.uralic.iso); + english.nameGetter().getNameFromIdentifier(LanguageGroup.uralic.iso); for (LanguageGroup group : LanguageGroup.values()) { System.out.println( @@ -41,7 +41,7 @@ public static void main(String[] args) { + "\t" + group.iso + "\t" - + english.nameGetter().getNameFromBCP47(group.iso)); + + english.nameGetter().getNameFromIdentifier(group.iso)); } for (LanguageGroup group : LanguageGroup.values()) { diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/GlossonymConstructor.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/GlossonymConstructor.java index bd1fa07dfb6..4a57f7f90b8 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/GlossonymConstructor.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/GlossonymConstructor.java @@ -116,7 +116,9 @@ private synchronized String reallyGetValue(String xpath) { final CLDRFile.SimpleAltPicker altPicker = (alt == null) ? null : new CLDRFile.SimpleAltPicker(alt); final String value = - cldrFile.nameGetter().getNameFromBCP47BoolAlt(type, true, altPicker); + cldrFile.nameGetter() + .getNameFromIdentifierOptAlt( + type, NameGetter.NameOpt.COMPOUND_ONLY, altPicker); if (!valueIsBogus(value)) { return value; } @@ -133,7 +135,8 @@ public Set<String> getPathsWhereFound(String xpath, Set<String> paths) { (alt == null) ? null : new CLDRFile.SimpleAltPicker(alt); final String value = cldrFile.nameGetter() - .getNameFromBCP47BoolAltPaths(type, true, altPicker, paths); + .getNameFromIdentifierOptAltPaths( + type, NameGetter.NameOpt.COMPOUND_ONLY, altPicker, paths); if (!valueIsBogus(value)) { return paths; } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/LanguageGroup.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/LanguageGroup.java index 5aef90d3b0c..4b70d1d7af2 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/LanguageGroup.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/LanguageGroup.java @@ -304,7 +304,7 @@ public String getName(CLDRFile cldrFile) { } return prefix + cldrFile.nameGetter() - .getNameFromBCP47(ltp.getLanguage()) + .getNameFromIdentifier(ltp.getLanguage()) .replace(" [Other]", "") .replace(" languages", ""); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/NameGetter.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/NameGetter.java index 71a037295bf..73897714d2f 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/NameGetter.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/NameGetter.java @@ -27,6 +27,11 @@ public NameGetter(CLDRFile cldrFile) { this.cldrFile = cldrFile; } + public enum NameOpt { + DEFAULT, + COMPOUND_ONLY + } + private static final String GETNAME_LOCALE_SEPARATOR_PATH = "//ldml/localeDisplayNames/localeDisplayPattern/localeSeparator"; private static final String GETNAME_LOCALE_PATTERN_PATH = @@ -54,34 +59,39 @@ public String getNameFromTypeCodeAltpicker( } /** - * Returns the name of the given bcp47 identifier. Note that extensions must be specified using - * the old "\@key=type" syntax. + * Returns the name of the given identifier. Note that extensions must be specified using the + * old "\@key=type" syntax. * - * @param localeOrTZID the bcp47 identifier (locale or timezone ID) - * @return the name of the given bcp47 identifier + * @param localeOrTZID the identifier, BCP47 or extension thereof, such as for locale or + * timezone ID + * @return the name of the given identifier */ - public synchronized String getNameFromBCP47(String localeOrTZID) { - return getNameFromBCP47Bool(localeOrTZID, false); + public synchronized String getNameFromIdentifier(String localeOrTZID) { + return getNameFromIndentifierOpt(localeOrTZID, NameOpt.DEFAULT); + } + + public String getNameFromIndentifierCompoundOnly(String localeOrTZID) { + return getNameFromIndentifierOpt(localeOrTZID, NameOpt.COMPOUND_ONLY); } /** - * Returns the name of the given bcp47 identifier. Note that extensions must be specified using - * the old "\@key=type" syntax. + * Returns the name of the given identifier. Note that extensions must be specified using the + * old "\@key=type" syntax. * - * @param localeOrTZID the bcp47 identifier (locale or timezone ID) - * @param onlyConstructCompound if true, returns "English (United Kingdom)" instead of "British + * @param localeOrTZID the identifier, BCP47 or extension thereof, such as for locale or + * timezone ID + * @param nameOpt if COMPOUND_ONLY, returns "English (United Kingdom)" instead of "British * English" - * @return the name of the given bcp47 identifier + * @return the name of the given identifier */ - public synchronized String getNameFromBCP47Bool( - String localeOrTZID, boolean onlyConstructCompound) { - return getNameFromBCP47BoolAlt(localeOrTZID, onlyConstructCompound, null); + public synchronized String getNameFromIndentifierOpt(String localeOrTZID, NameOpt nameOpt) { + return getNameFromIdentifierOptAlt(localeOrTZID, nameOpt, null); } - public String getNameFromParserBool(LanguageTagParser lparser, boolean onlyConstructCompound) { + public String getNameFromParserOpt(LanguageTagParser lparser, NameOpt nameOpt) { return getNameFromOtherThings( lparser, - onlyConstructCompound, + nameOpt, null, cldrFile.getWinningValueWithBailey(GETNAME_LOCALE_KEY_TYPE_PATTERN_PATH), cldrFile.getWinningValueWithBailey(GETNAME_LOCALE_PATTERN_PATH), @@ -89,15 +99,15 @@ public String getNameFromParserBool(LanguageTagParser lparser, boolean onlyConst null); } - public synchronized String getNameFromBCP47Etc( + public synchronized String getNameFromIdentifierEtc( String localeOrTZID, - boolean onlyConstructCompound, + NameOpt nameOpt, String localeKeyTypePattern, String localePattern, String localeSeparator) { return getNameFromManyThings( localeOrTZID, - onlyConstructCompound, + nameOpt, localeKeyTypePattern, localePattern, localeSeparator, @@ -106,42 +116,42 @@ public synchronized String getNameFromBCP47Etc( } /** - * Returns the name of the given bcp47 identifier. Note that extensions must be specified using - * the old "\@key=type" syntax. + * Returns the name of the given identifier. Note that extensions must be specified using the + * old "\@key=type" syntax. * - * @param localeOrTZID the bcp47 identifier (locale or timezone ID) - * @param onlyConstructCompound if true, returns "English (United Kingdom)" instead of "British + * @param localeOrTZID the identifier, BCP47 or extension thereof, such as for locale or + * timezone ID + * @param nameOpt if COMPOUND_ONLY, returns "English (United Kingdom)" instead of "British * English" * @param altPicker Used to select particular alts. For example, SHORT_ALTS can be used to get * "English (U.K.)" instead of "English (United Kingdom)" - * @return the name of the given bcp47 identifier + * @return the name of the given identifier */ - public synchronized String getNameFromBCP47BoolAlt( - String localeOrTZID, - boolean onlyConstructCompound, - Transform<String, String> altPicker) { - return getNameFromBCP47BoolAltPaths(localeOrTZID, onlyConstructCompound, altPicker, null); + public synchronized String getNameFromIdentifierOptAlt( + String localeOrTZID, NameOpt nameOpt, Transform<String, String> altPicker) { + return getNameFromIdentifierOptAltPaths(localeOrTZID, nameOpt, altPicker, null); } /** - * Returns the name of the given bcp47 identifier. Note that extensions must be specified using - * the old "\@key=type" syntax. + * Returns the name of the given identifier. Note that extensions must be specified using the + * old "\@key=type" syntax. * - * @param localeOrTZID the bcp47 identifier (locale or timezone ID) - * @param onlyConstructCompound if true, returns "English (United Kingdom)" instead of "British + * @param localeOrTZID the identifier, BCP47 or extension thereof, such as for locale or + * timezone ID + * @param nameOpt if COMPOUND_ONLY, returns "English (United Kingdom)" instead of "British * English" * @param altPicker Used to select particular alts. For example, SHORT_ALTS can be used to get * "English (U.K.)" instead of "English (United Kingdom)" - * @return the name of the given bcp47 identifier + * @return the name of the given identifier */ - public synchronized String getNameFromBCP47BoolAltPaths( + public synchronized String getNameFromIdentifierOptAltPaths( String localeOrTZID, - boolean onlyConstructCompound, + NameOpt nameOpt, Transform<String, String> altPicker, Set<String> paths) { return getNameFromManyThings( localeOrTZID, - onlyConstructCompound, + nameOpt, cldrFile.getWinningValueWithBailey(GETNAME_LOCALE_KEY_TYPE_PATTERN_PATH), cldrFile.getWinningValueWithBailey(GETNAME_LOCALE_PATTERN_PATH), cldrFile.getWinningValueWithBailey(GETNAME_LOCALE_SEPARATOR_PATH), @@ -150,21 +160,22 @@ public synchronized String getNameFromBCP47BoolAltPaths( } /** - * Returns the name of the given bcp47 identifier. Note that extensions must be specified using - * the old "\@key=type" syntax. Only used by ExampleGenerator. + * Returns the name of the given identifier. Note that extensions must be specified using the + * old "\@key=type" syntax. Only used by ExampleGenerator. * - * @param localeOrTZID the bcp47 identifier (locale or timezone ID) - * @param onlyConstructCompound if true, returns "English (United Kingdom)" instead of "British + * @param localeOrTZID the identifier, BCP47 or extension thereof, such as for locale or + * timezone ID + * @param nameOpt if COMPOUND_ONLY, returns "English (United Kingdom)" instead of "British * English" * @param localeKeyTypePattern the pattern used to format key-type pairs * @param localePattern the pattern used to format primary/secondary subtags * @param localeSeparator the list separator for secondary subtags * @param paths if non-null, fillin with contributory paths - * @return the name of the given bcp47 identifier + * @return the name of the given identifier */ private synchronized String getNameFromManyThings( String localeOrTZID, - boolean onlyConstructCompound, + NameOpt nameOpt, String localeKeyTypePattern, String localePattern, String localeSeparator, @@ -176,7 +187,7 @@ private synchronized String getNameFromManyThings( } boolean isCompound = localeOrTZID.contains("_"); String name = - isCompound && onlyConstructCompound + isCompound && nameOpt == NameOpt.COMPOUND_ONLY ? null : getNameFromTypeCodeTransformPaths( NameType.LANGUAGE, localeOrTZID, altPicker, paths); @@ -189,7 +200,7 @@ private synchronized String getNameFromManyThings( LanguageTagParser lparser = new LanguageTagParser().set(localeOrTZID); return getNameFromOtherThings( lparser, - onlyConstructCompound, + nameOpt, altPicker, localeKeyTypePattern, localePattern, @@ -199,7 +210,7 @@ private synchronized String getNameFromManyThings( private String getNameFromOtherThings( LanguageTagParser lparser, - boolean onlyConstructCompound, + NameOpt nameOpt, Transform<String, String> altPicker, String localeKeyTypePattern, String localePattern, @@ -212,12 +223,12 @@ private String getNameFromOtherThings( boolean haveScript = false; boolean haveRegion = false; // try lang+script - if (onlyConstructCompound) { + if (nameOpt == NameOpt.COMPOUND_ONLY) { name = getNameFromTypeCodeTransformPaths( NameType.LANGUAGE, original = lparser.getLanguage(), altPicker, paths); if (name == null) name = original; - } else { + } else { // nameOpt == NameOpt.DEFAULT String x = lparser.toString(LanguageTagParser.LANGUAGE_SCRIPT_REGION); name = getNameFromTypeCodeTransformPaths(NameType.LANGUAGE, x, altPicker, paths); if (name != null) { @@ -308,7 +319,7 @@ private String getNameFromOtherThings( if (hybrid != null) { kname = cldrFile.getKeyValueName("h0", JOIN_UNDERBAR.join(hybrid)); } - oldFormatType = getNameFromBCP47(oldFormatType); + oldFormatType = getNameFromIdentifier(oldFormatType); break; case "cu": oldFormatType = diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PluralSnapshot.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PluralSnapshot.java index af4681d83ec..a52d69c7535 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PluralSnapshot.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PluralSnapshot.java @@ -334,7 +334,7 @@ public static void writeTables(CLDRFile english, PrintWriter out) { // } Map<String, String> fullLocales = new TreeMap<>(); for (String localeId : locales) { - String name = english.nameGetter().getNameFromBCP47(localeId); + String name = english.nameGetter().getNameFromIdentifier(localeId); fullLocales.put(name, localeId); } out.print( diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java index b378cd946e9..156a25a92d1 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java @@ -131,9 +131,9 @@ private static void testNames() { System.out.println( test + "\t" - + english.nameGetter().getNameFromBCP47(test) + + english.nameGetter().getNameFromIdentifier(test) + "\t" - + french.nameGetter().getNameFromBCP47(test)); + + french.nameGetter().getNameFromIdentifier(test)); } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyCompactNumbers.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyCompactNumbers.java index a152d1bd874..834d00a8849 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyCompactNumbers.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyCompactNumbers.java @@ -118,7 +118,7 @@ public static void main(String[] args) throws IOException { PrintWriter out = FileUtilities.openUTF8Writer(DIR, locale + ".html"); String title = "Verify Number Formats: " - + englishCldrFile.nameGetter().getNameFromBCP47(locale); + + englishCldrFile.nameGetter().getNameFromIdentifier(locale); out.println( "<!doctype HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><html><head>\n" + "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\n" @@ -137,7 +137,7 @@ public static void main(String[] args) throws IOException { out.println("</body></html>"); out.close(); - indexMap.put(english.nameGetter().getNameFromBCP47(locale), locale + ".html"); + indexMap.put(english.nameGetter().getNameFromIdentifier(locale), locale + ".html"); } try (PrintWriter index = DateTimeFormats.openIndex(DIR, "Numbers")) { DateTimeFormats.writeIndexMap(indexMap, index); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyZones.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyZones.java index d057c222266..0080e520f03 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyZones.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VerifyZones.java @@ -273,7 +273,8 @@ public static void main(String[] args) throws IOException { CLDRFile cldrFile = factory2.make(localeID, true); PrintWriter out = FileUtilities.openUTF8Writer(DIR, localeID + ".html"); String title = - "Verify Time Zones: " + englishCldrFile.nameGetter().getNameFromBCP47(localeID); + "Verify Time Zones: " + + englishCldrFile.nameGetter().getNameFromIdentifier(localeID); out.println( "<!doctype HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><html><head>\n" + "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\n" @@ -291,7 +292,7 @@ public static void main(String[] args) throws IOException { out.println("</body></html>"); out.close(); - indexMap.put(english.nameGetter().getNameFromBCP47(localeID), localeID + ".html"); + indexMap.put(english.nameGetter().getNameFromIdentifier(localeID), localeID + ".html"); } try (PrintWriter index = DateTimeFormats.openIndex(DIR, "Time Zones")) { DateTimeFormats.writeIndexMap(indexMap, index); diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java index 7a3775ebd51..08525d0e0ab 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java @@ -1335,7 +1335,10 @@ private void appendNameAndCode(String name, String localeID, Appendable output) private String getName(String localeID) { Set<String> contents = supplementalDataInfo.getEquivalentsForLocale(localeID); // put in special character that can be split on later - return englishFile.nameGetter().getNameFromBCP47BoolAlt(localeID, true, CLDRFile.SHORT_ALTS) + return englishFile + .nameGetter() + .getNameFromIdentifierOptAlt( + localeID, NameGetter.NameOpt.COMPOUND_ONLY, CLDRFile.SHORT_ALTS) + SPLIT_CHAR + gatherCodes(contents); } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/WikipediaOfficialLanguages.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/WikipediaOfficialLanguages.java index 2a6610a57d4..2751e66e7b9 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/WikipediaOfficialLanguages.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/WikipediaOfficialLanguages.java @@ -308,7 +308,7 @@ public static void main(String[] args) { "\t" + info.language + "\t" - + english.nameGetter().getNameFromBCP47(info.language) + + english.nameGetter().getNameFromIdentifier(info.language) + "\t" + info.status + "\t" @@ -335,7 +335,7 @@ public static void main(String[] args) { "\t" + r2 + "\t" - + english.nameGetter().getNameFromBCP47(r2) + + english.nameGetter().getNameFromIdentifier(r2) + "\t" + "CLDR-ONLY" + "\t" diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckLanguageCodeConverter.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckLanguageCodeConverter.java index 14dc0792350..c6a3d4aaa2b 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckLanguageCodeConverter.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckLanguageCodeConverter.java @@ -159,7 +159,7 @@ public static String getName(CLDRFile english, String goodCode) { if (goodCode.startsWith("x_")) { return "Private use: " + goodCode.substring(2); } - return english.nameGetter().getNameFromBCP47(goodCode); + return english.nameGetter().getNameFromIdentifier(goodCode); } public static void printLine(LanguageLine entry) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java index f4a7507b6ce..b5baf1fb73b 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/CheckYear.java @@ -291,7 +291,9 @@ public static void main(String[] args) throws IOException { System.out.println("Skipping default content: " + localeID); continue; } - sorted.put(englishFile.nameGetter().getNameFromBCP47Bool(localeID, true), localeID); + sorted.put( + englishFile.nameGetter().getNameFromIndentifierCompoundOnly(localeID), + localeID); data.put(localeID, new LocaleInfo()); } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LanguageInfoTest.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LanguageInfoTest.java index cfc73fe0679..cfc8730feb7 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LanguageInfoTest.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/LanguageInfoTest.java @@ -87,7 +87,7 @@ public static String getName(String item) { ? "n/a" : item.contains("$") ? item - : testInfo.getEnglish().nameGetter().getNameFromBCP47(item); + : testInfo.getEnglish().nameGetter().getNameFromIdentifier(item); } public static void main(String[] args) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/StandardCodesTest.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/StandardCodesTest.java index 07b80a39ef1..e710e87c443 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/StandardCodesTest.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/StandardCodesTest.java @@ -32,7 +32,7 @@ public void TestCoverage() { String name = locale.equals("*") ? "ALL" - : testInfo.getEnglish().nameGetter().getNameFromBCP47(locale); + : testInfo.getEnglish().nameGetter().getNameFromIdentifier(locale); logln( org + "\t;\t" diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java index 25dc05c53a9..f95904cf253 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java @@ -543,7 +543,7 @@ public void TestAbstractPaths() { for (String locale : getInclusion() <= 5 ? eightPointLocales : cldrFactory.getAvailable()) { CLDRFile file = testInfo.getCLDRFile(locale, resolved); if (file.isNonInheriting()) continue; - logln(locale + "\t-\t" + english.nameGetter().getNameFromBCP47(locale)); + logln(locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); for (Iterator<String> it = file.iterator(); it.hasNext(); ) { String path = it.next(); @@ -619,7 +619,7 @@ public void TestPaths() { DisplayAndInputProcessor displayAndInputProcessor = new DisplayAndInputProcessor(file, false); - logln(locale + "\t-\t" + english.nameGetter().getNameFromBCP47(locale)); + logln(locale + "\t-\t" + english.nameGetter().getNameFromIdentifier(locale)); for (Iterator<String> it = file.iterator(); it.hasNext(); ) { String path = it.next(); @@ -1124,7 +1124,7 @@ public void TestCoreData() { "Locale:" + localeID + " (" - + testInfo.getEnglish().nameGetter().getNameFromBCP47(localeID) + + testInfo.getEnglish().nameGetter().getNameFromIdentifier(localeID) + ")"; if (!collations.contains(localeID)) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java index 36ccbdf51dd..6f20a37e752 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java @@ -85,7 +85,7 @@ public void testFallbackNames() { }; CLDRFile english = testInfo.getEnglish(); for (String[] test : tests) { - assertEquals("", test[1], english.nameGetter().getNameFromBCP47(test[0])); + assertEquals("", test[1], english.nameGetter().getNameFromIdentifier(test[0])); } } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRLocaleCoverage.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRLocaleCoverage.java index bc7e3b036f1..ce07591bf3a 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRLocaleCoverage.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRLocaleCoverage.java @@ -163,7 +163,7 @@ public void TestLanguageNameCoverage() { && CLDRLocale.getInstance(locale).getParent().equals(CLDRLocale.ROOT)) { official1MSetNames.put( localeAndSize.getValue(), - "\t" + locale + "\t" + ENGLISH.nameGetter().getNameFromBCP47(locale)); + "\t" + locale + "\t" + ENGLISH.nameGetter().getNameFromIdentifier(locale)); } } if (!official1MSetNames.isEmpty()) { @@ -181,7 +181,7 @@ public void TestLanguageNameCoverage() { coverageLocales.removeAll(additionsToTranslate); for (String locale : localesForNames) { - logln("\n" + locale + "\t" + ENGLISH.nameGetter().getNameFromBCP47(locale)); + logln("\n" + locale + "\t" + ENGLISH.nameGetter().getNameFromIdentifier(locale)); } logln("\nmainLocales:" + composeList(mainLocales, "\n\t", new StringBuilder())); @@ -244,7 +244,7 @@ private boolean assertContains( temp.removeAll(set); Set<String> temp2 = new TreeSet<>(); for (String locale : temp) { - temp2.add(locale + "\t" + ENGLISH.nameGetter().getNameFromBCP47(locale)); + temp2.add(locale + "\t" + ENGLISH.nameGetter().getNameFromIdentifier(locale)); } errln(title + ": Missing:\t" + temp.size() + "\n\t" + Joiner.on("\n\t").join(temp2)); } @@ -345,7 +345,7 @@ public void TestCldrSuperset() { "cldr level = max for " + locale + " (" - + ENGLISH.nameGetter().getNameFromBCP47(locale) + + ENGLISH.nameGetter().getNameFromIdentifier(locale) + ")", cldrLevel, maxLevel); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRUtils.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRUtils.java index 37f14f1bd41..820a9eeb09f 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRUtils.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRUtils.java @@ -99,7 +99,7 @@ private void checkNames( assertEquals( "Test variant formatting combinedLong " + locale, combinedLong, - frenchNameGetter.getNameFromBCP47(locale)); + frenchNameGetter.getNameFromIdentifier(locale)); String combinedShort = otherNames.length > 0 ? otherNames[0] : combinedLong; String uncombinedLong = otherNames.length > 1 ? otherNames[1] : combinedLong; String uncombinedShort = otherNames.length > 2 ? otherNames[2] : uncombinedLong; @@ -107,15 +107,17 @@ private void checkNames( assertEquals( "Test variant formatting combinedShort " + locale, combinedShort, - frenchNameGetter.getNameFromBCP47BoolAlt(locale, false, SHORT_ALT_PICKER)); + frenchNameGetter.getNameFromIdentifierOptAlt( + locale, NameGetter.NameOpt.DEFAULT, SHORT_ALT_PICKER)); assertEquals( "Test variant formatting uncombinedLong " + locale, uncombinedLong, - frenchNameGetter.getNameFromBCP47Bool(locale, true)); + frenchNameGetter.getNameFromIndentifierCompoundOnly(locale)); assertEquals( "Test variant formatting uncombinedShort " + locale, uncombinedShort, - frenchNameGetter.getNameFromBCP47BoolAlt(locale, true, SHORT_ALT_PICKER)); + frenchNameGetter.getNameFromIdentifierOptAlt( + locale, NameGetter.NameOpt.COMPOUND_ONLY, SHORT_ALT_PICKER)); } public void TestEmptyCLDRFile() { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java index 8ad5b883c57..d01fbaa8f2c 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCheckCLDR.java @@ -1387,7 +1387,7 @@ public void TestALLOWED_IN_LIMITED_PATHS() { System.out.print( locale + "\t" - + english.nameGetter().getNameFromBCP47(locale) + + english.nameGetter().getNameFromIdentifier(locale) + "\t" + cldrLevel); for (LimitedStatus limitedStatus : LimitedStatus.values()) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java index ab995724f6d..de55f9aa049 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java @@ -135,7 +135,7 @@ public Multimap<CoreItems, String> checkLocale(CLDRFile testFile) { } private String getLocaleAndName(String locale) { - return locale + "\t" + testInfo.getEnglish().nameGetter().getNameFromBCP47(locale); + return locale + "\t" + testInfo.getEnglish().nameGetter().getNameFromIdentifier(locale); } private String showColumn(Set items) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java index 9a3c865e07a..39c52099cc6 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestDayPeriods.java @@ -48,7 +48,7 @@ public void TestBasicDayPeriods() { logln( locale + "\t" - + CONFIG.getEnglish().nameGetter().getNameFromBCP47(locale) + + CONFIG.getEnglish().nameGetter().getNameFromIdentifier(locale) + "\t" + dayPeriodFormat + "\t" diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java index d009a81bcb9..af5c97887f1 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestExampleGenerator.java @@ -1551,7 +1551,10 @@ public void TestListMinimalPairExamples() { Pair.of("gender", unitGender)); } String localeName = - CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromBCP47(locale); + CLDRConfig.getInstance() + .getEnglish() + .nameGetter() + .getNameFromIdentifier(locale); boolean pluralOnly = true; if (paths.isEmpty()) { pluralSheet.add( diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java index ff800c76ab5..feca98c3008 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestInheritance.java @@ -171,7 +171,9 @@ public void TestLocalesHaveOfficial() { System.out.print( language + "\t" - + testInfo.getEnglish().nameGetter().getNameFromBCP47(language)); + + testInfo.getEnglish() + .nameGetter() + .getNameFromIdentifier(language)); M3<OfficialStatus, String, Boolean> officialChildren = languageToOfficialChildren.get(language); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLanguageGroup.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLanguageGroup.java index a958a025560..fc370a3f311 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLanguageGroup.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLanguageGroup.java @@ -126,7 +126,7 @@ private String fixedName(String code) { case "grk": return "Hellenic"; default: - return ENGLISH.nameGetter().getNameFromBCP47(code).replace(" [Other]", ""); + return ENGLISH.nameGetter().getNameFromIdentifier(code).replace(" [Other]", ""); } } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java index b7de23fc078..399f5b28a43 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestLocale.java @@ -494,31 +494,36 @@ public void TestBrackets() { } } String displayName = - nameGetter.getNameFromBCP47Etc( - row[3], true, "{0}={1}", "{0} ({1})", "{0}, {1}"); + nameGetter.getNameFromIdentifierEtc( + row[3], + NameGetter.NameOpt.COMPOUND_ONLY, + "{0}={1}", + "{0} ({1})", + "{0}, {1}"); assertEquals("locale " + row[3], row[4], displayName); } } public void TestLocaleNamePattern() { NameGetter englishNameGetter = testInfo.getEnglish().nameGetter(); - assertEquals("Locale name", "Chinese", englishNameGetter.getNameFromBCP47("zh")); + assertEquals("Locale name", "Chinese", englishNameGetter.getNameFromIdentifier("zh")); assertEquals( "Locale name", "Chinese (United States)", - englishNameGetter.getNameFromBCP47("zh-US")); + englishNameGetter.getNameFromIdentifier("zh-US")); assertEquals( "Locale name", "Chinese (Arabic, United States)", - englishNameGetter.getNameFromBCP47("zh-Arab-US")); + englishNameGetter.getNameFromIdentifier("zh-Arab-US")); CLDRFile japanese = testInfo.getCLDRFile("ja", true); NameGetter japaneseNameGetter = japanese.nameGetter(); - assertEquals("Locale name", "中国語", japaneseNameGetter.getNameFromBCP47("zh")); - assertEquals("Locale name", "中国語 (アメリカ合衆国)", japaneseNameGetter.getNameFromBCP47("zh-US")); + assertEquals("Locale name", "中国語", japaneseNameGetter.getNameFromIdentifier("zh")); + assertEquals( + "Locale name", "中国語 (アメリカ合衆国)", japaneseNameGetter.getNameFromIdentifier("zh-US")); assertEquals( "Locale name", "中国語 (アラビア文字\u3001アメリカ合衆国)", - japaneseNameGetter.getNameFromBCP47("zh-Arab-US")); + japaneseNameGetter.getNameFromIdentifier("zh-Arab-US")); } public void TestLocaleDisplay() { @@ -529,7 +534,7 @@ public void TestLocaleDisplay() { LanguageTagCanonicalizer canonicalizer = new LanguageTagCanonicalizer(LstrType.redundant); CLDRFile cldrFile = null; - boolean compound = true; + NameGetter.NameOpt nameOpt = NameGetter.NameOpt.COMPOUND_ONLY; StringBuilder formattedExamplesForSpec = new StringBuilder("\nformattedExamplesForSpec\n"); File[] paths = { new File(CLDRPaths.MAIN_DIRECTORY), new File(CLDRPaths.SUBDIVISIONS_DIRECTORY), @@ -550,10 +555,10 @@ public void TestLocaleDisplay() { case "@languageDisplay": switch (parts[1]) { case "standard": - compound = true; + nameOpt = NameGetter.NameOpt.COMPOUND_ONLY; break; case "dialect": - compound = false; + nameOpt = NameGetter.NameOpt.DEFAULT; break; } break; @@ -595,7 +600,7 @@ public void TestLocaleDisplay() { // assertEquals("LTP(BCP47)=>ICU=>BCP47", bcp47, roundTripId); canonicalizer.transform(ltp); - String name = cldrFile.nameGetter().getNameFromParserBool(ltp, compound); + String name = cldrFile.nameGetter().getNameFromParserOpt(ltp, nameOpt); if (assertEquals(cldrFile.getLocaleID() + "; " + localeId, expected, name)) { formattedExamplesForSpec .append("<tr><td>") @@ -674,7 +679,10 @@ private void showName( if (locale.equals("en-t-d0-accents")) { int debug = 0; } - String name = cldrFile.nameGetter().getNameFromBCP47BoolAlt(locale, true, null); + String name = + cldrFile.nameGetter() + .getNameFromIdentifierOptAlt( + locale, NameGetter.NameOpt.COMPOUND_ONLY, null); if (isVerbose()) { System.out.println(locale + "; " + name); } @@ -695,19 +703,19 @@ public void TestExtendedLanguage() { assertEquals( "Extended language translation", "Simplified Chinese", - englishNameGetter.getNameFromBCP47("zh_Hans")); + englishNameGetter.getNameFromIdentifier("zh_Hans")); assertEquals( "Extended language translation", "Simplified Chinese (Singapore)", - englishNameGetter.getNameFromBCP47("zh_Hans_SG")); + englishNameGetter.getNameFromIdentifier("zh_Hans_SG")); assertEquals( "Extended language translation", "American English", - englishNameGetter.getNameFromBCP47("en-US")); + englishNameGetter.getNameFromIdentifier("en-US")); assertEquals( "Extended language translation", "American English (Arabic)", - englishNameGetter.getNameFromBCP47("en-Arab-US")); + englishNameGetter.getNameFromIdentifier("en-Arab-US")); } public void testAllVariants() { @@ -861,7 +869,7 @@ private void showItem( + "\n\t\tstructure:\t" + ltp.toString(Format.structure)); try { - String name = testInfo.getEnglish().nameGetter().getNameFromBCP47(locale); + String name = testInfo.getEnglish().nameGetter().getNameFromIdentifier(locale); logln("\tname:\t" + name); } catch (Exception e) { errln("Name for " + locale + "; " + e.getMessage()); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java index 5f541cd0126..74ad0e15258 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPersonNameFormatter.java @@ -1314,7 +1314,7 @@ public List<String> getValues( "Checking\t" + locale + "\t" - + ENGLISH.nameGetter().getNameFromBCP47(locale) + + ENGLISH.nameGetter().getNameFromIdentifier(locale) + "\t" + order + "\t" diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestSupplementalInfo.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestSupplementalInfo.java index 97a604b1e80..8ecfbe78479 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestSupplementalInfo.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestSupplementalInfo.java @@ -1319,7 +1319,7 @@ public void TestMacrolanguages() { // now show the items we found for (Scope scope : scopeToCodes.keySet()) { for (String language : scopeToCodes.getAll(scope)) { - String name = englishNameGetter.getNameFromBCP47(language); + String name = englishNameGetter.getNameFromIdentifier(language); if (name == null || name.equals(language)) { Set<String> set = Iso639Data.getNames(language); if (set != null) { @@ -2223,7 +2223,7 @@ public void testPredominantEncompassed() { private String codeAndName(String macro) { // TODO Auto-generated method stub - return CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromBCP47(macro) + return CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromIdentifier(macro) + " (" + macro + ")"; diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestValidity.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestValidity.java index 44002ae14ae..ae2bf1b31d3 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestValidity.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestValidity.java @@ -568,12 +568,15 @@ private String makeAliasXml( + "\"/>" + " <!-- " + TransliteratorUtilities.toXML.transform( - CLDRConfig.getInstance().getEnglish().nameGetter().getNameFromBCP47(code) + CLDRConfig.getInstance() + .getEnglish() + .nameGetter() + .getNameFromIdentifier(code) + " ⇒ " + CLDRConfig.getInstance() .getEnglish() .nameGetter() - .getNameFromBCP47(lstrReplacement)) + .getNameFromIdentifier(lstrReplacement)) + " -->"; } diff --git a/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/GenerateLanguageContainment.java b/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/GenerateLanguageContainment.java index 5cbc0bddf58..04187c0200d 100644 --- a/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/GenerateLanguageContainment.java +++ b/tools/cldr-rdf/src/main/java/org/unicode/cldr/tool/GenerateLanguageContainment.java @@ -237,7 +237,7 @@ public <T extends Iterable<String>, U extends Iterable<T>> String showNameAndCod code -> code.equals(LocaleNames.MUL) ? LocaleNames.ROOT - : ENGLISH.nameGetter().getNameFromBCP47(code) + " (" + code + ")"; + : ENGLISH.nameGetter().getNameFromIdentifier(code) + " (" + code + ")"; static final Set<String> COLLECTIONS; @@ -402,7 +402,7 @@ void run(String[] args) throws IOException { for (String check : Arrays.asList("sw", "km", "ksh", "wae", "kea", "mfe", "th", "lo")) { System.out.println( "Checking " - + ENGLISH.nameGetter().getNameFromBCP47(check) + + ENGLISH.nameGetter().getNameFromIdentifier(check) + "[" + check + "]");