Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Is it safe to use reactI18nextModule on the server? #375
I didn't find much documentation about
Would you mind explaining how the instance would be tied to a specific request?
react-i18next does not solve the problem of having an i18n instance per request fixed to the language of that user...this is done by eg. https://github.com/i18next/i18next-express-middleware (same exists for koa and others)
also checkout the samples for next and razzle:
the reactI18nextModule is just taking the i18next instance (i18next itself) https://github.com/i18next/react-i18next/blob/master/src/context.js#L29 (basically the global i18next instance - not the one from request)
eg. for next.js:
we use initialProps: https://github.com/i18next/react-i18next/blob/master/src/context.js#L29
has entry point for server using the one on request: https://github.com/i18next/react-i18next/blob/master/example/razzle-ssr/src/server.js#L35
Ok I see, it's in fact a global: https://github.com/i18next/react-i18next/blob/master/src/context.js#L11
If what I say is correct it could make sense to make it clear in the documentation.