danhper / python-i18n

Easy to use i18n library for Python
https://pypi.python.org/pypi/python-i18n
MIT License
228 stars 45 forks source link

Pluralized strings seem broken #18

Closed ZRunner closed 4 years ago

ZRunner commented 4 years ago

According to #8, you can set pluralized strings in yaml files easily, without having to add them with a function like in the doc.

So I tested with the following en.yml file:

en:
  hi: Hello world !
  test:
    zero: "No follower"
    one: "1 follower"
    other: "%{count} followers"

And then the following Python code:

import i18n

# configuring i18n [...]

print(i18n.t('hi'))
print(i18n.t('test', count=0))

The "hello world !" is correctly displayed, but the "No follower" isn't translated, thus only printing "test". Having a print(i18n.t('test.zero')) however fixes the issue, but it's not really the expected way to do it lol.

Package version: 0.3.7 Python version: 3.8.5

danhper commented 4 years ago

Hi, thanks for the report. After double-checking, it seems that the library was expecting many instead of other. Both should now be supported, please try with the latest version.