-
-
Notifications
You must be signed in to change notification settings - Fork 843
feat(i18n): Add next-intl framework with full bilingual support (EN/ZH) #434
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,3 +47,6 @@ next-env.d.ts | |
|
|
||
| # source | ||
| /.source/ | ||
|
|
||
| .pnpm-store/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,16 @@ import { AnimatePresence, motion } from "motion/react"; | |
| import { useSearchParams } from "next/navigation"; | ||
| import { Suspense, useEffect, useState } from "react"; | ||
| import { toast } from "sonner"; | ||
| import { useTranslations } from "next-intl"; | ||
| import { Logo } from "@/components/Logo"; | ||
| import { getAuthErrorDetails, shouldRetry } from "@/lib/auth-errors"; | ||
| import { AmbientBackground } from "./AmbientBackground"; | ||
| import { GoogleLoginButton } from "./GoogleLoginButton"; | ||
| import { LocalLoginForm } from "./LocalLoginForm"; | ||
|
|
||
| function LoginContent() { | ||
| const t = useTranslations('auth'); | ||
| const tCommon = useTranslations('common'); | ||
| const [authType, setAuthType] = useState<string | null>(null); | ||
| const [isLoading, setIsLoading] = useState(true); | ||
| const [urlError, setUrlError] = useState<{ title: string; message: string } | null>(null); | ||
|
|
@@ -26,15 +29,15 @@ function LoginContent() { | |
|
|
||
| // Show registration success message | ||
| if (registered === "true") { | ||
| toast.success("Registration successful!", { | ||
| description: "You can now sign in with your credentials", | ||
| toast.success(t('register_success'), { | ||
| description: t('login_subtitle'), | ||
| duration: 5000, | ||
| }); | ||
| } | ||
|
|
||
| // Show logout confirmation | ||
| if (logout === "true") { | ||
| toast.success("Logged out successfully", { | ||
| toast.success(tCommon('success'), { | ||
| description: "You have been securely logged out", | ||
|
Comment on lines
+40
to
41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translate the hardcoded logout message. Line 41 contains a hardcoded string Apply this diff: if (logout === "true") {
toast.success(tCommon('success'), {
- description: "You have been securely logged out",
+ description: t('logout_description'),
duration: 3000,
});
}Then add 🤖 Prompt for AI Agents |
||
| duration: 3000, | ||
| }); | ||
|
|
@@ -93,7 +96,7 @@ function LoginContent() { | |
| <Logo className="rounded-md" /> | ||
| <div className="mt-8 flex items-center space-x-2"> | ||
| <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" /> | ||
| <span className="text-muted-foreground">Loading...</span> | ||
| <span className="text-muted-foreground">{tCommon('loading')}</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
@@ -110,7 +113,7 @@ function LoginContent() { | |
| <div className="mx-auto flex h-screen max-w-lg flex-col items-center justify-center"> | ||
| <Logo className="rounded-md" /> | ||
| <h1 className="my-8 text-xl font-bold text-neutral-800 dark:text-neutral-100 md:text-4xl"> | ||
| Sign In | ||
| {t('sign_in')} | ||
| </h1> | ||
|
|
||
| {/* URL Error Display */} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.