Kozea/Pyphen

not working for norwegian?

mircealungu opened this issue · 1 comments

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

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?