I'm currently extending a storefront that uses next.js, but I can't find out how to add a translation namespace that is recognized by react-i18next. The shop already had a next.i18next.conf.js file, where I added my namespace (customization):
module.exports = {
i18n: {
defaultLocale: 'de',
locales: ['en', 'de', 'pl'],
returnObjects: true,
fallbackLng: 'de'
},
defaultNS: 'common',
ns: ['common', 'homepage', 'checkout', 'customer', 'products', 'collections', 'customization'],
localeStructure: '{{lng}}/{{ns}}',
debug: process.env.NODE_ENV === 'development',
/** To avoid issues when deploying to some paas (vercel...) */
localePath: typeof window === 'undefined' ? require('path').resolve('./public/locales') : '/locales',
reloadOnPrerender: process.env.NODE_ENV === 'development',
interpolation: {
escapeValue: false
}
};
But when I try using it with useTranslation:
const { t } = useTranslation('customization');
I get this error:
Argument of type '"customization"' is not assignable to parameter of type '"common" | "homepage" | "checkout" | "customer" | "products" | "collections" | $Tuple<"common" | "homepage" | "checkout" | "customer" | "products" | "collections"> | undefined'.
How can I make react-i18next recognize the new namespace? The json file is aready present in the correct localization directory and I couldnt find any other place in the whole project where these types are defined. Can anyone help?