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.

after page reload , getting missingKey problem

See original GitHub issue

Question about react-i18next

Questions should be posted on StackOverflow

Before page reload , this is working well …

When i reload by key (F5 , or Ctrl+ F5) , and then this is not working well … You can see bugs in here . https://www.screencast.com/t/Q6JNPUCSJh https://www.screencast.com/t/j6JOG7A669Ub Not sure what is the problem … This is init function.

i18n.use(Backend)
    .use(LanguageDetector)
    .use(initReactI18next)
    .init({
        fallbackLng: 'en',
        debug: true,
        interpolation: {
            escapeValue: false, // not needed for react as it escapes by default
        },
        
        react:{
            wait : true
        }
    });

This is source code of side bar

import React from 'react'
import {Trans} from 'react-i18next';
export default {
  items: [
    {
      name: <Trans i18nKey="menu.dashboard"/>,
      url: '/test',
      icon: 'icon-speedometer',
    },
    {
      name: <Trans i18nKey="menu.calendars"/>,
      url: '/test',
      icon: 'icon-calendar'
    },
]
}

What is wrong in here ?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
jamuhlcommented, Apr 19, 2019

Your code. i18next.init is async…this code runs before init is done -> means that code runs outside of hook, HOC

0reactions
jamuhlcommented, Apr 19, 2019
i18next.init();
i18next.t('key'); // -> missing as init not yet done
i18next.language; // -> undefined as language not yet set as init is still running loading translations

<Trans i18nKey='key' /> // -> missing as not init yet

i18next.init({}, () => {
i18next.t('key'); // -> ok
i18next.language; // -> ok

withTranslations()(function() {
return <Trans i18nKey='key' />; // -> ok as Suspended
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve Missing Key Issues - VMware Docs
Under certain circumstances when using a standard key provider, the ESXi host cannot get the key encryption key (KEK) for an encrypted ...
Read more >
i18next missing key but other key was found - Stack Overflow
I suspect, you're calling the t function too early and are not waiting for the translations to be fully loaded.
Read more >
Launching course shows login page to provider's website or ...
IOS LEARN app - Launching course shows login page to provider's website or missing key missing key-pair-id query parameter or cookie value ...
Read more >
A Guide to React Localization with i18next | Phrase
If we were to load our app at this point, we would get an error telling us that “A React component suspended while...
Read more >
Configuration Options - i18next documentation
Helps finding issues with loading not working. ... calls save missing key function on backend if key not found. updateMissing.
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