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

babel.core.UnknownLocaleError: unknown locale 'und_BQ' #1069

Open
tedgoodley opened this issue Apr 3, 2024 · 1 comment
Open

babel.core.UnknownLocaleError: unknown locale 'und_BQ' #1069

tedgoodley opened this issue Apr 3, 2024 · 1 comment

Comments

@tedgoodley
Copy link

tedgoodley commented Apr 3, 2024

Overview Description

Steps to Reproduce

  1. Try to initialize a locale with undetermined language using BQ (Caribbean Netherlands) country code, e.g. und_BQ

Actual Results

This causes an error babel.core.UnknownLocaleError: unknown locale 'und_BQ'

Expected Results

I would expect this to succeed and use the only matching locale, nl_BQ, instead when formatting dates

Reproducibility

Additional Information

@akx
Copy link
Member

akx commented Apr 24, 2024

I think implicitly finding nl_BQ for und_BQ would be unexpected behavior.

If you have an und_XX locale, you can use get_territory_language_info() to find which language(s) are spoken in XX, and figure out which one is relevant for your users:

>>> import babel.languages as bl
>>> bl.get_territory_language_info("BQ")
{'pap': {'population_percent': 81.0, 'official_status': None}, 'nl': {'population_percent': 8.0, 'official_status': 'official'}}
>>>

@akx akx added the area/CLDR label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants