Repository navigation
Conversation
number_symbols_for/2 built Cldr.Number.Symbol with struct/2, which
drops every key the struct does not define. time_separator_alt_variant
("." in nb, nn, no and sv) is now left out by name. approximately_sign,
currency_decimal and currency_group are kept when the struct defines
them, so this works with every ex_cldr_numbers version. Any other
symbol raises a KeyError.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
Cldr.Config.number_symbols_for/2buildsCldr.Number.Symbolwithstruct/2, which drops every key the struct does not define. With ex_cldr_numbers 2.38.3 it drops these CLDR symbols:Problem
After
Any other symbol that the struct does not define raises a
KeyError.Details
time_separator_alt_variantapproximately_signCldr.Number.Symbolhas the fieldcurrency_decimal,currency_groupCldr.Number.Symbolhas the fieldCldr.Number.Symbollives in ex_cldr_numbers, and ex_cldr does not depend on it. The optional symbols follow the struct, so this works with ex_cldr_numbers 2.38.3 and with the fields from Use CLDR currency separators when formatting a currency cldr_numbers#66, and the two can be released in any order.test/number_symbol_test.exsbuilds the symbols of every locale inpriv/cldr/locales(about 5 s), so a CLDR update with a new symbol fails the test suite. Other tests: sv leaves out its "." time separator, and an unknown symbol (digit_marker) raises.test/support/number_symbol.exstands in for the ex_cldr_numbers 2.38.3 struct in the test env.mix testagainst this branch (path dependency): upstreammain5232 passed, Use CLDR currency separators when formatting a currency cldr_numbers#66 5234 passed. Its test backend compiles all 766 locales, which runsnumber_symbols_for!/2for each.mix testpasses (13359).mix format --check-formattedfails onmaintoo (Elixir 1.20.4), in 21 files, on lines this change does not touch. The changed code is formatted.lib/cldr/number/backend/symbol.ex) builds the same struct with its ownstruct/2, so it still drops these symbols. It could callCldr.Config.number_symbol!/1.AI disclosure: AI models helped us find this issue, write the change, and review it.