-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLDR-17014 Avoid adding constant currency paths twice; getGoodAvailableCodes; messages #4368
Conversation
-Use getGoodAvailableCodes instead of getBcp47Keys().getAll(cu) for consistency and efficiency and to obviate toUpperCase -In GenerateLocaleIDTestData, add comment to generated file indicating it was generated -In checkFullpathValue, include source (getSourceLocaleID) in error message
This PR has a few small improvements, picked from #4352 but avoiding (or at least postponing) making currency paths into extra paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So clicking request changes until that is verified
+ currencyCode | ||
+ "\"]/displayName"); | ||
if (!pluralCounts.isEmpty()) { | ||
// This code is locale-dependent due to pluralCounts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to be careful here. What we want is all of the following paths to be generated.
English:
<currency type="ZMK">
<displayName>Zambian Kwacha (1968–2012)</displayName>
<displayName count="one">Zambian kwacha (1968–2012)</displayName>
<displayName count="other">Zambian kwachas (1968–2012)</displayName>
</currency>
<currency type="ZMW">
<displayName>Zambian Kwacha</displayName>
<displayName count="one">Zambian kwacha</displayName>
<displayName count="other">Zambian kwachas</displayName>
<symbol>ZMW</symbol>
</currency>
Japanese:
<currency type="ZMK">
<displayName>ザンビア クワチャ (1968–2012)</displayName>
<displayName count="other">↑↑↑</displayName>
<symbol draft="contributed">↑↑↑</symbol>
</currency>
<currency type="ZMW">
<displayName>ザンビア クワチャ</displayName>
<displayName count="other">↑↑↑</displayName>
<symbol>↑↑↑</symbol>
<symbol alt="narrow">↑↑↑</symbol>
(The alt is special)
You are deleting 2 things: the addition of the /symbol, and addition of the /displayName (with no count!!)
If both of these are always added anyway in CODE_FALLBACK, then it is ok. I don't have time to check this right now though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Those are added in CODE_FALLBACK by XMLSource.java, here:
static {
...
List<NameType> nameTypeList =
List.of(NameType.CURRENCY, NameType.CURRENCY_SYMBOL, NameType.TZ_EXEMPLAR);
for (NameType nameType : nameTypeList) {
StandardCodes.CodeType codeType = nameType.toCodeType();
Set<String> codes = sc.getGoodAvailableCodes(codeType);
for (Iterator<String> codeIt = codes.iterator(); codeIt.hasNext(); ) {
String code = codeIt.next();
String value = code;
...
addFallbackCode(nameType, code, value);
}
}
The path constructed in addFallbackCode
is nameType.getKeyPath(code)
.
For NameType.CURRENCY
the path is //ldml/numbers/currencies/currency[@type=...]/displayName
.
For NameType.CURRENCY_SYMBOL
the path is //ldml/numbers/currencies/currency[@type=...]/symbol
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alt="narrow"
path is not added (as fallback or extra); that's not changed here.
-Avoid adding constant currency paths twice
-Use getGoodAvailableCodes instead of getBcp47Keys().getAll(cu) for consistency and efficiency and to obviate toUpperCase
-In GenerateLocaleIDTestData, add comment to generated file indicating it was generated
-In checkFullpathValue, include source (getSourceLocaleID) in error message
CLDR-17014
ALLOW_MANY_COMMITS=true