python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.34k stars 448 forks source link

"unknown locale 'ie'" (Occidental/Interlingue) #1114

Closed buhtz closed 3 months ago

buhtz commented 3 months ago

It seems that babel do not support Occidental/Interlingue.

>>> import babel
>>> babel.Locale.parse('ie')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/babel/core.py", line 330, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'ie'

I am just an upstream maintainer need to deal with over 40 languages and having some helper scripts. One of that scripts now fails because of that new added language. Currently I can add some exceptional handling for that. But I would prefer to have it supported by babel.

Just for fun I also tried "tlh" language code for Klingon. It is also not supported.

Both of them are "official" standardized languages, with scientific interest and rare use in real live. I don't want to argue about the relevance of such languages. I don't care. But my users are. IMHO if there is an ISO language code I would say babel and similar packages should support it.

buhtz commented 3 months ago

Learned from other of your issues this might be because babel does stick to "CLDR" (not knowing what this is). If this is the case then you minimally should improve your error message to make it clear to the users that it is not "the fault" of babel but CLDR. This would prevent more distracting tickets in your project.

akx commented 3 months ago

See #689, #454, #344.

As it is, Locale.parse() only supports locales that have data in the Unicode Common Locale Data Repository (the CLDR).

buhtz commented 3 months ago

It seems that "ie" is supported by CLDR (latest stable release 45). But I might be wrong or in the wrong version of CLDR?

https://www.unicode.org/cldr/charts/45/summary/ie.html

akx commented 3 months ago

Ah, good catch. #1077 – the PR to support CLDR 45 – has been merged but not released yet. I'm planning on getting around to releasing Babel 2.16 soon.

akx commented 3 months ago

I can confirm ie is supported in my local working copy, so it'll be supported in 2.16:

>>> import babel
>>> babel.Locale.parse('ie').territories["US"]
'Unit States'
buhtz commented 3 months ago

Thank you very much from the bit-team/backintime project.

buhtz commented 3 months ago

My apologize. It seems that "ie" is supported since your 2.15 release.

akx commented 3 months ago

No worries, thank you for the documentation PR! Closing this for the time being.