i18next / next-app-dir-i18next-example-ts

Next.js 13/14 app directory feature in combination with i18next
https://locize.com/blog/next-app-dir-i18n/
117 stars 29 forks source link

useTranslation without passing the lang param #6

Closed NourAlzway closed 7 months ago

NourAlzway commented 7 months ago

how to use the useTranslation without passing the lang param every time you want to use it, for example, if you have nested components like this

and you want to use useTranslation in the SubmitButton.tsx, but you don't have the lang param if you don't drill down the props.

adrai commented 7 months ago

not possible right now without lng... and depending on if its client or server side, also a react context can't be used...

adrai commented 7 months ago

Here an alternative: https://github.com/i18next/next-app-dir-i18next-no-locale-path-example