-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat: app router [CFISO-1826] #183
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
f969fff
to
4656dd7
Compare
4656dd7
to
1836883
Compare
1836883
to
8ced7f3
Compare
Why did you move from |
}: TranslationProviderProps) { | ||
const i18n = createInstance(); | ||
|
||
initTranslations({ locale, namespaces, i18nInstance: i18n, resources }); |
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.
initTranslation
is async. So, the instance might not be initialized on render. Is that an issue?
src/components/features/language-selector/LanguageSelectorMobile.tsx
Outdated
Show resolved
Hide resolved
@andipaetzold The previous library is built for i18n in the "old" next.js so it only works with the pages router. |
This comment was marked as resolved.
This comment was marked as resolved.
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
Thanks @andipaetzold, I managed to localise the 404 page and fix the link 🙂 |
cf14eba
to
f30ed1f
Compare
const days = 30; | ||
const date = new Date(); | ||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); | ||
document.cookie = `NEXT_LOCALE=${newLocale};expires=${date.toUTCString()};path=/`; |
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.
Feels strange to do this manually...
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.
Yeah, so as an explanation: The bug you found with the language switcher was that Next.js middleware doesn't run for cached pages, and the middleware is what automatically sets the language cookie. To get around the bug we can force set the cookie and then call router.refresh()
to apply it.
src/components/features/language-selector/LanguageSelectorMobile.tsx
Outdated
Show resolved
Hide resolved
@@ -121,9 +123,10 @@ enum AssetOrder { | |||
} | |||
|
|||
""" | |||
To have author-related properties [See type definition](https://app.contentful.com/spaces/nvxmqufxogry/content_types/componentAuthor) | |||
To have author-related properties [See type definition](https://app.contentful.com/spaces/7b6c43hr18k6/content_types/componentAuthor) |
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.
which space does this new spaceId correspond to?
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.
Probably my test space. Should we even be including the __generated directory? 🤔
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.
mm it's a good question. Based on the README it seems we expect the user to only (re-)generate the GraphQL schema, types and sdk
if the content model changes, while we take care of the initial generation.
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.
I re-inserted the old space ID in the newly generated files even though they were created from a different space. I hope it works after merging.
What will change?
react-i18next
andnext-i18n-router
togetherTodo