aralroca / next-translate

Next.js plugin + i18n API for Next.js 🌍 - Load page translations and use them in an easy way!
MIT License
2.62k stars 207 forks source link

The t function of the useTranslation hook does not translate #602

Open YvhenPurik opened 3 years ago

YvhenPurik commented 3 years ago

the t function of the useTranslation hook does not translate, it only returns the locales/en/common.json key, is it possible or is it because I have non-standard page names prefixed with .page? like this _app.page.js

Here are my settings

Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2021-04-30 Π² 10 52 50 Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2021-04-30 Π² 10 53 11 Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2021-04-30 Π² 10 53 22
vlad-elagin commented 3 years ago

Aren't you supposed to pass whole next.config.js to nextTranslate? It's stated here

aralroca commented 3 years ago

Instead of:

const nextTranslate = require('next-translate')

module.exports = {
  webpack: (config, { isServer, webpack }) => {
    return config;
  },
  ...nextTranslate()
}

Try:

const nextTranslate = require('next-translate')

module.exports = nextTranslate({
  webpack: (config, { isServer, webpack }) => {
    return config;
  }
})
spock123 commented 2 years ago

I am having precisely same issue. If I have pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js'],, in next.config.js , translations are not working. As soon as I revert back to default pageExtensions, it works again.