Hi! I want to thank you for this awesome library!
I just started a new next.js project with Next.js template for Typescript, ESlint and Jest then I configured next-translate following the documentation and after finished, when I start the app, the texts aren't translated as expected.
{
"locales": ["en", "fr"],
"defaultLocale": "en",
"pages": {
"*": ["common"],
"/": ["common"]
}
}
const nextTranslate = require('next-translate');
module.exports = nextTranslate();
locales and add inside two subfolders en and fr then create a file named common.json inside each subfolder{
"welcome": "Welcome"
}
pages/index.tsx, add the code below somewhere{/* import useTranslation from next-translate/useTranslation */}
{/* const { t } = useTranslation() */}
<h1 className="title">
{t("common:welcome")}
</h1>
I expect the result to be Welcome but it is common:welcome
OS: macOS 10.15
Browser: Firefox
The version of Next.js: 10.0.4
The version of Node.js: 10.22.1
Start: yarn dev
Thanks to report it @tericcabrel The steps you describe seem right, I'll see what's going on 馃憤
@tericcabrel It worked well for me with react 17.
"dependencies": {
"next": "latest",
"next-translate": "1.0.1",
"react": "17.0.1",
"react-dom": "17.0.1"
},
I have to say that there is a typo in the steps, the file next-config.js has to be called next.config.js.
Hope it helps.
Yess! It works for me! Thank you for your help