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.

initialI18nStore is empty

See original GitHub issue

Hi @isaachinman! I’m playing with your plugin and am thinking of replacing my custom i18next integration with it – this will be so awesome!

What I’ve noticed after a switch is that initialI18nStore does not contain any strings at the point when the client-side app is being initialized. Here’s what I see in the page source:

__NEXT_DATA__ = {
  props: { initialI18nStore: { en: {} }, initialLanguage: "en", pageProps: {} },
  page: "/hello",
  query: {},
  buildId: "development",
};
__NEXT_LOADED_PAGES__ = [];
__NEXT_REGISTER_PAGE = function(r, f) {
  __NEXT_LOADED_PAGES__.push([r, f]);
};

Both client-side and server-side translations work fine, so there is no flickering between i18n keys vs values etc. However, because the namespaces are not in initialI18nStore, redundant requests like static/locales/en/common.json are being made from the client right after the page load. This can potentially increase time to interactive, so I’ve decided to open this issue. WDYT?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kachkaevcommented, Dec 3, 2018

Hi @isaachinman and sorry for a delay with the response. The problem is in my side project, so I’ll be able to study it on an evening or during the weekend. I still rememberer about it and am very interested in digging out the cause.

0reactions
kachkaevcommented, Dec 9, 2018

The reason why I was getting an empty store in the first project was simple: I was importing withNamespaces directly from react-i18next instead of from my local ./i18n.js😅

Hope this investigation helps future users 😉 Please not that it’s react-i18next@0.8.0 at the time of writing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

initialI18nStore is empty · Issue #19 · i18next/next ... - GitHub
Hi @isaachinman! I'm playing with your plugin and am thinking of replacing my custom i18next integration with it – this will be so...
Read more >
Next-i18next serverSideTranslations initialI18nStore missing ...
I would like to find in the initialI18nStore all the locales defined by me in the config. Why it isn't showing all of...
Read more >
How to use the i18next.isInitialized function in i18next - Snyk
toJSON = () => null // do not serialize i18next instance and send to client const initialI18nStore = {} req.i18n.languages.
Read more >
All side optimized Next.js translations (a next-i18next guide)
if (opt.emptyI18nStoreStore) { // let the client fetch the translations props._nextI18Next.initialI18nStore = null }
Read more >
Where does initialI18nStore come from with react-i18next ...
Coding example for the question Where does initialI18nStore come from with ... React TypeError: Cannot use 'in' operator to search for 'length' in...
Read more >

github_iconTop Related Medium Post

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