aralroca / next-translate

Next.js plugin + i18n API for Next.js 🌍 - Load page translations and use them in an easy way!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adapt getT to Next app router

PhilipAngelinNE opened this issue · comments

What version of this package are you using?
2.0.5

What problem do you want to solve?
In the pages router you could get locale from the props functions and use the getT function with that. But Next no longer passes a locale to page components (RSC), so you have no way to translate with your helper function.

The function doesn't seem to work in app router anyway, I can't get it to translate anything like this:

const t = await getT('sv', 'common');
console.log(t('test')); // Should return 'Test' which I have in the /locales directory.

What do you think is the correct solution to this problem?
No idea frankly, I don't have that expertise.

Are you willing to submit a pull request to implement this change?
No.