-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature/migrate nexti18next to nextintl #1967
Feature/migrate nexti18next to nextintl #1967
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
- detects locale from browser settings and adds locale to url (if missing) - sets NEXT_LOCALE cookie for detected language - sets up static paths for index route
- also uses a standard arrow function for getStaticProps throughout
4c00e1c
to
80399ad
Compare
ddb3d11
to
b6abe89
Compare
From what I can tell, there seems to be some caching mechanism. Let's say I visited After changing the language to German ( Perhaps b7714f3 fixes this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After switching to another language, the back button within the project or the browser (to go back to main map) just triggers a change of language, back to the original one, instead of the expected functionality, only second click takes the user back. Language stays now again the original one.
To replicate:
Go to WebApp -> Select any project -> switch to another language -> use any back button
aac6bb4 will take care of the back button within the project snippet. The browser back action is part of a larger issue seen even on www1.plant-for-the-planet.org, and not related to translations. We'll need to think about how we want to resolve that without breaking the loading of site data / map on the project details page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While now the issue of not directly going back to the main map has been resolved for the included button (for the browser it still remains), the language still changes back.
How to replicate:
Select any project -> Switch language -> hit the back button provided by the App (not the browser)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality looks good for me now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
a. Replaces
useTranslation
hook withuseTranslations
, and only 1 namespace can be referred to at a time.b. Replaces
Trans
component witht.rich
c. Replaces
language
withlocale
from theuseLocale
hook provided by next-intl.d. Removes usage of
ready
, as it was not neededcreateMiddleware
from next-intl, as the necessary folder structure (due to multitenancy) was not supported out of the box.a. Replaces {{}} with {} syntax to interpolate variables
b. Changes complex translation strings (formerly used by the
Trans
component) as per next-intl syntax, which allows us to format rich text with custom tags and map them to React componentsc. Updates pluralization syntax
d. Adds external namespace to wrap strings within the file
e. Removes arrays from existing json as they are not supported by next-intl.
getStaticProps
.router
to make code clearer, usingnext/link
instead of click handler for regular routingReason for change
next-intl
can support both routers.Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
useTranslation
touseLocale
for better locale management.Documentation