You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have changed the default value for localeStructure from {{lng}}/{{ns}} to be {{ns}}/{{lng}}. I find this neater for my use case (namespaces tend to be very long, I don't want to write them twice)
Here is my i18n.ts file
import NextI18Next from 'next-i18next'
import * as path from 'path'
import { I18NextContext } from '@/utils/types'
const NextI18NextInstance = new NextI18Next({
defaultNS: `common`,
defaultLanguage: `es`,
localePath: path.resolve(`public/static/translations`),
otherLanguages: [`en`],
fallbackLng: `en`,
localeStructure: `{{ns}}/{{lng}}`,
})
export const { appWithTranslation, withTranslation } = NextI18NextInstance
Here is the error I am getting
error - Error: Default namespace not found at /my-project/public/static/translations/es/common.json
at createConfig (/my-project/node_modules/next-i18next/dist/commonjs/config/create-config.js:117:19)
at new NextI18Next (/my-project/node_modules/next-i18next/dist/commonjs/index.js:57:48)
at eval (webpack-internal:///./src/utils/i18n.ts:11:29)
at Module../src/utils/i18n.ts (/my-project/.next/server/pages/_app.js:856:1)
at __webpack_require__ (/my-project/.next/server/pages/_app.js:23:31)
at eval (webpack-internal:///./src/pages/_app.tsx:18:70)
at Module../src/pages/_app.tsx (/my-project/.next/server/pages/_app.js:678:1)
at __webpack_require__ (/my-project/.next/server/pages/_app.js:23:31)
at Object.0 (/my-project/.next/server/pages/_app.js:891:18)
at __webpack_require__ (/my-project/.next/server/pages/_app.js:23:31)
Occurs in next-i18next version
7.0.1
Steps to reproduce
Use the same config as my own
Expected behaviour
I would have expected the default namespace to be as such: public/static/translations/common/es.json
The text was updated successfully, but these errors were encountered:
Yep, looks like the logic here just needs to be updated to use localeStructure instead of /${defaultLanguage}/${combinedConfig.defaultNS}. PRs welcome!
Describe the bug
I have changed the default value for
localeStructure
from{{lng}}/{{ns}}
to be{{ns}}/{{lng}}
. I find this neater for my use case (namespaces tend to be very long, I don't want to write them twice)Here is my
i18n.ts
fileHere is the error I am getting
Occurs in next-i18next version
7.0.1
Steps to reproduce
Use the same config as my own
Expected behaviour
I would have expected the default namespace to be as such:
public/static/translations/common/es.json
The text was updated successfully, but these errors were encountered: