20
20
import com .ibm .icu .text .Transform ;
21
21
import com .ibm .icu .text .UnicodeSet ;
22
22
import com .ibm .icu .util .ULocale ;
23
+ import java .util .ArrayList ;
24
+ import java .util .Arrays ;
23
25
import java .util .BitSet ;
24
26
import java .util .Date ;
25
27
import java .util .HashMap ;
@@ -63,9 +65,18 @@ public class CheckForExemplars extends FactoryCheckCLDR {
63
65
64
66
private static final String STAND_IN = "#" ;
65
67
66
- // private final UnicodeSet commonAndInherited = new
67
- // UnicodeSet(CheckExemplars.Allowed).complement();
68
- // "[[:script=common:][:script=inherited:][:alphabetic=false:]]");
68
+ /**
69
+ * These values, and their uppercase variants, are forbidden for any path. They should all be
70
+ * lowercase.
71
+ */
72
+ private static final List <String > FORBIDDEN_VALUES = new ArrayList <>(Arrays .asList ("n/a" ));
73
+
74
+ private static final String FORBIDDEN_VALUE_MESSAGE =
75
+ "This value is forbidden for any path. If you believe this item is not an error, "
76
+ + "add a forum post with an explanation about why this value is not an error. "
77
+ + "The CLDR Technical Committee will reply to your forum post if they need any more information in "
78
+ + "order to resolve the error or next steps on how to resolve if they still believe it is an error." ;
79
+
69
80
static String [] EXEMPLAR_SKIPS = {
70
81
"/currencySpacing" ,
71
82
"/exemplarCharacters" ,
@@ -329,7 +340,13 @@ public CheckCLDR handleCheck(
329
340
}
330
341
331
342
// Check all paths for illegal characters, even EXEMPLAR_SKIPS
332
- checkIllegalCharacters (path , value , result );
343
+ checkIllegalCharacters (value , result );
344
+
345
+ // If you believe this item is not an error, add forum post with an explanation about why
346
+ // the current value is not an error. The CLDR Technical Committee will reply to your forum
347
+ // post if they need any more information in order to resolve the error or next steps on how
348
+ // to resolve if they still believe it is an error
349
+ checkForbiddenValues (value , result );
333
350
334
351
if (containsPart (path , EXEMPLAR_SKIPS )) {
335
352
return this ;
@@ -583,7 +600,7 @@ public CheckCLDR handleCheck(
583
600
584
601
// Check for characters that are always illegal in values.
585
602
// Currently those are just the paired bidi marks.
586
- private void checkIllegalCharacters (String path , String value , List <CheckStatus > result ) {
603
+ private void checkIllegalCharacters (String value , List <CheckStatus > result ) {
587
604
if (ILLEGAL_RTL_CONTROLS .containsSome (value )) {
588
605
result .add (
589
606
new CheckStatus ()
@@ -595,6 +612,17 @@ private void checkIllegalCharacters(String path, String value, List<CheckStatus>
595
612
}
596
613
}
597
614
615
+ private void checkForbiddenValues (String value , List <CheckStatus > result ) {
616
+ if (FORBIDDEN_VALUES .contains (value .toLowerCase ())) {
617
+ result .add (
618
+ new CheckStatus ()
619
+ .setCause (this )
620
+ .setMainType (CheckStatus .errorType )
621
+ .setSubtype (Subtype .forbiddenValue )
622
+ .setMessage (FORBIDDEN_VALUE_MESSAGE ));
623
+ }
624
+ }
625
+
598
626
private String checkAndReplacePlaceholders (
599
627
String path , String value , List <CheckStatus > result ) {
600
628
CheckStatus .Type statusType =
0 commit comments