fnando / i18n

A small library to provide the I18n translations on the JavaScript.
https://fnando.github.io/i18n/
MIT License
169 stars 20 forks source link

Bug: pluralize utility does not respect enableFallback: true options #99

Open eugenet8k opened 3 months ago

eugenet8k commented 3 months ago

Description

A follow up to https://github.com/fnando/i18n/issues/39.

How to reproduce

    i18n = new I18n({
      enableFallback: true,
      en: {
        labels: {
          name: 'Name',
          total: {one: '%{count} name', other: '%{count} names'},
        },
      },
      ru: {
        labels: {
          name: 'Имя',
          total: {one: undefined, other: undefined},
        },
      },
    })

What do you expect

> i18n.t('labels.total', {count: 5, locale: 'ru'})

5 names

What happened instead

> i18n.t('labels.total', {count: 5, locale: 'ru'})

[missing "ru.labels.total.other" translation]