From a39284ec40771cf2643722b0a79f37ec55825d6c Mon Sep 17 00:00:00 2001 From: Tom Bishop Date: Wed, 30 Oct 2024 11:07:52 -0400 Subject: [PATCH] CLDR-17088 Flesh out en.xml (#4110) --- common/main/en.xml | 158 +++++++++++++++++- .../org/unicode/cldr/tool/CLDRModify.java | 51 +++++- .../unicode/cldr/test/TestEnInheritance.java | 64 +++++++ .../org/unicode/cldr/unittest/TestPaths.java | 2 +- 4 files changed, 272 insertions(+), 3 deletions(-) create mode 100644 tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java diff --git a/common/main/en.xml b/common/main/en.xml index 2219ee84e03..2593b5a0d16 100644 --- a/common/main/en.xml +++ b/common/main/en.xml @@ -5116,6 +5116,7 @@ annotations. United Arab Emirates Dirham UAE dirham UAE dirhams + AED Afghan Afghani (1927–2002) @@ -5126,6 +5127,7 @@ annotations. Afghan Afghani Afghan Afghani Afghan Afghanis + AFN Albanian Lek (1946–1965) @@ -5136,21 +5138,25 @@ annotations. Albanian Lek Albanian lek Albanian lekë + ALL Armenian Dram Armenian dram Armenian drams + AMD Netherlands Antillean Guilder Netherlands Antillean guilder Netherlands Antillean guilders + ANG Angolan Kwanza Angolan kwanza Angolan kwanzas + AOA Angolan Kwanza (1977–1991) @@ -5191,6 +5197,7 @@ annotations. Argentine Peso Argentine peso Argentine pesos + ARS Austrian Schilling @@ -5201,11 +5208,13 @@ annotations. Australian Dollar Australian dollar Australian dollars + A$ Aruban Florin Aruban florin Aruban florin + AWG Azerbaijani Manat (1993–2006) @@ -5216,6 +5225,7 @@ annotations. Azerbaijani Manat Azerbaijani manat Azerbaijani manats + AZN Bosnia-Herzegovina Dinar (1992–1994) @@ -5226,6 +5236,7 @@ annotations. Bosnia-Herzegovina Convertible Mark Bosnia-Herzegovina convertible mark Bosnia-Herzegovina convertible marks + BAM Bosnia-Herzegovina New Dinar (1994–1997) @@ -5236,11 +5247,13 @@ annotations. Barbadian Dollar Barbadian dollar Barbadian dollars + BBD Bangladeshi Taka Bangladeshi taka Bangladeshi takas + BDT Belgian Franc (convertible) @@ -5271,6 +5284,7 @@ annotations. Bulgarian Lev Bulgarian lev Bulgarian leva + BGN Bulgarian Lev (1879–1952) @@ -5281,26 +5295,31 @@ annotations. Bahraini Dinar Bahraini dinar Bahraini dinars + BHD Burundian Franc Burundian franc Burundian francs + BIF Bermudan Dollar Bermudan dollar Bermudan dollars + BMD Brunei Dollar Brunei dollar Brunei dollars + BND Bolivian Boliviano Bolivian boliviano Bolivian bolivianos + BOB Bolivian Boliviano (1863–1963) @@ -5336,6 +5355,7 @@ annotations. Brazilian Real Brazilian real Brazilian reals + R$ Brazilian New Cruzado (1989–1990) @@ -5356,11 +5376,13 @@ annotations. Bahamian Dollar Bahamian dollar Bahamian dollars + BSD Bhutanese Ngultrum Bhutanese ngultrum Bhutanese ngultrums + BTN Burmese Kyat @@ -5371,6 +5393,7 @@ annotations. Botswanan Pula Botswanan pula Botswanan pulas + BWP Belarusian Ruble (1994–1999) @@ -5381,6 +5404,7 @@ annotations. Belarusian Ruble Belarusian ruble Belarusian rubles + BYN Belarusian Ruble (2000–2016) @@ -5391,16 +5415,19 @@ annotations. Belize Dollar Belize dollar Belize dollars + BZD Canadian Dollar Canadian dollar Canadian dollars + CA$ Congolese Franc Congolese franc Congolese francs + CDF WIR Euro @@ -5411,6 +5438,7 @@ annotations. Swiss Franc Swiss franc Swiss francs + CHF WIR Franc @@ -5431,11 +5459,13 @@ annotations. Chilean Peso Chilean peso Chilean pesos + CLP Chinese Yuan (offshore) Chinese yuan (offshore) Chinese yuan (offshore) + CNH Chinese People’s Bank Dollar @@ -5446,11 +5476,13 @@ annotations. Chinese Yuan Chinese yuan Chinese yuan + CN¥ Colombian Peso Colombian peso Colombian pesos + COP Colombian Real Value Unit @@ -5461,6 +5493,7 @@ annotations. Costa Rican Colón Costa Rican colón Costa Rican colóns + CRC Serbian Dinar (2002–2006) @@ -5476,16 +5509,19 @@ annotations. Cuban Convertible Peso Cuban convertible peso Cuban convertible pesos + CUC Cuban Peso Cuban peso Cuban pesos + CUP Cape Verdean Escudo Cape Verdean escudo Cape Verdean escudos + CVE Cypriot Pound @@ -5496,6 +5532,7 @@ annotations. Czech Koruna Czech koruna Czech korunas + CZK East German Mark @@ -5511,21 +5548,25 @@ annotations. Djiboutian Franc Djiboutian franc Djiboutian francs + DJF Danish Krone Danish krone Danish kroner + DKK Dominican Peso Dominican peso Dominican pesos + DOP Algerian Dinar Algerian dinar Algerian dinars + DZD Ecuadorian Sucre @@ -5546,11 +5587,13 @@ annotations. Egyptian Pound Egyptian pound Egyptian pounds + EGP Eritrean Nakfa Eritrean nakfa Eritrean nakfas + ERN Spanish Peseta (A account) @@ -5571,11 +5614,13 @@ annotations. Ethiopian Birr Ethiopian birr Ethiopian birrs + ETB Euro euro euros + Finnish Markka @@ -5586,11 +5631,13 @@ annotations. Fijian Dollar Fijian dollar Fijian dollars + FJD Falkland Islands Pound Falkland Islands pound Falkland Islands pounds + FKP French Franc @@ -5601,6 +5648,7 @@ annotations. British Pound British pound British pounds + £ Georgian Kupon Larit @@ -5611,6 +5659,7 @@ annotations. Georgian Lari Georgian lari Georgian laris + GEL Ghanaian Cedi (1979–2007) @@ -5621,21 +5670,25 @@ annotations. Ghanaian Cedi Ghanaian cedi Ghanaian cedis + GHS Gibraltar Pound Gibraltar pound Gibraltar pounds + GIP Gambian Dalasi Gambian dalasi Gambian dalasis + GMD Guinean Franc Guinean franc Guinean francs + GNF Guinean Syli @@ -5656,6 +5709,7 @@ annotations. Guatemalan Quetzal Guatemalan quetzal Guatemalan quetzals + GTQ Portuguese Guinea Escudo @@ -5671,16 +5725,19 @@ annotations. Guyanaese Dollar Guyanaese dollar Guyanaese dollars + GYD Hong Kong Dollar Hong Kong dollar Hong Kong dollars + HK$ Honduran Lempira Honduran lempira Honduran lempiras + HNL Croatian Dinar @@ -5691,21 +5748,25 @@ annotations. Croatian Kuna Croatian kuna Croatian kunas + HRK Haitian Gourde Haitian gourde Haitian gourdes + HTG Hungarian Forint Hungarian forint Hungarian forints + HUF Indonesian Rupiah Indonesian rupiah Indonesian rupiahs + IDR Irish Pound @@ -5726,21 +5787,25 @@ annotations. Israeli New Shekel Israeli new shekel Israeli new shekels + Indian Rupee Indian rupee Indian rupees + Iraqi Dinar Iraqi dinar Iraqi dinars + IQD Iranian Rial Iranian rial Iranian rials + IRR Icelandic Króna (1918–1981) @@ -5751,6 +5816,7 @@ annotations. Icelandic Króna Icelandic króna Icelandic krónur + ISK Italian Lira @@ -5761,11 +5827,13 @@ annotations. Jamaican Dollar Jamaican dollar Jamaican dollars + JMD Jordanian Dinar Jordanian dinar Jordanian dinars + JOD Japanese Yen @@ -5777,26 +5845,31 @@ annotations. Kenyan Shilling Kenyan shilling Kenyan shillings + KES Kyrgystani Som Kyrgystani som Kyrgystani soms + KGS Cambodian Riel Cambodian riel Cambodian riels + KHR Comorian Franc Comorian franc Comorian francs + KMF North Korean Won North Korean won North Korean won + KPW South Korean Hwan (1953–1962) @@ -5812,46 +5885,55 @@ annotations. South Korean Won South Korean won South Korean won + Kuwaiti Dinar Kuwaiti dinar Kuwaiti dinars + KWD Cayman Islands Dollar Cayman Islands dollar Cayman Islands dollars + KYD Kazakhstani Tenge Kazakhstani tenge Kazakhstani tenges + KZT Laotian Kip Laotian kip Laotian kips + LAK Lebanese Pound Lebanese pound Lebanese pounds + LBP Sri Lankan Rupee Sri Lankan rupee Sri Lankan rupees + LKR Liberian Dollar Liberian dollar Liberian dollars + LRD Lesotho Loti Lesotho loti Lesotho lotis + LSL Lithuanian Litas @@ -5892,11 +5974,13 @@ annotations. Libyan Dinar Libyan dinar Libyan dinars + LYD Moroccan Dirham Moroccan dirham Moroccan dirhams + MAD Moroccan Franc @@ -5917,11 +6001,13 @@ annotations. Moldovan Leu Moldovan leu Moldovan lei + MDL Malagasy Ariary Malagasy ariary Malagasy ariaries + MGA Malagasy Franc @@ -5932,6 +6018,7 @@ annotations. Macedonian Denar Macedonian denar Macedonian denari + MKD Macedonian Denar (1992–1993) @@ -5947,16 +6034,19 @@ annotations. Myanmar Kyat Myanmar kyat Myanmar kyats + MMK Mongolian Tugrik Mongolian tugrik Mongolian tugriks + MNT Macanese Pataca Macanese pataca Macanese patacas + MOP Mauritanian Ouguiya (1973–2017) @@ -5967,6 +6057,7 @@ annotations. Mauritanian Ouguiya Mauritanian ouguiya Mauritanian ouguiyas + MRU Maltese Lira @@ -5982,6 +6073,7 @@ annotations. Mauritian Rupee Mauritian rupee Mauritian rupees + MUR Maldivian Rupee (1947–1981) @@ -5992,16 +6084,19 @@ annotations. Maldivian Rufiyaa Maldivian rufiyaa Maldivian rufiyaas + MVR Malawian Kwacha Malawian kwacha Malawian kwachas + MWK Mexican Peso Mexican peso Mexican pesos + MX$ Mexican Silver Peso (1861–1992) @@ -6017,6 +6112,7 @@ annotations. Malaysian Ringgit Malaysian ringgit Malaysian ringgits + MYR Mozambican Escudo @@ -6032,16 +6128,19 @@ annotations. Mozambican Metical Mozambican metical Mozambican meticals + MZN Namibian Dollar Namibian dollar Namibian dollars + NAD Nigerian Naira Nigerian naira Nigerian nairas + NGN Nicaraguan Córdoba (1988–1991) @@ -6052,6 +6151,7 @@ annotations. Nicaraguan Córdoba Nicaraguan córdoba Nicaraguan córdobas + NIO Dutch Guilder @@ -6062,26 +6162,31 @@ annotations. Norwegian Krone Norwegian krone Norwegian kroner + NOK Nepalese Rupee Nepalese rupee Nepalese rupees + NPR New Zealand Dollar New Zealand dollar New Zealand dollars + NZ$ Omani Rial Omani rial Omani rials + OMR Panamanian Balboa Panamanian balboa Panamanian balboas + PAB Peruvian Inti @@ -6092,6 +6197,7 @@ annotations. Peruvian Sol Peruvian sol Peruvian soles + PEN Peruvian Sol (1863–1965) @@ -6102,21 +6208,25 @@ annotations. Papua New Guinean Kina Papua New Guinean kina Papua New Guinean kina + PGK Philippine Peso Philippine peso Philippine pesos + Pakistani Rupee Pakistani rupee Pakistani rupees + PKR Polish Zloty Polish zloty Polish zlotys + PLN Polish Zloty (1950–1995) @@ -6132,11 +6242,13 @@ annotations. Paraguayan Guarani Paraguayan guarani Paraguayan guaranis + PYG Qatari Riyal Qatari riyal Qatari riyals + QAR Rhodesian Dollar @@ -6152,16 +6264,19 @@ annotations. Romanian Leu Romanian leu Romanian lei + RON Serbian Dinar Serbian dinar Serbian dinars + RSD Russian Ruble Russian ruble Russian rubles + RUB Russian Ruble (1991–1998) @@ -6172,21 +6287,25 @@ annotations. Rwandan Franc Rwandan franc Rwandan francs + RWF Saudi Riyal Saudi riyal Saudi riyals + SAR Solomon Islands Dollar Solomon Islands dollar Solomon Islands dollars + SBD Seychellois Rupee Seychellois rupee Seychellois rupees + SCR Sudanese Dinar (1992–2007) @@ -6197,6 +6316,7 @@ annotations. Sudanese Pound Sudanese pound Sudanese pounds + SDG Sudanese Pound (1957–1998) @@ -6207,16 +6327,19 @@ annotations. Swedish Krona Swedish krona Swedish kronor + SEK Singapore Dollar Singapore dollar Singapore dollars + SGD St. Helena Pound St. Helena pound St. Helena pounds + SHP Slovenian Tolar @@ -6232,21 +6355,25 @@ annotations. Sierra Leonean Leone Sierra Leonean leone Sierra Leonean leones + SLE Sierra Leonean Leone (1964—2022) Sierra Leonean leone (1964—2022) Sierra Leonean leones (1964—2022) + SLL Somali Shilling Somali shilling Somali shillings + SOS Surinamese Dollar Surinamese dollar Surinamese dollars + SRD Surinamese Guilder @@ -6257,6 +6384,7 @@ annotations. South Sudanese Pound South Sudanese pound South Sudanese pounds + SSP São Tomé & Príncipe Dobra (1977–2017) @@ -6267,6 +6395,7 @@ annotations. São Tomé & Príncipe Dobra São Tomé & Príncipe dobra São Tomé & Príncipe dobras + STN Soviet Rouble @@ -6282,16 +6411,19 @@ annotations. Syrian Pound Syrian pound Syrian pounds + SYP Swazi Lilangeni Swazi lilangeni Swazi emalangeni + SZL Thai Baht Thai baht Thai baht + THB Tajikistani Ruble @@ -6302,6 +6434,7 @@ annotations. Tajikistani Somoni Tajikistani somoni Tajikistani somonis + TJS Turkmenistani Manat (1993–2009) @@ -6312,16 +6445,19 @@ annotations. Turkmenistani Manat Turkmenistani manat Turkmenistani manat + TMT Tunisian Dinar Tunisian dinar Tunisian dinars + TND Tongan Paʻanga Tongan paʻanga Tongan paʻanga + TOP Timorese Escudo @@ -6337,26 +6473,31 @@ annotations. Turkish Lira Turkish lira Turkish Lira + TRY Trinidad & Tobago Dollar Trinidad & Tobago dollar Trinidad & Tobago dollars + TTD New Taiwan Dollar New Taiwan dollar New Taiwan dollars + NT$ Tanzanian Shilling Tanzanian shilling Tanzanian shillings + TZS Ukrainian Hryvnia Ukrainian hryvnia Ukrainian hryvnias + UAH Ukrainian Karbovanets @@ -6372,6 +6513,7 @@ annotations. Ugandan Shilling Ugandan shilling Ugandan shillings + UGX US Dollar @@ -6403,6 +6545,7 @@ annotations. Uruguayan Peso Uruguayan peso Uruguayan pesos + UYU Uruguayan Nominal Wage Index Unit @@ -6413,6 +6556,7 @@ annotations. Uzbekistani Som Uzbekistani som Uzbekistani som + UZS Venezuelan Bolívar (1871–2008) @@ -6433,11 +6577,13 @@ annotations. Venezuelan Bolívar Venezuelan bolívar Venezuelan bolívars + VES Vietnamese Dong Vietnamese dong Vietnamese dong + Vietnamese Dong (1978–1985) @@ -6448,16 +6594,19 @@ annotations. Vanuatu Vatu Vanuatu vatu Vanuatu vatus + VUV Samoan Tala Samoan tala Samoan tala + WST Central African CFA Franc Central African CFA franc Central African CFA francs + FCFA Silver @@ -6493,6 +6642,7 @@ annotations. East Caribbean Dollar East Caribbean dollar East Caribbean dollars + EC$ Caribbean guilder @@ -6523,6 +6673,7 @@ annotations. West African CFA Franc West African CFA franc West African CFA francs + F CFA Palladium @@ -6533,6 +6684,7 @@ annotations. CFP Franc CFP franc CFP francs + CFPF Platinum @@ -6573,6 +6725,7 @@ annotations. Yemeni Rial Yemeni rial Yemeni rials + YER Yugoslavian Hard Dinar (1966–1990) @@ -6603,6 +6756,7 @@ annotations. South African Rand South African rand South African rand + ZAR Zambian Kwacha (1968–2012) @@ -6613,6 +6767,7 @@ annotations. Zambian Kwacha Zambian kwacha Zambian kwachas + ZMW Zairean New Zaire (1993–1998) @@ -6633,6 +6788,7 @@ annotations. Zimbabwean Gold Zimbabwean gold Zimbabwean gold + ZWG Zimbabwean Dollar (2009–2024) @@ -10161,7 +10317,7 @@ annotations. ja ko vi yue zh informal medium - ↑↑↑ + {0}. {0}{1} diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java index 5682315d348..a76bfbc9c87 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CLDRModify.java @@ -650,7 +650,7 @@ private static void checkSuboptions(int i, UnicodeSet allowedOptions) { + "Use -? for help."); } if (i == FIX && givenOptions.value != null) { - final UnicodeSet allowedFilters = new UnicodeSet().add('P').add('k'); + final UnicodeSet allowedFilters = new UnicodeSet().add('P').add('k').add('E'); for (char c : givenOptions.value.toCharArray()) { if (!allowedFilters.contains(c)) { throw new IllegalArgumentException( @@ -3010,6 +3010,55 @@ public void handleEnd() { } }); + fixList.add( + 'E', + "Fix null/inherited values in en.xml", + new CLDRFilter() { + final SupplementalDataInfo sdi = SupplementalDataInfo.getInstance(); + final String LOCALE_ID = "en"; + final CoverageLevel2 coverageLevel = CoverageLevel2.getInstance(sdi, LOCALE_ID); + boolean skip = false; + + @Override + public void handleStart() { + skip = !getLocaleID().equals(LOCALE_ID); + } + + @Override + public void handlePath(String xpath) { + if (skip) { + return; + } + if (coverageLevel.getLevel(xpath).getLevel() > Level.MODERN.getLevel()) { + return; + } + String value = cldrFileToFilter.getStringValue(xpath); + String message; + if (value == null) { + message = "fix null"; + } else if (CldrUtility.INHERITANCE_MARKER.equals(value)) { + message = "fix inheritance marker"; + } else { + return; + } + String resolvedValue = getResolved().getStringValue(xpath); + if (resolvedValue != null) { + String fullPath = cldrFileToFilter.getFullXPath(xpath); + replace(fullPath, fullPath, resolvedValue, message); + } + } + + @Override + public void handleEnd() { + if (skip) { + return; + } + for (final String xpath : cldrFileToFilter.getExtraPaths()) { + handlePath(xpath); + } + } + }); + fixList.add( 'D', "Downgrade paths", diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java new file mode 100644 index 00000000000..661480cb1a7 --- /dev/null +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java @@ -0,0 +1,64 @@ +package org.unicode.cldr.test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.logging.Logger; +import org.junit.jupiter.api.Test; +import org.unicode.cldr.unittest.TestPaths; +import org.unicode.cldr.util.*; + +/** + * Check modern coverage inherited values in en that are marked with up arrows or are null; all + * values should be explicit in en + */ +public class TestEnInheritance { + private static final Logger logger = Logger.getLogger(TestEnInheritance.class.getName()); + + private static final String LOCALE_ID = "en"; + + private final CLDRConfig config = CLDRConfig.getInstance(); + private final Factory factory = config.getCommonAndSeedAndMainAndAnnotationsFactory(); + private final CLDRFile cldrFile = factory.make(LOCALE_ID, false); + private CLDRFile cldrFileResolved = null; + + @Test + void testInheritance() { + final SupplementalDataInfo sdi = SupplementalDataInfo.getInstance(); + final CoverageLevel2 coverageLevel = CoverageLevel2.getInstance(sdi, LOCALE_ID); + int pathsWithNullValue = 0, pathsWithMarkerValue = 0; + for (final String path : cldrFile.fullIterable()) { + if (coverageLevel.getLevel(path).getLevel() <= Level.MODERN.getLevel()) { + String value = cldrFile.getStringValue(path); + if (value == null) { + // Do not complain about + // //ldml/dates/timeZoneNames/metazone[@type="Gulf"]/short/standard + if (!cldrFile.getExtraPaths().contains(path) + || !TestPaths.extraPathAllowsNullValue(path)) { + complain("null value", ++pathsWithNullValue, path); + } + } else if (CldrUtility.INHERITANCE_MARKER.equals(value)) { + complain("inheritance marker", ++pathsWithMarkerValue, path); + } + } + } + assertEquals(0, pathsWithNullValue + pathsWithMarkerValue, "failures"); + } + + private void complain(String description, int count, String path) { + if (cldrFileResolved == null) { + cldrFileResolved = factory.make(LOCALE_ID, true); + } + String resolvedValue = cldrFileResolved.getStringValue(path); + logger.severe( + this.getClass().getSimpleName() + + " -- " + + path + + " -- " + + description + + " " + + count + + " -- Resolved value: [" + + resolvedValue + + "]"); + } +} diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java index ddf60ed9ce0..2670707aeb0 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPaths.java @@ -244,7 +244,7 @@ public boolean allowsExtraPath(String path, boolean isExtraPath) { * updating (to allow null for other paths) if that function changes. *

Reference: https://unicode-org.atlassian.net/browse/CLDR-11238 */ - private boolean extraPathAllowsNullValue(String path) { + public static boolean extraPathAllowsNullValue(String path) { if (path.contains("/timeZoneNames/metazone") || path.contains("/timeZoneNames/zone") || path.contains("/dayPeriods/dayPeriodContext")