Receiving different locale on index, compared to other pages. #1383
-
Hi, I am having this issue where the default language on index is the Additionally I wonder if it is possible to have no default language but just fallback language? So user is redirected to fallback if browser language does not match any of the locales. here is my next-i18next.config.js const path = require("path");
module.exports = {
i18n: {
locales: ["tr", "en"],
defaultLocale: "tr",
fallbackLng: "en",
ns: ["common"],
},
localePath: path.resolve("./public/locales"),
}; When I visit export async function getServerSideProps({ locale }: NextPageContext) {
console.log("locale: " + locale);
return {
props: {
...(await serverSideTranslations(locale as string, ["common"])),
},
};
} When I visit export async function getServerSideProps({ query, locale }: NextPageContext) {
console.log("locale: " + locale);
return {
props: {
error: query.error || "NotFound",
...(await serverSideTranslations(locale as string, ["common"])),
},
};
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This functionality is entirely driven by NextJs itself. I suggest you post on the NextJs repository. |
Beta Was this translation helpful? Give feedback.
This functionality is entirely driven by NextJs itself. I suggest you post on the NextJs repository.