-
Notifications
You must be signed in to change notification settings - Fork 414
CLDR-18963 Allow numberSystem attribute for currency element #5205
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
base: main
Are you sure you want to change the base?
Conversation
-Revise ldml.dtd to allow numberSystem attribute for currency element -Delete the (disabled) check for numberSystem in CheckNumbers.java
-Move numberSystem after draft
-Move numberSystem after references and validSubLocales
|
I think this PR is between essentially the same rock and hard place as the previous PR (#5149). Here we're adding numberSystem for currency not for pattern, but otherwise it's the same problem. Per testAttributeOrder status (distinguished before value before metadata), we need numberSystem (distinguished) before draft (metadata). See: But, per MergeLists, we need draft before numberSystem for consistency with, e.g., A most ingenious paradox. |
|
It is still good that we tripped across this in the first PR, because having (optional) numberSystem attributes for currency elements is the better structure. |
I've just tried that locally. Starting with The item to be added is The two metadata items to be moved are The test result is: That is: Meaning, I think, that MergeLists won't accept It would help if the algorithm and error reporting of MergeLists were less mysterious. Would it be worthwhile to add some comments and debugging output to make it unambiguous what A and B are in "cannot merge if we have [...A...B...] and [...B...A...]"? Here it seems A and B could be |
|
You can leave validSubLocales where it was. Since it is depreciated, it
doesn't matter.
…On Wed, Nov 26, 2025, 14:15 Tom Bishop ***@***.***> wrote:
*btangmu* left a comment (unicode-org/cldr#5205)
<#5205 (comment)>
move the @metadata <https://github.com/metadata> items (keeping their
same relative order) to the end of the items
I've just tried that locally. Starting with
<!ATTLIST currency type NMTOKEN "standard" >
***@***.***:validity/currency-->
<!ATTLIST currency alt NMTOKENS #IMPLIED >
***@***.***:literal/variant-->
<!ATTLIST currency draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
***@***.***>
***@***.***>
<!ATTLIST currency references CDATA #IMPLIED >
***@***.***>
<!ATTLIST currency validSubLocales CDATA #IMPLIED >
***@***.***>
***@***.***>
The item to be added is
<!ATTLIST currency numberSystem CDATA #IMPLIED >
***@***.***:bcp47/nu-->
The two metadata items to be moved are draft and references. So I have
tried this:
<!ATTLIST currency type NMTOKEN "standard" >
***@***.***:validity/currency-->
<!ATTLIST currency alt NMTOKENS #IMPLIED >
***@***.***:literal/variant-->
<!ATTLIST currency validSubLocales CDATA #IMPLIED >
***@***.***>
***@***.***>
<!ATTLIST currency numberSystem CDATA #IMPLIED >
***@***.***:bcp47/nu-->
<!ATTLIST currency draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
***@***.***>
***@***.***>
<!ATTLIST currency references CDATA #IMPLIED >
***@***.***>
The test result is:
java.lang.IllegalArgumentException: Inconsistent requested ordering: cannot merge if we have [...A...B...] and [...B...A...]: {references=[draft, references], standard=[draft, standard, references, validSubLocales], validSubLocales=[draft, standard, references, validSubLocales], numberSystem=[draft, validSubLocales, numberSystem], draft=[validSubLocales, numberSystem, draft, references]}
at org.unicode.cldr.util.MergeLists.merge(MergeLists.java:68)
That is:
references =[draft, references]
standard =[draft, standard, references, validSubLocales]
validSubLocales=[draft, standard, references, validSubLocales]
numberSystem =[draft, validSubLocales, numberSystem]
draft =[validSubLocales, numberSystem, draft, references]
Meaning, I think, that MergeLists won't accept validSubLocales before
draft since elsewhere there is validSubLocales after draft. Am I
understanding your instructions and the result correctly?
It would help if the algorithm and error reporting of MergeLists were less
mysterious. Would it be worthwhile to add some comments and debugging
output to make it unambiguous what A and B are in "cannot merge if we have
[...A...B...] and [...B...A...]"? Here it seems A and B could be
validSubLocales and draft, or draft and numberSystem, or references and
validSubLocales...
—
Reply to this email directly, view it on GitHub
<#5205 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMDRR2UWSXNRUT6IN2T36YQ7HAVCNFSM6AAAAACNFQW2SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKOBTGM4DQOBYGE>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Then I still get: That is, The position of |
|
The ordering of attributes within elements is controlled by a global MapComparator across all elements with a given DTD, to save having to have individual attribute comparators for each element. That MapComparator created using MergeLists, which merges the attributes based on their ordering in the DTD file. MergeLists also enforces that there are no cycles among elements; for example, you can’t have: element1: attributeA < attributeB The order of attributes should always be
There is a test for that, but for backwards compatibility there is an exception list. So we retain the ‘bad’ order if we have to (by updating the exception list) I took a look, and numberSystem is almost always after draft and references. So for currency let's move it before validSubLocales, and adjust the exception list in the failing test. |
By "exception list" I think you mean |
-For currency, allow numberSystem after references
That works. The tests are now passing. Note that currency needs to be after validSubLocales to satisfy MergeLists ("cannot merge if we have [...A...B...] and [...B...A...]"), which has no exception list. |
macchiati
left a comment
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.
Just one remaining issue
| } | ||
| } | ||
|
|
||
| // Check that symbols are for an explicit number system; |
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.
Why is this being dropped? We still want to ensure that .../symbols has a numberSystem.
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.
My mistake! I confused this section with the one below that's deleted. I'll fix that now.
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.
Fixed by the 5th commit.
|
Also, we will need documentation in the spec (doesn't have to be this PR, but the ticket can't be closed until that is done). |
| } | ||
| XPathParts parts = XPathParts.getFrozenInstance(path); | ||
|
|
||
| // TODO: re-enable this commented-out check |
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.
Hmmm. Rather than disable the following for all cases in order for currency to have it be optional, we probably want to just disable it for currency. Sorry, should have caught this earlier.
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.
just disable it for currency
Done in the 6th commit
-Restore the long-ago disabled check but skip for NumericType.CURRENCY
-Revise ldml.dtd to allow numberSystem attribute for currency element
-Delete the (disabled) check for numberSystem in CheckNumbers.java
-Update attributeOrderGrandfathered, for currency, allow numberSystem after references
CLDR-18963
ALLOW_MANY_COMMITS=true