Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plural handled incorrectly in translations on report pages #37

Open
Newbytee opened this issue Dec 14, 2019 · 2 comments
Open

Plural handled incorrectly in translations on report pages #37

Newbytee opened this issue Dec 14, 2019 · 2 comments

Comments

@Newbytee
Copy link
Contributor

On the report page of all games that have more than 1 report the translation is incorrectly used when describing the amount of reports that have been created for it. Instead of actually using the plural form of "report", it merely appends an "s" to it which is not how plural works in Swedish. I have only been able to verify this in Swedish, however it seems to do the same in other languages that use the Latin alphabet, or a variant thereof.

image
This text should be 29 rapporter

@bdefore
Copy link
Owner

bdefore commented Dec 14, 2019

Thanks @Newbytee for formally making an issue for this.

Currently ProtonDB uses the English-only pluralize library, which far as I can read does not have an internationalized strategy for counting.

Mozilla is guiding folks to use Intl.PluralRules for this. Its lack of support on Safari would mean I'd want to also find a polyfill, for which there are a handful. There's another article from them on this more broadly as well as this more robust chart that tries to enumerate the variance across even more languages.

From what I'm gathering of that documentation it looks like it would impact our localization bundles towards this example for all cases that may be pluralized:

"misc": {
  "reports": {
    "zero": "No reports",
    "one": "1 report",
    "two": "2 reports",
    "few": "(n) reports",
    "many": "(n) reports"
  }
}

I'd rather not build-my-own on this and am hoping there's a library that will suffice, ideally one that hooks into the broader i18next engine I'm already using. Here is their take on it, which looks uncomfortably ad hoc / unfinished to me. It leans on adding along with {key}, a {key}_plural and {key}_interval node which relies on semicolon-delimited expressions for the various pluralization categories.

@basxto
Copy link

basxto commented Feb 22, 2020

Pluralize might need something like this?

pluralize.addIrregularRule('rapport', 'rapporter')
pluralize.addIrregularRule('Bericht', 'Berichte')

Or something like that?:

pluralize.addIrregularRule(t('report'), t('reports'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants