From f8ac8f11b353835b7bf7b56d52d75654c14ee9d3 Mon Sep 17 00:00:00 2001 From: Peter Edberg Date: Tue, 21 May 2024 20:10:30 -0700 Subject: [PATCH] CLDR-13523 add test for valid short day length; fix resulting data errs --- common/main/fil.xml | 14 +++---- common/main/mai.xml | 2 +- common/main/mgo.xml | 28 ++++++------- common/main/sa.xml | 14 +++---- common/main/so.xml | 2 +- .../java/org/unicode/cldr/test/CheckCLDR.java | 2 + .../org/unicode/cldr/test/CheckDates.java | 39 +++++++++++++++++++ 7 files changed, 71 insertions(+), 30 deletions(-) diff --git a/common/main/fil.xml b/common/main/fil.xml index 81d923de363..dd7dea7a5be 100644 --- a/common/main/fil.xml +++ b/common/main/fil.xml @@ -2246,13 +2246,13 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ ↑↑↑ - Lin - Lun - Mar - Miy - Huw - Biy - Sab + Li + Lu + Ma + Mi + Hu + Bi + Sa ↑↑↑ diff --git a/common/main/mai.xml b/common/main/mai.xml index 4df87e482a3..f77fb854973 100644 --- a/common/main/mai.xml +++ b/common/main/mai.xml @@ -1262,7 +1262,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic ↑↑↑ ↑↑↑ ↑↑↑ - बृहस्पति + ↑↑↑ ↑↑↑ ↑↑↑ diff --git a/common/main/mgo.xml b/common/main/mgo.xml index d55ecbecf14..c6c01e33614 100644 --- a/common/main/mgo.xml +++ b/common/main/mgo.xml @@ -221,13 +221,13 @@ CLDR data files are interpreted according to the LDML specification (http://unic ↑↑↑ - 1 - 2 - 3 - 4 - 5 - 6 - 7 + A1 + A2 + A3 + A4 + A5 + A6 + A7 Aneg 1 @@ -250,13 +250,13 @@ CLDR data files are interpreted according to the LDML specification (http://unic ↑↑↑ - A1 - A2 - A3 - A4 - A5 - A6 - A7 + 1 + 2 + 3 + 4 + 5 + 6 + 7 ↑↑↑ diff --git a/common/main/sa.xml b/common/main/sa.xml index 9d6b98765c8..157f0900825 100644 --- a/common/main/sa.xml +++ b/common/main/sa.xml @@ -339,13 +339,13 @@ CLDR data files are interpreted according to the LDML specification (http://unic ↑↑↑ - Sun - Mon - Tue - Wed - Thu - Fri - Sat + ↑↑↑ + ↑↑↑ + ↑↑↑ + ↑↑↑ + ↑↑↑ + ↑↑↑ + ↑↑↑ रविवासरः diff --git a/common/main/so.xml b/common/main/so.xml index 757c573bb3a..654ca5eeb11 100644 --- a/common/main/so.xml +++ b/common/main/so.xml @@ -3363,7 +3363,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic ↑↑↑ ↑↑↑ ↑↑↑ - Arbaco + ↑↑↑ ↑↑↑ ↑↑↑ ↑↑↑ diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java index d5caed38a89..b5591694798 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java @@ -913,6 +913,7 @@ public enum Subtype { missingLanguage, namePlaceholderProblem, missingSpaceBetweenNameFields, + shortDateFieldInconsistentLength, illegalParameterValue, illegalAnnotationCode, illegalCharacter; @@ -939,6 +940,7 @@ public String toString() { Subtype.inconsistentPeriods, Subtype.abbreviatedDateFieldTooWide, Subtype.narrowDateFieldTooWide, + Subtype.shortDateFieldInconsistentLength, Subtype.coverageLevel); public static Set errorCodesPath = diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java index 05508b39a4a..d5a92b4e13b 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java @@ -369,6 +369,7 @@ public CheckCLDR handleCheck( try { if (path.indexOf("[@type=\"abbreviated\"]") >= 0) { + // ensures abbreviated <= wide for quarters, months, days, dayPeriods String pathToWide = path.replace("[@type=\"abbreviated\"]", "[@type=\"wide\"]"); String wideValue = getCldrFileToCheck().getWinningValueWithBailey(pathToWide); if (wideValue != null && isTooMuchWiderThan(value, wideValue)) { @@ -420,6 +421,7 @@ public CheckCLDR handleCheck( } } } else if (path.indexOf("[@type=\"narrow\"]") >= 0) { + // ensures narrow <= abbreviated for quarters, months, days, dayPeriods String pathToAbbr = path.replace("[@type=\"narrow\"]", "[@type=\"abbreviated\"]"); String abbrValue = getCldrFileToCheck().getWinningValueWithBailey(pathToAbbr); if (abbrValue != null && isTooMuchWiderThan(value, abbrValue)) { @@ -436,7 +438,43 @@ public CheckCLDR handleCheck( value, abbrValue); result.add(item); } + } else if (path.indexOf("[@type=\"short\"]") >= 0) { + // ensures short <= abbreviated and short >= narrow for days + String pathToAbbr = path.replace("[@type=\"short\"]", "[@type=\"abbreviated\"]"); + String abbrValue = getCldrFileToCheck().getWinningValueWithBailey(pathToAbbr); + String pathToNarrow = path.replace("[@type=\"short\"]", "[@type=\"narrow\"]"); + String narrowValue = getCldrFileToCheck().getWinningValueWithBailey(pathToNarrow); + if ((abbrValue != null + && isTooMuchWiderThan(value, abbrValue) + && value.length() > abbrValue.length()) + || (narrowValue != null + && isTooMuchWiderThan(narrowValue, value) + && narrowValue.length() > value.length())) { + // Without the additional check on length() above, the test is too sensitive + // and flags reasonable things like lettercase differences + String message; + String compareValue; + if (abbrValue != null + && isTooMuchWiderThan(value, abbrValue) + && value.length() > abbrValue.length()) { + message = + "Short value \"{0}\" can't be longer than the corresponding abbreviated value \"{1}\""; + compareValue = abbrValue; + } else { + message = + "Short value \"{0}\" can't be shorter than the corresponding narrow value \"{1}\""; + compareValue = narrowValue; + } + CheckStatus item = + new CheckStatus() + .setCause(this) + .setMainType(CheckStatus.errorType) + .setSubtype(Subtype.shortDateFieldInconsistentLength) + .setMessage(message, value, compareValue); + result.add(item); + } } else if (path.indexOf("/eraNarrow") >= 0) { + // ensures eraNarrow <= eraAbbr for eras String pathToAbbr = path.replace("/eraNarrow", "/eraAbbr"); String abbrValue = getCldrFileToCheck().getWinningValueWithBailey(pathToAbbr); if (abbrValue != null && isTooMuchWiderThan(value, abbrValue)) { @@ -451,6 +489,7 @@ public CheckCLDR handleCheck( result.add(item); } } else if (path.indexOf("/eraAbbr") >= 0) { + // ensures eraAbbr <= eraNames for eras String pathToWide = path.replace("/eraAbbr", "/eraNames"); String wideValue = getCldrFileToCheck().getWinningValueWithBailey(pathToWide); if (wideValue != null && isTooMuchWiderThan(value, wideValue)) {