-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
i18n support is not compatible with next export. (SSR - NextJS 10) #20616
Comments
Closing as duplicate of #18318 |
But no one came to a conclusion on this topic. |
I need to deploy this today, what can i do? |
You just closed that issue report too |
If you are deploying on a platform that supports Next.js like Vercel you do not need to call |
I understand. |
I just need the SSR working well with a good performance. In using NEXT JS to deal better with SEO. |
i had similar problem. can anyone tell me how to fix it? |
Unfortunately not. I think it's really bad that one of the main tools in NEXT doesn't support something that important. simply shameful |
@lucasReghiniM you might have a look at: https://dev.to/adrai/static-html-export-with-i18n-compatibility-in-nextjs-8cd |
Can anyone tell me if it works? |
@bakydev for sure it works... And a production example of localistars.com here: https://github.com/localistars/localistars-landing |
cool, I'm gonna try out, btw thank you for the fast answer |
Hello I show you my soluce with only i18n-js, I know is closed // i18n.ts
import i18n from "i18n-js";
import en from "./en.json";
import fr from "./fr.json";
const localeEnable = ["fr", "en"];
const formatLocale = () => {
const { language } = window.navigator;
if (language.includes("en")) return "en";
if (language.includes("fr")) return "fr";
if (!localeEnable.includes(language)) return "en";
return "en";
};
// Set the key-value pairs for the different languages you want to support.
i18n.translations = {
en,
fr,
};
// Set the locale once at the beginning of your app.
i18n.locale = "en";
const useTranslate = () => {
return (t: string) => {
if (typeof window !== "undefined") {
i18n.locale = formatLocale();
}
return i18n.t(t);
};
};
export default useTranslate;
// home.tsx
import useTranslate from "../locales/i18n";
const t = useTranslate();
return (<p>{t("idstring")}</p>) |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
i18n support is not compatible with next export.
NextJS dont run the deploy with i18n
Im using nextJS 10, and the main reason that i choose next 10, is that i can do SSR and use the i18n.
Internationalized Routing its a new next js 10 feature and have a page only to tha feature.
But when im gonna do a deploy, this error appears: i18n support is not compatible with next export.
Theres nothing about this in internationalized routing page.
My code
next.config.js
I created a translate archive that make the condition with next router
obs: PT and EN are JSON files with text
And the i just use in my project like a function:
{traducao().homeText.button_text}
Work well, recognizes the browser language and switch.
Im using deploy script
Steps to reproduce
Expected behavior
Its just suppose to work fine and Deploy normal.
Screenshots
System information
The text was updated successfully, but these errors were encountered: