question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom pluralization rule is not working

See original GitHub issue

Reporting a bug?

Hi, I am trying to use custom pluralization function but it seems it is not working as expected:

The result is:

<p>1 машина</p>
<p>2 машины</p>
<p>4 машины</p>
<p>12 машины</p>
<p>21 машины</p>

Expected behavior

<p>1 машина</p>
<p>2 машины</p>
<p>4 машины</p>
<p>12 машин</p>
<p>21 машина</p>

12 and 21 result is wrong.

Reproduction

https://github.com/RollingTL/Testing-intlify-vue-i18n-next-custom-pluralization

System Info

Mac OS

Screenshot

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
FADL285commented, Sep 17, 2022

The problem is still found instead of ‘pluralizationRules’ as in documentation it should be ‘pluralRules

or change the code to be pluralizationRules

1reaction
RollingTLcommented, Jan 16, 2022

After reading sources I have found the problem Instead of pluralizationRules as in documentation the option should be pluralRules.

const i18n = createI18n({
  locale: 'ru',
  // the custom rules here ...
  **pluralRules**: {
    ru: customRule
  },
  messages: {
    ru: {
      car: '0 машин | {n} машина | {n} машины | {n} машин',
      banana: 'нет бананов | {n} банан | {n} банана | {n} бананов'
    }
  }
})

It is necessary to change documentation to fit source or source to fit documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to declare custom Pluralization Rules vue-i18n Vue 3?
I've quickly looked into the sources of vue-i18n and noticed that there are both pluralRules and pluralizationRules with the same type.
Read more >
Pluralization | Vue I18n
Custom Pluralization​​ Such pluralization, however, does not apply to all languages (Slavic languages, for example, have different pluralization ...
Read more >
Pluralization | Vue I18n
Custom pluralization​​ Such pluralization, however, does not apply to all languages (Slavic languages, for example, have different pluralization ...
Read more >
Plural Localization Formatter - Unity - Manual
The Plural Localization Formatter supports cardinal pluralization rules to choose different text. A full list of the plural rules per locale ...
Read more >
Intl.PluralRules - JavaScript - MDN Web Docs
Chrome Edge PluralRules Full support. Chrome63. Toggle history Full support. Edge18. Tog... PluralRules() constructor Full support. Chrome63. Toggle history Full support. Edge18. Tog... resolvedOptions Full support....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found