feat(i18n): replace translation in Appearance

This commit is contained in:
JiPai
2024-11-08 12:40:31 +08:00
parent 7f0a92f224
commit 046f0a5c20
5 changed files with 57 additions and 26 deletions

View File

@@ -63,7 +63,7 @@ export function AppearanceForm() {
useEffect(() => {
form.reset({
theme: (theme ?? "system") as AppearanceFormValues["theme"],
language: locale ?? "en",
language: locale,
});
}, [form, theme, locale]);
function onSubmit(data: AppearanceFormValues) {
@@ -92,9 +92,9 @@ export function AppearanceForm() {
render={({ field }) => {
return (
<FormItem className="space-y-1 ">
<FormLabel>Theme</FormLabel>
<FormLabel>{t("settings.appearance.theme")}</FormLabel>
<FormDescription>
Select a theme for your dashboard
{t("settings.appearance.themeDescription")}
</FormDescription>
<FormMessage />
<RadioGroup
@@ -112,7 +112,7 @@ export function AppearanceForm() {
<img src="/images/theme-light.svg" alt="light" />
</div>
<span className="block w-full p-2 text-center font-normal">
Light
{t("settings.appearance.themes.light")}
</span>
</FormLabel>
</FormItem>
@@ -125,7 +125,7 @@ export function AppearanceForm() {
<img src="/images/theme-dark.svg" alt="dark" />
</div>
<span className="block w-full p-2 text-center font-normal">
Dark
{t("settings.appearance.themes.dark")}
</span>
</FormLabel>
</FormItem>
@@ -141,7 +141,7 @@ export function AppearanceForm() {
<img src="/images/theme-system.svg" alt="system" />
</div>
<span className="block w-full p-2 text-center font-normal">
System
{t("settings.appearance.themes.system")}
</span>
</FormLabel>
</FormItem>
@@ -158,9 +158,9 @@ export function AppearanceForm() {
render={({ field }) => {
return (
<FormItem className="space-y-1">
<FormLabel>Language</FormLabel>
<FormLabel>{t("settings.appearance.language")}</FormLabel>
<FormDescription>
Select a language for your dashboard
{t("settings.appearance.languageDescription")}
</FormDescription>
<FormMessage />
<Select
@@ -187,7 +187,7 @@ export function AppearanceForm() {
}}
/>
<Button type="submit">Save</Button>
<Button type="submit">{t("settings.common.save")}</Button>
</form>
</Form>
</CardContent>

View File

@@ -96,9 +96,7 @@ export const ProfileForm = () => {
<CardTitle className="text-xl">
{t("settings.profile.title")}
</CardTitle>
<CardDescription>
Change the details of your profile here.
</CardDescription>
<CardDescription>{t("settings.profile.description")}</CardDescription>
</div>
{!data?.is2FAEnabled ? <Enable2FA /> : <Disable2FA />}
</CardHeader>
@@ -111,9 +109,12 @@ export const ProfileForm = () => {
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormLabel>{t("settings.profile.email")}</FormLabel>
<FormControl>
<Input placeholder="Email" {...field} />
<Input
placeholder={t("settings.profile.email")}
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
@@ -124,11 +125,11 @@ export const ProfileForm = () => {
name="password"
render={({ field }) => (
<FormItem>
<FormLabel>Password</FormLabel>
<FormLabel>{t("settings.profile.password")}</FormLabel>
<FormControl>
<Input
type="password"
placeholder="Password"
placeholder={t("settings.profile.password")}
{...field}
value={field.value || ""}
/>
@@ -143,7 +144,7 @@ export const ProfileForm = () => {
name="image"
render={({ field }) => (
<FormItem>
<FormLabel>Avatar</FormLabel>
<FormLabel>{t("settings.profile.avatar")}</FormLabel>
<FormControl>
<RadioGroup
onValueChange={(e) => {
@@ -181,7 +182,7 @@ export const ProfileForm = () => {
</div>
<div>
<Button type="submit" isLoading={isLoading}>
Save
{t("settings.common.save")}
</Button>
</div>
</form>