Locales loaded, but missing key for namespace error (for all keys)
See original GitHub issueI am unable to get any of the translations working – for all {key} and {ns}, get this error:
[next-translate] "{key}" is missing in current namespace configuration. Try adding "{key}" to the namespace "{ns}".
next: ^12.0.8 next-translate: ^1.3.3
i18n.js
modules.export = {
locales: ['nb', 'nn', 'en'],
defaultLocale: 'nb',
loadLocaleFrom: (lang, ns) =>
import(`./public/locales/${lang}/${ns}.json`).then((m) => m.default),
pages: {
'*': ['common', 'header', 'mainMenu'],
'/': ['welcome'],
// some more
}
}
_app.js
import i18nConfg from '../../i18n';
// MyApp
export default appWithI18n(MyApp, i18nConfig);
pages/index.tsx
const Index = () => {
const { t } = useTranslation('welcome');
return (
<div>
<div>{t('title')}</div>
<div>{t('welcomeText')}</div>
</div>
);
}
export default Index
public/locales/nb/welcome.json:
{
"title": "Velkommen",
"welcomeText": "Dette er din hjemmside"
}
Messages: next-translate - compiled page: / - locale: nb - namespaces: common, header, mainMenu, welcome - used loader: getInitialProps
console error:
[next-translate] "welcome:title" is missing in current namespace configuration. Try adding "title" to the namespace "welcome".
[next-translate] "welcome:welcomeText" is missing in current namespace configuration. Try adding "welcomeText" to the namespace "welcome".
what am I doing wrong ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Locales loaded, but missing key for namespace error ... - GitHub
I am unable to get any of the translations working -- for all {key} and {ns}, get this error: [next-translate] "{key}" is missing...
Read more >i18next with namespace does not fetch expected translation file
As you can see, I want to load my translation files over http (which are served by a node server and this works)....
Read more >i18next - initialization
The current locale to set and looked up in the given cookie parameter. ... If turned on, all missing key/values will be sent...
Read more >Namespaces - i18next documentation
Namespaces are a feature in i18next internationalization framework which allows you to separate translations that get loaded into multiple files.
Read more >Authenticate access to Azure Event Hubs with shared access ...
Any client that has access to name of an authorization rule name and one of its signing keys can generate a SAS token....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

having the same problem. if the json file for one of the namespaces is missing all of them will become
null.locales/en/common.jsonexistslocales/en/home.jsondoes not existthis will end up in:
but instead only
homeshould benull.@aralroca https://github.com/vinissimus/next-translate/pull/794