Skip to content

Commit 9bbbc77

Browse files
authored
CLDR-15830 Add explanatory comments in NameType.java (#4252)
1 parent ed491cf commit 9bbbc77

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tools/cldr-code/src/main/java/org/unicode/cldr/util/NameType.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
import java.util.Locale;
44

5+
/**
6+
* There are different types of name. This enum enumerates some of those types.
7+
*
8+
* <p>For example, "Sanskrit", "Devanagari", and "India" are names of a language, a script, and a
9+
* territory, respectively. A generic method that works for languages, scripts, territories, etc.,
10+
* may be called to get one of those names (or their equivalents for a locale other than English)
11+
* with a NameType parameter set to NameType.LANGUAGE, NameType.SCRIPT, or NameType.TERRITORY,
12+
* respectively, to indicate what type of name is requested (possibly with additional parameters
13+
* like a code such as "sa" for "Sanskrit"). The values starting with TZ_ are for time zones.
14+
*/
515
public enum NameType {
616
NONE,
717
LANGUAGE,
@@ -21,9 +31,15 @@ public enum NameType {
2131
KEY_TYPE,
2232
SUBDIVISION;
2333

24-
// The order of rows must correspond to INDEX_LANGUAGE, INDEX_SCRIPT, etc.
25-
// Caution: the presence of "key|type" presents complications for refactoring.
26-
// The row with "key|type" has four strings, while the others have three.
34+
/**
35+
* This data in NameTable is used for associating types of path with types of name. For legacy
36+
* reasons it still contains strings like "language" rather than the corresponding enum values
37+
* like NameType.LANGUAGE.
38+
*
39+
* <p>The order of rows must correspond to INDEX_LANGUAGE, INDEX_SCRIPT, etc. Caution: the
40+
* presence of "key|type" presents complications for refactoring. The row with "key|type" has
41+
* four strings, while the others have three.
42+
*/
2743
private static final String[][] NameTable = {
2844
{"//ldml/localeDisplayNames/languages/language[@type=\"", "\"]", "language"},
2945
{"//ldml/localeDisplayNames/scripts/script[@type=\"", "\"]", "script"},

0 commit comments

Comments
 (0)