Skip to content

core: Add get_official_territories() - #1328

Open
ChrisJr404 wants to merge 1 commit into
python-babel:masterfrom
ChrisJr404:get-official-territories
Open

core: Add get_official_territories()#1328
ChrisJr404 wants to merge 1 commit into
python-babel:masterfrom
ChrisJr404:get-official-territories

Conversation

@ChrisJr404

Copy link
Copy Markdown

Closes #904.

Adds get_official_territories() to babel.core, returning a frozenset of the ISO 3166-1 alpha-2 territory codes. As mentioned in the issue, the data is pulled from the CLDR supplemental code mappings during the import, so it isn't a strict copy of the ISO list. I keep the two-letter codes that have a numeric ISO code, and drop the deprecated aliases and the user-assigned ranges, which lands on 250 codes.

A couple of territories the CLDR doesn't carry are missing, and a few exceptionally reserved codes like EU come along, so the docstring calls that out.

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.

Provide a list of current ISO 3166 country codes?

1 participant