#next-i18next Internationalization Configuration Issue

2 messages · Page 1 of 1 (latest)

echo comet
#

Hi, I'm using next-i18next for internationalization. I want to configure the language, including the region, like de-DE, but when I switch the language to German, the URL shows like this: de-DE/privacy-policy. However, I want it to show de-de/privacy-policy (with the region in lowercase in the URL). Additionally, when I set the locales in the config file like this: locales: ["en-US", "de-DE"], the translation files are loaded correctly. But when I set it like this: locales: ["en-us", "de-de"], the translations are not loading. I need help fixing this issue. Here is the config file.


module.exports = {
i18n: {
defaultLocale: "en-us",
locales: ["en-us", "de-de"],
// localeLowerCase: true,
},
fallback: true,
nonExplicitSupportedLngs: true,

localePath:
typeof window === 'undefined'
  ? require('path').resolve('./public/locales')
  : './public/locales',
reloadOnPrerender: process.env.NODE_ENV === 'dev'

};

here is locale folder structure
public/
└── locales/
├── en-us/
│ └── common.json
└── de-de/
└── common.json

here how i am using this
import {PrivacyPolicy} from "@pages";
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
export default PrivacyPolicy;
export async function getStaticProps({ locale }: {locale:any}) {

const lacales =  await serverSideTranslations(locale, [
  'privacy-policy',
])
console.log("lacales", lacales)
return {
  props: {
   ...lacales,
    // Will be passed to the page component as props
  },
}

}

native emberBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)