I've got a problem when a I try to start my next application where basically one module called "@next-translate-root/locales" can't be found.
That's my error log:
$ yarn dev
yarn run v1.22.4
warning package.json: No license field
$ next dev
ready - started server on http://localhost:3000
info - Using external babel configuration from E:\estudos\next\nextjs-chakraui-pokedex\babel.config.js
error - ./src/pages/_app.tsx:28:32
Module not found: Can't resolve '@next-translate-root/locales'
26 | skipInitialProps: true,
27 | // @ts-ignore28 | loadLocaleFrom: (l, n) => import(
@next-translate-root/locales/${l}/${n}).then(m => m.default),
| ^
29 | // @ts-ignore
30 | });
31 | // @ts-ignore
That's my next.config.js:
const nextTranslate = require("next-translate")
module.exports = {
...nextTranslate(),
}
And my i18n.json:
{
"locales": ["en-US", "pt-BR"],
"defaultLocale": "pt-BR",
"pages": {
"*": ["common"]
}
}
@beavanzi @next-translate-root is an alias of the root path, not a dependency. You should create a folder /locales with your translations, or define the loadLocaleFrom in the configuration.
More info here: https://github.com/vinissimus/next-translate/tree/1.0.0#create-your-namespaces-files
Hope it helps
Thank you!
Most helpful comment
@beavanzi
@next-translate-rootis an alias of the root path, not a dependency. You should create a folder/localeswith your translations, or define theloadLocaleFromin the configuration.More info here: https://github.com/vinissimus/next-translate/tree/1.0.0#create-your-namespaces-files
Hope it helps