-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use i18next with app folder and without locale in url #12
Comments
This example is based on having the locale in the url (like the old next.js i18n feature) If you only have client side rendering then you can detect the language with the browser-languageDetector plugin or similar and don't need to have the locale in the url. |
Thank you @adrai for your answer ! I understand the approach better now. What approach can you advise us, knowing that it is indeed recommended to manage this on the server side ? If i custom the middleware, i just have to set Thank you again for your work. |
Beside the client side only approach idk. |
Here a "hacky" example that tries to not rely on the locale to be in the url: https://github.com/i18next/next-13-app-dir-i18next-no-locale-path-example |
@adrai Oh okay, thank you for your POC, I took the time to do some tests, but i have 2 errors in webpack: Also, i have another strange things:
I tried to investigate but it seems really complicate to understand where is the problem |
Like said... hacky... and btw: it's just a warning |
Yes i know, but it's not a render issue? |
You may ask the vercel/next.js team |
Because the languages are not synced the backend renders first with the fallback version and then it renders again with the language detection making both version not match. You can use dynamic to import then and remove ssr. Put I still haven't found a solution that doesn't force me to avoid doing dynamic imports all over the place. If you get any farther plz share |
I'm looking for the same thing... I found this: https://github.com/QuiiBz/next-international?tab=readme-ov-file#rewrite-the-url-to-hide-the-locale If you use |
Question
I can't use this example without locale in the router.
I have to mask the locale in URL to avoid override the website language when url is sharing.
It's not working when i remove the (lng) folder in the /app directory.
Also, i think why we use the redirect on /${lng} for locale switcher instead of the changeLanguage function of i18n ?
I don't really understand this approach..
Thank you for your help :)
The text was updated successfully, but these errors were encountered: