Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of nextjs integration without internationalized routing #1967

Open
fain182 opened this issue Jul 4, 2024 · 1 comment
Open

Example of nextjs integration without internationalized routing #1967

fain182 opened this issue Jul 4, 2024 · 1 comment

Comments

@fain182
Copy link

fain182 commented Jul 4, 2024

I need to translate a webapp that will not have the language in the url (example: domain.com/contact will be the url of the contact page for all the languages).

This is a nextjs application, and the lingui example uses a lot router.locale to make everything works, but if I disable the nextjs i18n routing, the router.locale is no more accessible.

I tried to replace the router.locale with a function that auto-detect language, but if it is simple to make it work on server side using headers of the request, or on client side using the navigator.language, it's quite complicated to make it work in the useLinguiInit hook that is used in both the environments.

Do you have any suggestion or examples?

@fain182 fain182 changed the title Example of nextjs integration without internazionalized routing Example of nextjs integration without internationalized routing Jul 4, 2024
@thekip
Copy link
Collaborator

thekip commented Jul 6, 2024

Detect it on the server side and pass it as prop from getServerSideProps on each page.

BTW it's more nextjs realted question than lingui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants