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.

Validated plural rules and warn about missing ones

See original GitHub issue

Describe the bug When plural for some language is not translated yet or missing particular form for a given value, the empty string is returned

To Reproduce

import { Trans } from "@lingui/react"

export default function App() {
   return <Plural value={booksNum} other="# books" />
}

Have this extracted with en as a sourceLanguage, then switch to eg. cs.

Expected behavior For booksNum < 5 I would expect that other form will be used as a fallback if one/few is missing in translation. When the booksNum >= 5 it works correctly and result is 5 books even with cs locale.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
tricoder42commented, May 31, 2019

As there’s no easy way to determine “fallback” rule, let’s simply raise validation warning/error when message is missing:

  1. In macro, validate plural rules based on linguiConfig.sourceLocale value.
  2. In lingui compile --check, validate plural rules for each locale. This will be tricky, as we need to parse message and find plural formatters. On the other hand, we need to parse message anyway to check there’re no syntax errors.
  3. In loader, validate plural rules for specific locale (similar to lingui compile --check)
  4. Finally in core, show warning about missing plural rule. This is a fallback warning for anyone who doesn’t use macros.
0reactions
danielkczcommented, Dec 11, 2020

But if the product (even free) doesn’t satisfy my needs I have absolute right not to use it, correct?

Sure, and you have also an absolute right to stay silent about it and move along. Screaming “this is bad, I am going away” is useful how exactly? I would recommend you trying to contribute to open-source software to get the feeling of how depressing it is when someone says you are doing a bad job in your spare time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plural Rules - Unicode CLDR
See Language Plural Rules for the categories for each language in CLDR. ... The categories are verified by looking a minimal pairs: where...
Read more >
Rails plural rules for translations - Stack Overflow
I faced with an issue that doc says about plural forms and they are different for each language. I expected that rules are...
Read more >
Resolve validation errors - Azure DevOps Services
Fix errors reported upon importing a process to support customization of tracking work in Azure DevOps Services.
Read more >
Checks and fixups — Weblate 4.15.1 documentation
Check fails if the number of \n literals in translation do not match the source. Missing plurals . Summary. Some plural forms are...
Read more >
Disability Language Style Guide
NCDJ Recommendation: All the terms are acceptable, although, because they are not widely used, an explanation is required for a general audience. AP...
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