-
Notifications
You must be signed in to change notification settings - Fork 10
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.Territory.from_subdivision_code/2 should resolve aliases #33
Comments
Schultzer
added a commit
that referenced
this issue
Jul 13, 2023
This PR closes #33, by resolving subdivision aliases.
@tomciopp I've opened a PR that resolves the subdivision aliases. I would be pleased if you could try out the branch and see if it works for you. {:ex_cldr_territories, github: "Schultzer/cldr_territories", branch: "resolve-subdivision-aliases"} {:ex_cldr_territories, github: "Schultzer/cldr_territories", ref: "809349580526ed8eff1d6e4a557fdf4110d20c7d"} |
@Schultzer Yes, this code now works as expected. |
Schultzer
added a commit
that referenced
this issue
Jul 14, 2023
* Resolve subdivision aliases This PR closes #33, by resolving subdivision aliases. * Allow style to be passed to from_subdivision_code
Thanks, I've pushed the changes to master. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copied from elixir-cldr/cldr#209
Summary
When resolving the names associated with a subdivision, such as
uspr
, no name is returned even though it's a valid subdivision code. This is becauseuspr
is an alias to the territoryPR
(Puerto Rico). It can also be the case that a subdivision is deprecated and therefore it is also aliased.CLDR provides a database of aliases that is returned by
Cldr.Config.aliases/0
which is a map, including the key:subdivision
under which the subdivision aliases are stored.This issue is to request that
Cldr.Territory.from_subdivision_code/2
resolve aliases to either base subdivision or, in situations like the above, territory code.Suggested approach
Cldr.Territory.subdivision_aliases/0
which encapsulates the alias information. This information can be obtained at compile time fromCldr.Config.aliases[:subdivision]
Subdivision alias data
Today,
Cldr.Config.aliases/0
will return subdivision aliases as strings no matter whether they are territories or subdivisions. By definition, territories should be of the typet:Cldr.Locale.territory_code/0
which is an uncased atom. The following code is suggested to overcome this bug (which will be fixed in the nextex_cldr
release:The text was updated successfully, but these errors were encountered: