-
Notifications
You must be signed in to change notification settings - Fork 778
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
Add locale for en and cn #51
base: main
Are you sure you want to change the base?
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @sadmann7 on Vercel. @sadmann7 first needs to authorize it. |
thanks a lot, will merge soon |
Found an issue where, when the user is not logged in, switching languages in url will result in too many redirection prompts. too many redirection prompts details as follows:
so i stop redirect in afterAuth. it works. if (!auth.userId) {
// If user tries to access a private route without being authenticated,
// redirect them to the sign in page
return
// url.pathname = "/signin"
// return NextResponse.redirect(url)
} |
I was looking over it. I requires an additional local folder. Can it be done without any additional folder? |
You mean folder named as [locale]? or some else, can you list them out? |
@@ -29,7 +30,7 @@ import { Shell } from "@/components/shells/shell" | |||
// Read more: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config | |||
export const dynamic = "force-dynamic" | |||
|
|||
export default async function IndexPage() { | |||
export default async function IndexPage({params: {locale}}) { |
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.
locale is string type{params: {locale: string}}
I have tried two solutions, next-intl and i18next, and ultimately chose next-intl.
The compatibility between i18next and Clerk was not ideal, and it also enforced explicitly displaying the locale information in the URL, which is a bad user experience.
While next-intl is currently being used as a temporary workaround for static rendering pages, as the next.js default solution, it is expected to improve over time.
notes: It is supposed that adding language switch buttons on the header or footer in the future, as well as complete all i18n fields. I can participate in supplementing and reviewing the Chinese part. Thanks to the author for providing such a great learning project.
Reference: