Kozea / Pyphen

Hy-phen-ation made easy
https://courtbouillon.org/pyphen
Other
198 stars 24 forks source link

not working for norwegian? #36

Closed mircealungu closed 1 year ago

mircealungu commented 2 years ago

Would be nice if one would get a more explicit error when trying to instantiate for norwegian (i.e. 'no'):

>>> dic = pyphen.Pyphen(lang='no')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/blabla/.venvs/blabla/lib/python3.8/site-packages/pyphen/__init__.py", line 218, in __init__
    filename = LANGUAGES[language_fallback(lang)]
KeyError: None

Something along the lines of: use nn or nb instead.

liZe commented 2 years ago

Hi!

Using nn or nb, depending on the written language you want, is the solution. The fallback system for locales works with a language that has the same name for different countries (like en_US and en_GB) not for languages that have different names but are used in the same country (like nn_NO and nb_NO).

Is this behavior OK for you?