next-translate icon indicating copy to clipboard operation
next-translate copied to clipboard

The t function of the useTranslation hook does not translate

Open YvhenPurik opened this issue 3 years ago • 3 comments

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

YvhenPurik avatar Apr 30 '21 07:04 YvhenPurik

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

vlad-elagin avatar Apr 30 '21 10:04 vlad-elagin

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;
  }
})

aralroca avatar Apr 30 '21 10:04 aralroca

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.

spock123 avatar Apr 15 '22 10:04 spock123