epic-stack
epic-stack copied to clipboard
Add i18n to epic stack
I think internationalization is common nowadays, and most projects should start with it since implementing it in mature projects is costly.
In this discussion, it is said that i18n is planned, but it is still not implemented. There is this example project that can be migrated to this project.
I'm open to looking at a PR for this, but I'm still not certain I'm ready to commit to anything here beyond an example.
@kentcdodds what about having a do you want to include i18n question during the epic stack CLI setup?
@kentcdodds I'm trying to add remix-i18next with the middleware to the Epic stack for the PR.
As soon as I add the unstable_middleware=true flag to the react-router config without changing anything else, I get this error:
Unexpected Server Error
Error: Unable to create initial `unstable_RouterContextProvider` instance. Please confirm you are returning an instance of `Map<unstable_routerContext, unknown>` from your `getLoadContext` function.
Error: TypeError: init is not iterable
The error comes from the index.js file in the root of the project that gets called from the dev command. So anyone trying to use the epic stack with the middleware should be having the same issue. Any idea why?
@sergiodxa, maybe you know? The same is happening with the Vercel Plugin.
Hi, the reason is that in middleware mode getLoadContext returns a unstable_InitialContext instead of AppLoadContext.
This: https://github.com/epicweb-dev/epic-stack/blob/4e6532d08219cef41299615ad7556b205aa0b77d/server/index.ts#L203 needs to be updated ala https://reactrouter.com/how-to/middleware#custom-server-with-getloadcontext
Thanks @cha0s for the hint. I will give it a try!
No problem!
Just be aware that anywhere using the context (e.g. app/routes/_seo+/sitemap[.]xml.ts) will need to be updated in tandem with this change, or will break!