Skip to content

Commit decdae4

Browse files
authored
CLDR-18591 Restore CLDRFile API for unicodetools (#4935)
1 parent 94268a4 commit decdae4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,4 +3338,36 @@ String getStringValueWithBaileyNotConstructed(String path) {
33383338
}
33393339
return value;
33403340
}
3341+
3342+
// The following deprecated constants and methods are implemented only for backward
3343+
// compatibility with https://github.com/unicode-org/unicodetools
3344+
3345+
@Deprecated public static final int LANGUAGE_NAME = 0, SCRIPT_NAME = 1, TERRITORY_NAME = 2;
3346+
3347+
@Deprecated
3348+
public String getName(int type, String code) {
3349+
switch (type) {
3350+
case LANGUAGE_NAME:
3351+
return nameGetter.getNameFromTypeEnumCode(NameType.LANGUAGE, code);
3352+
case SCRIPT_NAME:
3353+
return nameGetter.getNameFromTypeEnumCode(NameType.SCRIPT, code);
3354+
case TERRITORY_NAME:
3355+
return nameGetter.getNameFromTypeEnumCode(NameType.TERRITORY, code);
3356+
default:
3357+
throw new IllegalArgumentException("Unrecognized type");
3358+
}
3359+
}
3360+
3361+
@Deprecated
3362+
public String getName(String code) {
3363+
return nameGetter.getNameFromIdentifier(code);
3364+
}
3365+
3366+
@Deprecated
3367+
public String getName(String type, String code) {
3368+
if (!type.equals("territory")) {
3369+
throw new IllegalArgumentException("First argument should be territory");
3370+
}
3371+
return nameGetter.getNameFromTypeEnumCode(NameType.TERRITORY, code);
3372+
}
33413373
}

0 commit comments

Comments
 (0)