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.

[react-i18n] Pluralization should wait until the locales translations have loaded

See original GitHub issue

Overview

Originally raised over Slack due to this support issue, I noticed that we load in en translations before the selected locales translations:

image

When using pluralization, for specific count values (the variable for this is PLURALIZATION_KEY_NAME in the Quilt repo) we’ll receive back the fields “few” or “many”. Because we’ve yet to load in the locale-specific translations, we’ll default to the already loaded in en translations. With pluralization the “few” and “many” keys (specific to cs and pl locales) won’t exist in en causing the app to crash.

Screen Shot 2020-11-25 at 4 08 08 PM

My proposal is to investigate how we can also fallback on the en pluralization if that locales translations haven’t been loaded in yet. It looks like this can take place somewhere here.

Consuming repo

What repo were you working in when this issue occurred?

facebook-ads

Area

  • Add any relevant Area: <area> labels to this issue

Scope

  • Is this issue related to a specific package?

    • Tag it with the Package: <package_name> label.

Checklist

  • Please delete the labels section before submitting your issue
  • I have described this issue in a way that is actionable (if possible)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jas7457commented, Aug 16, 2022

@movermeyer I can’t say I know much about that project or the changes that were needed for it, but I’m not working in web, I work on the Shopify Search & Discovery first-party app.

That project makes it sound like they did something specific to web, not something that fixes the root problem for @shopify/react-i18n.

0reactions
movermeyercommented, Aug 16, 2022

@jas7457 My understanding (though I never tested it) was that this was fixed by Bring Locale Specific I18N Builds Over The Finish Line project

Read more comments on GitHub >

github_iconTop Results From Across the Web

React localization with i18next - LogRocket Blog
The i18next framework expects us to handle the state of the app while waiting for the translation text to load from the backend....
Read more >
A Guide to React Localization with i18next | Phrase
If we were using a back-end to asynchronously load our translations in the example above, the Spanish (es) translations would never get loaded...
Read more >
React-i18next: Internationalization and translation ... - Lokalise
There is a translation file for each language. We will discuss how to develop translation files later in this tutorial. react i18n with...
Read more >
Step by step guide (v9) - react-i18next documentation
Now Page2 will be blank until the needed translation files were loaded.
Read more >
False warning about accessing t function before calling init #977
js:27 i18next::translator: key "xxx" for namespace "translation" won't get resolved as namespace was not yet loaded This means something IS ...
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