Skip to content
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

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

btangmu
Copy link
Member

@btangmu btangmu commented Feb 12, 2025

-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

  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

-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
@btangmu
Copy link
Member Author

btangmu commented Feb 12, 2025

This PR has a few small improvements, picked from #4352 but avoiding (or at least postponing) making currency paths into extra paths

Copy link
Member

@macchiati macchiati left a 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.
Copy link
Member

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.

Copy link
Member Author

@btangmu btangmu Feb 14, 2025

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.

Copy link
Member Author

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.

@btangmu btangmu requested a review from macchiati February 14, 2025 17:27
@btangmu btangmu merged commit 9e98132 into unicode-org:main Feb 14, 2025
13 checks passed
@btangmu btangmu deleted the t17014_p branch February 14, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants