babel icon indicating copy to clipboard operation
babel copied to clipboard

Pāli language missing.

Open jenstroeger opened this issue 5 years ago • 17 comments

So, pi is the ISO_639-1 language code for the Pāli language, yet

>>> import babel
>>> babel.__version__
'2.7.0'
>>> babel.Locale.parse('pi_PI')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/…/lib/python3.7/site-packages/babel/core.py", line 331, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'pi_PI'
>>> babel.Locale.parse('pi')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/…/lib/python3.7/site-packages/babel/core.py", line 331, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'pi'

I’m not sure what’s required to add a new locale here, but would it be possible to add Pāli? Happy to submit a PR if somebody can give me pointers.

jenstroeger avatar Jan 25 '20 02:01 jenstroeger

All the locale data in Babel comes from the Unicode CLDR (at least until some planned custom overlays etc. are implemented).

I couldn't find an issue for Pāli in the CLDR issue tracker, so you may wish to follow the procedure to request a new locale.

akx avatar Jan 28 '20 06:01 akx

Thanks for the tip, @akx! I’ve opened CLDR-13555, and I guess we’ll just have to wait and see what happens next?

Feel free to close this one.

jenstroeger avatar Jan 28 '20 06:01 jenstroeger

@akx, hmm, looking at en.xml of the CLDR then both Pāli (pi) and Latin (la) are defined, yet:

>>> import babel
>>> babel.__version__
'2.8.0'
>>> babel.Locale('la')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/…/lib/python3.7/site-packages/babel/core.py", line 168, in __init__
    raise UnknownLocaleError(identifier)
babel.core.UnknownLocaleError: unknown locale 'la'
>>> babel.Locale('pi')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/…/lib/python3.7/site-packages/babel/core.py", line 168, in __init__
    raise UnknownLocaleError(identifier)
babel.core.UnknownLocaleError: unknown locale 'pi'

What am I missing here?

jenstroeger avatar Jun 13 '20 11:06 jenstroeger

You're looking at the list of language names in English, which is generally accessible with Locale.get_language_name()... but that API unfortunately doesn't work for languages that aren't available for Babel, so you'd have to look at the underlying languages dict instead to access that data:

>>> en = babel.Locale.parse("en")
>>> en.languages.get('pi')
'Pali'
>>> en.languages.get('la')
'Latin'

akx avatar Sep 22 '20 12:09 akx

@akx, thank you! Is the display name available as well? From the docs:

Locales itself can be used to describe the locale itself or other locales.

So I guess without having a Locale object for Pāli or Sanskrit I won’t be able to access their respective display names?

jenstroeger avatar Sep 22 '20 17:09 jenstroeger

Well, you could compose something akin to a display name from a language name and territory name (l.languages and l.territories), if you know the territory that language is spoken in.

akx avatar Sep 22 '20 18:09 akx

@jenstroeger CLDR ticket was closed due to no further data

srl295 avatar May 03 '21 19:05 srl295

@srl295, just responded.

BTW, I came across similar issues with languages like Cree or Sanskrit.

jenstroeger avatar May 04 '21 06:05 jenstroeger

Can this be closed, its upstream.

StanFromIreland avatar Mar 04 '25 21:03 StanFromIreland

Can this be closed, its upstream.

@StanFromIreland oh, this has rolled out?

jenstroeger avatar Mar 04 '25 22:03 jenstroeger

Can this be closed, its upstream.

@StanFromIreland oh, this has rolled out?

Hi @jenstroeger - actually, we closed it because we didn't hear back from you (Hello!) 👋

There's an online form now, at https://cldr.unicode.org/index/cldr-spec/core-data-for-new-locales - can you fill that out and mention CLDR-13555 ?

srl295 avatar Mar 05 '25 00:03 srl295

Hi @jenstroeger - actually, we closed it because we didn't hear back from you (Hello!) 👋

Oh dear… Hello!

There's an online form now, at https://cldr.unicode.org/index/cldr-spec/core-data-for-new-locales - can you fill that out and mention CLDR-13555 ?

That’s the “Core data needed for new CLDR locale” form?

jenstroeger avatar Mar 06 '25 14:03 jenstroeger

Hi @jenstroeger - actually, we closed it because we didn't hear back from you (Hello!) 👋

Oh dear… Hello!

Hello again! Hey, it's still the same decade as last time!

There's an online form now, at https://cldr.unicode.org/index/cldr-spec/core-data-for-new-locales - can you fill that out and mention CLDR-13555 ?

That’s the “Core data needed for new CLDR locale” form?

The very same.

srl295 avatar Mar 06 '25 15:03 srl295

Hello again! Hey, it's still the same decade as last time!

Hello again @srl295, and hooray that I didn’t slack off for too long!

I just responded to CLDR-13555 which should, once addressed, bleed into this package, correct?

jenstroeger avatar Apr 14 '25 04:04 jenstroeger

Hello again! Hey, it's still the same decade as last time!

Hello again @srl295, and hooray that I didn’t slack off for too long!

I just responded to CLDR-13555 which should, once addressed, bleed into this package, correct?

Yes, form filled out, data filled in, and so on, this is a good time because data collection will be starting soon

srl295 avatar Apr 14 '25 12:04 srl295

Hello again! Hey, it's still the same decade as last time!

Hello again @srl295, and hooray that I didn’t slack off for too long!

I just responded to CLDR-13555 which should, once addressed, bleed into this package, correct?

Yes, form filled out, data filled in, and so on, this is a good time because data collection will be starting soon

srl295 avatar Apr 14 '25 12:04 srl295

Adding for reference: https://github.com/unicode-org/cldr/pull/4631

jenstroeger avatar Apr 24 '25 11:04 jenstroeger