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
Support for 'default' locale #1679
Comments
Sorry, I don't think I understand your question. Can you explain further? |
|
Ah OK, got it. I'm not convinced that using a non-standard "locale" like That being said, I would be fine with merging support for this, as it is indeed in the official NextJs docs, for better or worse. We would need to update createConfig to ignore non-standard locales. PRs welcome. |
Thanks, I am in the same boat, using the "default" language as recommended in the official docs, forwarding "/" to "/some_locale" depending on the browsers language. I now get an ENOENT error loading the non existing default language. Is there a simple preliminary fix for now? Andreas |
I've tested it, first you have to create default folder inside /public/locales/ with a common.js file inside (I think that it works if its empy, if it crash just duplicate this common.js file as your common.js prefered locale default). Then update your getStaticsProps func:
I'm using TS so I had to edit it a little bit. Keep in mind you must have the _middleware file configured as specified in the nextjs i18n docs. My next.config file:
And my next-i18next.config file:
CC @isaachinman |
Support for Prefixing the Default Locale will be included in the next release. |
included in v11.1.1 |
Any documentation on this feature or is it as before? |
there is no extra config needed. it just ignores the language "default" when configured in the i18n config: f9a6539#diff-28136a2e354d423cb0c0191cef90624f802ee7921bf0aacbb9bfd3e5f2b1f501R226 |
Awesome. Thanks for the update, Adraino! |
https://nextjs.org/docs/advanced-features/i18n-routing#prefixing-the-default-locale
as NextJS team suggest, it is better to use 'default' that fallback to actual main language for some case.
One of those case is to have locale routing always on URL.
For now to use it I need to create a local file for 'default'.
Can we somehow map it to 'en'?
The text was updated successfully, but these errors were encountered: