Reputation: 11
I have a nextjs app which uses next-i18next library for internationalization. I don't manage to find a way to get the current language on server-side in a component which is not a page.
The current language can be retrieved on server side from the request object passed to getInitialProps, but getInitialProps is available only for pages. A solution would be to get the language in the page component and to send it down to my component via props, but I don't find it very beautiful.
Is there another way to do it?
Upvotes: 1
Views: 1446
Reputation: 255
You can solve this problem by adding a prop to the component you are using.
Upvotes: 0