in ssr when then namespace not exist in the selected resource/language this is false and render return null
See original GitHub issueDescribe the bug In ssr when then namespace not exist in the selected resource/language this is false and set ready in false.
const ready = !!language && namespaces.every(ns => props.i18n.hasResourceBundle(language, ns));
later when we want make render of the component, this line return null https://github.com/i18next/react-i18next/blob/11e23a4c482a3449ca1e664eedd745975957e3d6/src/NamespacesConsumer.js#L165
Occurs in react-i18next version I’m using “next-i18next”: “^0.31.0” who require “react-i18next@^9.0.4”.
my config is:
{
defaultLanguage: 'en',
otherLanguages: ['en-US', 'es-ES'],
ignoreRoutes: [
'/_next',
'/static',
'/reload',
'/uploads',
'/assets',
'favicon.ico',
],
detection: {
order: ['locale'],
},
customDetectors: [
{
name: 'locale',
lookup: (req, res, options) => {
const { locale } = res.locals; //locale set "es-ES" or "en-US" based on the domain.
return locale;
}
}
],
fallbackLng: ['en'],
debug: (process.env.DEBUG && process.env.DEBUG.indexOf('i18n') >= 0),
saveMissing: (process.env.DEBUG && process.env.DEBUG.indexOf('i18n') >= 0),
saveMissingTo: 'current',
}
To Reproduce
- start a new next project with nexti18next.
- configure your application to change your language on send one or other url
- run your app to start with language one.
- see how you have a nice ssr version of your page
- change the url to load the other language.
- ssr not happen.
Expected behaviour
- hasResourceBundle https://github.com/i18next/i18next/blob/master/i18next.js#L602 should return true when some namespace exist in the required language or the fallback language.
- this line should return true https://github.com/i18next/react-i18next/blob/v9.x.x/src/NamespacesConsumer.js#L49 if the previus condition is true
- translated component should be render in the server.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
type resources does not exist in namespace error
Open the project properties (right click > properties) · Click the Resources section · In the Add Resource drop down select Add Existing...
Read more >next-i18next - npm
The easiest way to translate your NextJs apps.. Latest version: 13.0.2, last published: 14 days ago. Start using next-i18next in your ...
Read more >Taking the new Chromium WebView2 Control for a Spin in .NET
This is Part 1 of a two part article that gives an overview of the new WebView2 Web browser control that is based...
Read more >Web on Servlet Stack - Spring
When it returns false, the DispatcherServlet assumes the interceptor itself has taken care of requests (and, for example, rendered an appropriate view) and...
Read more >Server Rendering with React and React Router - ui.dev
There was no dynamic content, and there definitely wasn't any JavaScript. Just pages and links. Not long after that, someone had the great...
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
thanks for your help, meanwhile I will create the empty namespaces files to not break the render.
the community over at next-i18next is large…i’m rather sure they will help you finding the cause.
But like said…while this seems like a problem…it’s not - in production you do not use saveMissing and es-ES and en-US are fully translated