Email for professionals and teams
Translate account settings forms
Hieu Nguyen (Jack)176c867f4668
diff --git a/src/components/settings/account-settings.tsx b/src/components/settings/account-settings.tsxindex da99868..275707a 100644--- a/src/components/settings/account-settings.tsx+++ b/src/components/settings/account-settings.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Skeleton } from "@/components/ui/skeleton";import { ForwardingEmailForm } from "./forwarding-email-form";import { MailboxSignatureForm } from "./mailbox-signature-form";@@ -10,6 +11,7 @@ import type { AccountSettingsResponse } from "./types";import { loadAccountSettings } from "./utils";export function AccountSettings() {+ const { t } = useLanguage();const [user, setUser] = useState<AccountSettingsResponse["user"]>();const [error, setError] = useState<string | null>(null);@@ -21,13 +23,13 @@ export function AccountSettings() {if (!cancelled) setUser(nextUser);}).catch((err) => {- if (!cancelled) setError(err instanceof Error ? err.message : "Failed to load account");+ if (!cancelled) setError(err instanceof Error ? err.message : t("settings.account.loadFailed"));});return () => {cancelled = true;};- }, []);+ }, [t]);if (error) {return <p className="py-8 text-sm text-red-600">{error}</p>;@@ -51,8 +53,8 @@ export function AccountSettings() {<section className="space-y-4"><div>- <h2 className="text-xl font-semibold text-neutral-900">Account details</h2>- <p className="mt-1 text-sm text-neutral-500">Manage your identity, recovery options, and email preferences.</p>+ <h2 className="text-xl font-semibold text-neutral-900">{t("settings.account.detailsTitle")}</h2>+ <p className="mt-1 text-sm text-neutral-500">{t("settings.account.detailsDescription")}</p></div><div className="space-y-1 overflow-hidden rounded-3xl"><ProfileForm@@ -66,8 +68,8 @@ export function AccountSettings() {{user.canForwardEmail && (<div className="space-y-4 rounded-lg bg-white p-6"><div>- <h3 className="text-lg font-semibold text-neutral-900">Forwarding email</h3>- <p className="mt-1 text-sm text-neutral-500">Send a copy of incoming messages to another email address.</p>+ <h3 className="text-lg font-semibold text-neutral-900">{t("settings.account.forwardingTitle")}</h3>+ <p className="mt-1 text-sm text-neutral-500">{t("settings.account.forwardingDescription")}</p></div><ForwardingEmailForm initialForwardingEmail={user.forwardingEmail ?? ""} /></div>@@ -75,8 +77,8 @@ export function AccountSettings() {<div className="space-y-4 rounded-b-3xl rounded-t-lg bg-white p-6"><div>- <h3 className="text-lg font-semibold text-neutral-900">Email signature</h3>- <p className="mt-1 text-sm text-neutral-500">Configure the signature for the inbox currently selected above.</p>+ <h3 className="text-lg font-semibold text-neutral-900">{t("settings.account.signatureTitle")}</h3>+ <p className="mt-1 text-sm text-neutral-500">{t("settings.account.signatureDescription")}</p></div><MailboxSignatureForm /></div>diff --git a/src/components/settings/appearance-settings.tsx b/src/components/settings/appearance-settings.tsxindex 8c51b63..52c5813 100644--- a/src/components/settings/appearance-settings.tsx+++ b/src/components/settings/appearance-settings.tsx@@ -1,6 +1,8 @@"use client";import { useEffect, useState } from "react";+import { useLanguage } from "@/components/language-provider";+import type { TranslationKey } from "@/lib/i18n/types";import { Select } from "@/components/ui/select";import {isThemePreference,@@ -10,13 +12,14 @@ import {type ThemePreference,} from "@/components/theme-utils";-const OPTIONS: { value: ThemePreference; label: string }[] = [- { value: "system", label: "Match system" },- { value: "light", label: "Light" },- { value: "dark", label: "Dark" },+const OPTIONS: { value: ThemePreference; labelKey: TranslationKey }[] = [+ { value: "system", labelKey: "settings.theme.system" },+ { value: "light", labelKey: "settings.theme.light" },+ { value: "dark", labelKey: "settings.theme.dark" },];export function AppearanceSettings() {+ const { t } = useLanguage();const [preference, setPreference] = useState<ThemePreference>("system");useEffect(() => {@@ -29,14 +32,14 @@ export function AppearanceSettings() {return (<label className="flex items-start gap-3 rounded-xl bg-neutral-50 p-4"><span className="flex-1">- <span className="block text-sm font-medium text-neutral-900">Theme</span>+ <span className="block text-sm font-medium text-neutral-900">{t("settings.theme.label")}</span><span className="mt-1 block text-sm text-neutral-500">- Use a light or dark interface, or follow your system setting. Saved in this browser.+ {t("settings.theme.description")}</span></span><Selectvalue={preference}- aria-label="Theme"+ aria-label={t("settings.theme.label")}className="py-1.5 text-sm text-neutral-900"onChange={(event) => {const next = event.target.value;@@ -47,7 +50,7 @@ export function AppearanceSettings() {>{OPTIONS.map((option) => (<option key={option.value} value={option.value}>- {option.label}+ {t(option.labelKey)}</option>))}</Select>diff --git a/src/components/settings/browser-notification-settings.tsx b/src/components/settings/browser-notification-settings.tsxindex 2293e91..934c365 100644--- a/src/components/settings/browser-notification-settings.tsx+++ b/src/components/settings/browser-notification-settings.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Switch } from "@/components/ui/switch";import {areBrowserNotificationsEnabled,@@ -8,6 +9,7 @@ import {} from "@/hooks/message-realtime-utils";export function BrowserNotificationSettings() {+ const { t } = useLanguage();const [permission, setPermission] = useState<NotificationPermission | "unsupported">("unsupported");const [enabled, setEnabled] = useState(false);const [error, setError] = useState<string | null>(null);@@ -30,9 +32,9 @@ export function BrowserNotificationSettings() {<div><label className="flex items-start gap-3 rounded-xl bg-neutral-50 p-4"><span className="flex-1">- <span className="block text-sm font-medium text-neutral-900">Browser notifications</span>+ <span className="block text-sm font-medium text-neutral-900">{t("settings.notifications.title")}</span><span className="mt-1 block text-sm text-neutral-500">- Show a notification for new email while Mailflare is open in a background tab.+ {t("settings.notifications.description")}</span></span><Switch@@ -45,7 +47,7 @@ export function BrowserNotificationSettings() {setBrowserNotificationsEnabled(false);setEnabled(false);} catch {- setError("Could not save the notification preference in this browser.");+ setError(t("settings.notifications.saveFailed"));}return;}@@ -57,18 +59,18 @@ export function BrowserNotificationSettings() {setBrowserNotificationsEnabled(true);setEnabled(true);} catch {- setError("Could not enable browser notifications.");+ setError(t("settings.notifications.enableFailed"));}})();}}- aria-label="Enable browser notifications"+ aria-label={t("settings.notifications.enable")}/></label>{permission === "denied" && (- <p className="mt-2 px-4 text-sm text-neutral-500">Notifications are blocked. Allow them in your browser's site settings to enable this option.</p>+ <p className="mt-2 px-4 text-sm text-neutral-500">{t("settings.notifications.blocked")}</p>)}{permission === "unsupported" && (- <p className="mt-2 px-4 text-sm text-neutral-500">Browser notifications are unavailable here.</p>+ <p className="mt-2 px-4 text-sm text-neutral-500">{t("settings.notifications.unavailable")}</p>)}{error && <p className="mt-2 px-4 text-sm text-red-600">{error}</p>}</div>diff --git a/src/components/settings/change-password-form.tsx b/src/components/settings/change-password-form.tsxindex 415cd9e..b6756d1 100644--- a/src/components/settings/change-password-form.tsx+++ b/src/components/settings/change-password-form.tsx@@ -1,12 +1,14 @@"use client";import { useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";import { updatePassword } from "./utils";export function ChangePasswordForm() {+ const { t } = useLanguage();const [currentPassword, setCurrentPassword] = useState("");const [newPassword, setNewPassword] = useState("");const [confirmPassword, setConfirmPassword] = useState("");@@ -18,7 +20,7 @@ export function ChangePasswordForm() {setStatus(null);if (newPassword !== confirmPassword) {- setStatus("New passwords do not match");+ setStatus(t("settings.password.mismatch"));return;}@@ -28,9 +30,9 @@ export function ChangePasswordForm() {setCurrentPassword("");setNewPassword("");setConfirmPassword("");- setStatus("Password changed");+ setStatus(t("settings.password.changed"));} catch (err) {- setStatus(err instanceof Error ? err.message : "Failed to change password");+ setStatus(err instanceof Error ? err.message : t("settings.password.failed"));} finally {setLoading(false);}@@ -39,7 +41,7 @@ export function ChangePasswordForm() {return (<form onSubmit={onSubmit} className="space-y-4"><div className="space-y-2">- <Label htmlFor="currentPassword">Current password</Label>+ <Label htmlFor="currentPassword">{t("settings.password.current")}</Label><Inputid="currentPassword"type="password"@@ -50,7 +52,7 @@ export function ChangePasswordForm() {/></div><div className="space-y-2">- <Label htmlFor="newPassword">New password</Label>+ <Label htmlFor="newPassword">{t("settings.password.new")}</Label><Inputid="newPassword"type="password"@@ -62,7 +64,7 @@ export function ChangePasswordForm() {/></div><div className="space-y-2">- <Label htmlFor="confirmPassword">Confirm new password</Label>+ <Label htmlFor="confirmPassword">{t("settings.password.confirm")}</Label><Inputid="confirmPassword"type="password"@@ -75,7 +77,7 @@ export function ChangePasswordForm() {</div><div className="flex items-center gap-3"><Button type="submit" disabled={loading}>- {loading ? "Changing..." : "Change password"}+ {loading ? t("settings.password.changing") : t("settings.password.change")}</Button>{status && <p className="text-sm text-neutral-500">{status}</p>}</div>diff --git a/src/components/settings/current-mailbox-form.tsx b/src/components/settings/current-mailbox-form.tsxindex c6eebfd..9afe0c7 100644--- a/src/components/settings/current-mailbox-form.tsx+++ b/src/components/settings/current-mailbox-form.tsx@@ -3,6 +3,7 @@import type { FormEvent } from "react";import { useEffect, useState } from "react";import { Save } from "lucide-react";+import { useLanguage } from "@/components/language-provider";import { useSelectedMailbox } from "@/components/mailbox-provider";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";@@ -13,6 +14,7 @@ import { ProfileAvatarForm } from "./profile-avatar-form";import { getMailboxAddress, updateCurrentMailboxName } from "./utils";export function CurrentMailboxForm() {+ const { t } = useLanguage();const { selectedMailbox, setSelectedMailbox, isLoading } = useSelectedMailbox();const [displayName, setDisplayName] = useState("");const [savedDisplayName, setSavedDisplayName] = useState("");@@ -37,9 +39,9 @@ export function CurrentMailboxForm() {setSelectedMailbox(updated);setSavedDisplayName(updated.displayName ?? "");setDisplayName(updated.displayName ?? "");- setStatus("Saved");+ setStatus(t("common.saved"));} catch (err) {- setStatus(err instanceof Error ? err.message : "Failed to update mailbox");+ setStatus(err instanceof Error ? err.message : t("settings.mailbox.updateFailed"));} finally {setSaving(false);}@@ -63,10 +65,10 @@ export function CurrentMailboxForm() {if (!selectedMailbox) {return (<div className="space-y-6">- <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Settings</h1>+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("settings.mailbox.title")}</h1><Card className="rounded-3xl border-0 bg-white p-6"><CardContent className="p-6 text-sm text-neutral-500">- Select a mailbox to view its settings.+ {t("settings.mailbox.selectToView")}</CardContent></Card></div>@@ -79,7 +81,7 @@ export function CurrentMailboxForm() {return (<div className="space-y-8"><div>- <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Settings</h1>+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("settings.mailbox.title")}</h1><p className="mt-1 text-sm text-neutral-500">{address}</p></div>@@ -92,7 +94,7 @@ export function CurrentMailboxForm() {/><form onSubmit={onSubmit} className="space-y-4"><div className="space-y-2">- <Label htmlFor="displayName">Name</Label>+ <Label htmlFor="displayName">{t("common.name")}</Label><Inputid="displayName"value={displayName}@@ -104,7 +106,7 @@ export function CurrentMailboxForm() {<div className="flex items-center gap-3"><Button type="submit" disabled={saving || !hasChanges}><Save className="h-4 w-4" />- {saving ? "Saving..." : "Save changes"}+ {saving ? t("common.saving") : t("settings.mailbox.saveChanges")}</Button>{status && <p className="text-sm text-neutral-500">{status}</p>}</div>diff --git a/src/components/settings/forwarding-email-form.tsx b/src/components/settings/forwarding-email-form.tsxindex bbd3e37..4982ba1 100644--- a/src/components/settings/forwarding-email-form.tsx+++ b/src/components/settings/forwarding-email-form.tsx@@ -1,6 +1,7 @@"use client";import { useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";@@ -8,6 +9,7 @@ import type { ForwardingEmailFormProps } from "./types";import { updateForwardingEmail } from "./utils";export function ForwardingEmailForm({ initialForwardingEmail }: ForwardingEmailFormProps) {+ const { t } = useLanguage();const [forwardingEmail, setForwardingEmail] = useState(initialForwardingEmail);const [savedForwardingEmail, setSavedForwardingEmail] = useState(initialForwardingEmail);const [status, setStatus] = useState<string | null>(null);@@ -21,9 +23,9 @@ export function ForwardingEmailForm({ initialForwardingEmail }: ForwardingEmailFconst saved = await updateForwardingEmail(forwardingEmail);setForwardingEmail(saved);setSavedForwardingEmail(saved);- setStatus("Saved");+ setStatus(t("common.saved"));} catch (error) {- setStatus(error instanceof Error ? error.message : "Failed to update forwarding email");+ setStatus(error instanceof Error ? error.message : t("settings.forwarding.failed"));} finally {setSaving(false);}@@ -32,7 +34,7 @@ export function ForwardingEmailForm({ initialForwardingEmail }: ForwardingEmailFreturn (<form onSubmit={onSubmit} className="space-y-4"><div className="space-y-2">- <Label htmlFor="forwardingEmail">Destination email</Label>+ <Label htmlFor="forwardingEmail">{t("settings.forwarding.destination")}</Label><Inputid="forwardingEmail"value={forwardingEmail}@@ -41,12 +43,12 @@ export function ForwardingEmailForm({ initialForwardingEmail }: ForwardingEmailFplaceholder="[email protected]"/><p className="text-xs leading-5 text-neutral-500">- Incoming mail will also be sent to this verified Cloudflare Email Routing destination.+ {t("settings.forwarding.hint")}</p></div><div className="flex items-center gap-3"><Button type="submit" disabled={saving || forwardingEmail.trim() === savedForwardingEmail}>- {saving ? "Saving..." : "Save forwarding"}+ {saving ? t("common.saving") : t("settings.forwarding.save")}</Button>{status && <p className="text-sm text-neutral-500">{status}</p>}</div>diff --git a/src/components/settings/mailbox-auto-reply-form.tsx b/src/components/settings/mailbox-auto-reply-form.tsxindex 951a251..9d3a9f6 100644--- a/src/components/settings/mailbox-auto-reply-form.tsx+++ b/src/components/settings/mailbox-auto-reply-form.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useState } from "react";+import { useLanguage } from "@/components/language-provider";import { useSelectedMailbox } from "@/components/mailbox-provider";import { Button } from "@/components/ui/button";import { Checkbox } from "@/components/ui/checkbox";@@ -18,6 +19,7 @@ const defaultSettings: MailboxAutoReplySettings = {};export function MailboxAutoReplyForm() {+ const { t } = useLanguage();const { selectedMailbox, setSelectedMailbox, isLoading } =useSelectedMailbox();const [settings, setSettings] = useState(defaultSettings);@@ -45,7 +47,7 @@ export function MailboxAutoReplyForm() {event.preventDefault();if (!selectedMailbox) return;if (settings.enabled && !settings.body.trim()) {- setStatus("Enter an auto-reply message before enabling it.");+ setStatus(t("settings.autoReply.needMessage"));return;}setSaving(true);@@ -60,10 +62,10 @@ export function MailboxAutoReplyForm() {autoReplySubject: saved.subject,autoReplyBody: saved.body,});- setStatus("Saved");+ setStatus(t("common.saved"));} catch (error) {setStatus(- error instanceof Error ? error.message : "Failed to update auto-reply",+ error instanceof Error ? error.message : t("settings.autoReply.failed"),);} finally {setSaving(false);@@ -71,11 +73,11 @@ export function MailboxAutoReplyForm() {}if (isLoading)- return <p className="text-sm text-neutral-500">Loading inbox…</p>;+ return <p className="text-sm text-neutral-500">{t("settings.signature.loadingInbox")}</p>;if (!selectedMailbox)return (<p className="text-sm text-neutral-500">- Select an inbox to configure auto-reply.+ {t("settings.autoReply.selectInbox")}</p>);@@ -88,10 +90,10 @@ export function MailboxAutoReplyForm() {<label className="flex items-start gap-3 rounded-xl bg-neutral-50 p-4"><span className="flex-1"><span className="block text-sm font-medium text-neutral-900">- Enable auto-reply for {address}+ {t("settings.autoReply.enableFor", { address })}</span><span className="mt-1 block text-sm text-neutral-500">- Each sender receives at most one automatic response every 24 hours.+ {t("settings.autoReply.limit")}</span></span>@@ -104,37 +106,37 @@ export function MailboxAutoReplyForm() {{settings.enabled && (<><div className="space-y-2">- <Label htmlFor="autoReplySubject">Subject</Label>+ <Label htmlFor="autoReplySubject">{t("settings.autoReply.subject")}</Label><Inputid="autoReplySubject"value={settings.subject}onChange={(event) =>setSettings({ ...settings, subject: event.target.value })}- placeholder="Out of office"+ placeholder={t("settings.autoReply.subjectPlaceholder")}disabled={!canManage || saving}/></div><div className="space-y-2">- <Label htmlFor="autoReplyBody">Message</Label>+ <Label htmlFor="autoReplyBody">{t("settings.autoReply.message")}</Label><Textareaid="autoReplyBody"value={settings.body}onChange={(event) =>setSettings({ ...settings, body: event.target.value })}- placeholder="Thanks for your message. I am currently away and will reply when I return."+ placeholder={t("settings.autoReply.messagePlaceholder")}rows={7}disabled={!canManage || saving}/></div><div className="flex items-center gap-3"><Button type="submit" disabled={!canManage || saving || !changed}>- {saving ? "Saving..." : "Save"}+ {saving ? t("common.saving") : t("settings.autoReply.save")}</Button>{!canManage && (<p className="text-sm text-neutral-500">- Full access is required to edit auto-reply.+ {t("settings.autoReply.needFullAccess")}</p>)}{status && <p className="text-sm text-neutral-500">{status}</p>}diff --git a/src/components/settings/mailbox-signature-form.tsx b/src/components/settings/mailbox-signature-form.tsxindex 60da752..1eabac2 100644--- a/src/components/settings/mailbox-signature-form.tsx+++ b/src/components/settings/mailbox-signature-form.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useState } from "react";+import { useLanguage } from "@/components/language-provider";import { useSelectedMailbox } from "@/components/mailbox-provider";import { isHtmlSignature } from "@/components/compose/rich-text-utils";import { EmailHtmlRenderer } from "@/components/messages/email-html-renderer";@@ -10,6 +11,7 @@ import { Textarea } from "@/components/ui/textarea";import { updateMailboxSignature } from "./utils";export function MailboxSignatureForm() {+ const { t } = useLanguage();const { selectedMailbox, setSelectedMailbox, isLoading } = useSelectedMailbox();const [signature, setSignature] = useState("");const [savedSignature, setSavedSignature] = useState("");@@ -33,16 +35,16 @@ export function MailboxSignatureForm() {setSignature(saved);setSavedSignature(saved);setSelectedMailbox({ ...selectedMailbox, signature: saved });- setStatus("Saved");+ setStatus(t("common.saved"));} catch (error) {- setStatus(error instanceof Error ? error.message : "Failed to update signature");+ setStatus(error instanceof Error ? error.message : t("settings.signature.failed"));} finally {setSaving(false);}}- if (isLoading) return <p className="text-sm text-neutral-500">Loading inbox…</p>;- if (!selectedMailbox) return <p className="text-sm text-neutral-500">Select an inbox to configure its signature.</p>;+ if (isLoading) return <p className="text-sm text-neutral-500">{t("settings.signature.loadingInbox")}</p>;+ if (!selectedMailbox) return <p className="text-sm text-neutral-500">{t("settings.signature.selectInbox")}</p>;const address = `${selectedMailbox.localPart}@${selectedMailbox.hostname}`;const canManage = selectedMailbox.permission === "full_access";@@ -50,22 +52,22 @@ export function MailboxSignatureForm() {return (<form onSubmit={onSubmit} className="space-y-4"><div className="space-y-2">- <Label htmlFor="mailboxSignature">Signature for {address}</Label>+ <Label htmlFor="mailboxSignature">{t("settings.signature.for", { address })}</Label><Textareaid="mailboxSignature"value={signature}onChange={(event) => setSignature(event.target.value)}- placeholder={"Your name\nRole or company\nContact details"}+ placeholder={t("settings.signature.placeholder")}rows={6}disabled={!canManage || saving}/><p className="text-xs leading-5 text-neutral-500">- This signature is added when composing from the selected inbox. Plain text or HTML is supported; HTML is sanitized.+ {t("settings.signature.hint")}</p></div>{isHtmlSignature(signature) && (<div className="space-y-2">- <p className="text-xs font-medium text-neutral-500">Preview</p>+ <p className="text-xs font-medium text-neutral-500">{t("settings.signature.preview")}</p><EmailHtmlRendererclassName="rounded-md border border-neutral-200 bg-white p-4 text-sm text-neutral-900"html={signature}@@ -74,9 +76,9 @@ export function MailboxSignatureForm() {)}<div className="flex items-center gap-3"><Button type="submit" disabled={!canManage || saving || signature.trim() === savedSignature}>- {saving ? "Saving..." : "Save signature"}+ {saving ? t("common.saving") : t("settings.signature.save")}</Button>- {!canManage && <p className="text-sm text-neutral-500">Full access is required to edit this signature.</p>}+ {!canManage && <p className="text-sm text-neutral-500">{t("settings.signature.needFullAccess")}</p>}{status && <p className="text-sm text-neutral-500">{status}</p>}</div></form>diff --git a/src/components/settings/profile-form.tsx b/src/components/settings/profile-form.tsxindex 09d4d2b..004c59c 100644--- a/src/components/settings/profile-form.tsx+++ b/src/components/settings/profile-form.tsx@@ -1,6 +1,7 @@"use client";import { useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";@@ -14,6 +15,7 @@ export function ProfileForm({initialResetEmail,email,}: ProfileFormProps) {+ const { t } = useLanguage();const [name, setName] = useState(initialName);const [resetEmail, setResetEmail] = useState(initialResetEmail);const [savedName, setSavedName] = useState(initialName);@@ -36,7 +38,7 @@ export function ProfileForm({throw new Error(typeof data.error === "string"? data.error- : "Failed to update account",+ : t("settings.profile.updateFailed"),);}@@ -50,7 +52,7 @@ export function ProfileForm({} catch (error) {throw error instanceof Error? error- : new Error("Failed to update account");+ : new Error(t("settings.profile.updateFailed"));}}@@ -60,10 +62,10 @@ export function ProfileForm({setProfileStatus(null);try {await saveProfile(name, savedResetEmail);- setProfileStatus("Saved");+ setProfileStatus(t("common.saved"));} catch (error) {setProfileStatus(- error instanceof Error ? error.message : "Failed to update account",+ error instanceof Error ? error.message : t("settings.profile.updateFailed"),);} finally {setSavingProfile(false);@@ -76,12 +78,12 @@ export function ProfileForm({setRecoveryStatus(null);try {await saveProfile(savedName, resetEmail);- setRecoveryStatus("Saved");+ setRecoveryStatus(t("common.saved"));} catch (error) {setRecoveryStatus(error instanceof Error? error.message- : "Failed to update recovery email",+ : t("settings.profile.recoveryFailed"),);} finally {setSavingRecovery(false);@@ -98,16 +100,16 @@ export function ProfileForm({<ProfileAvatarForm name={name} colorSeed={email} /><div><p className="text-sm font-medium text-neutral-900">- Profile picture+ {t("settings.profile.pictureTitle")}</p><p className="mt-1 text-sm text-neutral-500">- Choose a picture to show across your account.+ {t("settings.profile.pictureDescription")}</p></div></div><div className="space-y-2">- <Label htmlFor="name">Name</Label>+ <Label htmlFor="name">{t("common.name")}</Label><Inputid="name"value={name}@@ -116,7 +118,7 @@ export function ProfileForm({/></div><div className="space-y-2">- <Label htmlFor="accountEmail">Current email</Label>+ <Label htmlFor="accountEmail">{t("settings.profile.currentEmail")}</Label><Inputid="accountEmail"value={email}@@ -132,7 +134,7 @@ export function ProfileForm({type="submit"disabled={savingProfile || name.trim() === savedName}>- {savingProfile ? "Saving..." : "Save profile"}+ {savingProfile ? t("common.saving") : t("settings.profile.save")}</Button>{profileStatus && (<p className="text-sm text-neutral-500">{profileStatus}</p>@@ -146,14 +148,14 @@ export function ProfileForm({><div><h3 className="text-lg font-semibold text-neutral-900">- Recovery email+ {t("settings.profile.recoveryTitle")}</h3><p className="mt-1 text-sm text-neutral-500">- Used to recover access if you cannot sign in.+ {t("settings.profile.recoveryDescription")}</p></div><div className="space-y-2">- <Label htmlFor="resetEmail">Email address</Label>+ <Label htmlFor="resetEmail">{t("settings.profile.emailAddress")}</Label><Inputid="resetEmail"value={resetEmail}@@ -167,7 +169,7 @@ export function ProfileForm({type="submit"disabled={savingRecovery || resetEmail.trim() === savedResetEmail}>- {savingRecovery ? "Saving..." : "Save recovery email"}+ {savingRecovery ? t("common.saving") : t("settings.profile.saveRecovery")}</Button>{recoveryStatus && (<p className="text-sm text-neutral-500">{recoveryStatus}</p>diff --git a/src/components/settings/time-zone-form.tsx b/src/components/settings/time-zone-form.tsxindex a1a13cb..171b1c1 100644--- a/src/components/settings/time-zone-form.tsx+++ b/src/components/settings/time-zone-form.tsx@@ -1,6 +1,7 @@"use client";import { useState } from "react";+import { useLanguage } from "@/components/language-provider";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";@@ -9,6 +10,7 @@ import { formatCurrentTimeInZone, listTimeZones, updateUserTimeZone } from "./tiimport type { TimeZoneFormProps } from "./time-zone-form-types";export function TimeZoneForm({ userId, initialTimeZone }: TimeZoneFormProps) {+ const { t } = useLanguage();const [timeZone, setTimeZone] = useState(initialTimeZone ?? "");const [savedTimeZone, setSavedTimeZone] = useState(initialTimeZone ?? "");const [saving, setSaving] = useState(false);@@ -28,21 +30,21 @@ export function TimeZoneForm({ userId, initialTimeZone }: TimeZoneFormProps) {setTimeZone(saved ?? "");setSavedTimeZone(saved ?? "");saveUserTimeZonePreference(userId, saved);- setStatus("Saved");- }).catch((error) => setStatus(error instanceof Error ? error.message : "Could not save timezone")).finally(() => setSaving(false));+ setStatus(t("common.saved"));+ }).catch((error) => setStatus(error instanceof Error ? error.message : t("settings.timeZone.failed"))).finally(() => setSaving(false));}}><div>- <h3 className="text-lg font-semibold text-neutral-900">Time zone</h3>- <p className="mt-1 text-sm text-neutral-500">Choose the time zone used for dates, search, and scheduling. Leave blank to follow this device ({deviceTimeZone}).</p>+ <h3 className="text-lg font-semibold text-neutral-900">{t("settings.timeZone.title")}</h3>+ <p className="mt-1 text-sm text-neutral-500">{t("settings.timeZone.description", { zone: deviceTimeZone })}</p></div><div className="space-y-2">- <Label htmlFor="account-time-zone">Time zone</Label>- <Input id="account-time-zone" list="account-time-zone-options" value={timeZone} onChange={(event) => { setTimeZone(event.target.value); setStatus(null); }} placeholder={`Device time zone (${deviceTimeZone})`} autoComplete="off" />+ <Label htmlFor="account-time-zone">{t("settings.timeZone.title")}</Label>+ <Input id="account-time-zone" list="account-time-zone-options" value={timeZone} onChange={(event) => { setTimeZone(event.target.value); setStatus(null); }} placeholder={t("settings.timeZone.placeholder", { zone: deviceTimeZone })} autoComplete="off" /><datalist id="account-time-zone-options">{listTimeZones(deviceTimeZone).map((zone) => <option key={zone} value={zone} />)}</datalist>- {validZone && <p className="text-sm text-neutral-500">Current time: {validZone}</p>}+ {validZone && <p className="text-sm text-neutral-500">{t("settings.timeZone.current", { time: validZone })}</p>}</div><div className="flex items-center gap-3">- <Button type="submit" disabled={saving || timeZone.trim() === savedTimeZone || !validZone}>{saving ? "Saving..." : "Save time zone"}</Button>+ <Button type="submit" disabled={saving || timeZone.trim() === savedTimeZone || !validZone}>{saving ? t("common.saving") : t("settings.timeZone.save")}</Button>{status && <p className="text-sm text-neutral-500" role="status">{status}</p>}</div></form>;diff --git a/src/components/shortcuts/shortcuts-help-dialog.tsx b/src/components/shortcuts/shortcuts-help-dialog.tsxindex 1dff357..dee8dec 100644--- a/src/components/shortcuts/shortcuts-help-dialog.tsx+++ b/src/components/shortcuts/shortcuts-help-dialog.tsx@@ -12,6 +12,18 @@ interface ShortcutsHelpDialogProps {shortcuts: ShortcutDefinition[];}+// Puts a styled key badge where the translation has its {key} placeholder.+function withKey(text: string, key: string) {+ const [before, after = ""] = text.split("{key}");+ return (+ <>+ {before}+ <kbd className="px-1.5 py-0.5 bg-neutral-200 text-neutral-700 rounded font-mono">{key}</kbd>+ {after}+ </>+ );+}+export function ShortcutsHelpDialog({isOpen,onClose,@@ -101,12 +113,8 @@ export function ShortcutsHelpDialog({{/* Footer */}<div className="px-6 py-3 bg-neutral-50 border-t border-neutral-100 flex items-center justify-between text-xs text-neutral-400">- <span>- {t("shortcutsHelp.pressToToggle", { key: "?" })}- </span>- <span>- {t("shortcutsHelp.pressToClose", { key: "ESC" })}- </span>+ <span>{withKey(t("shortcutsHelp.pressToToggle", { key: "{key}" }), "?")}</span>+ <span>{withKey(t("shortcutsHelp.pressToClose", { key: "{key}" }), "ESC")}</span></div></div></div>diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.jsonindex aa76641..da0113e 100644--- a/src/lib/i18n/en.json+++ b/src/lib/i18n/en.json@@ -373,5 +373,81 @@"shortcutsHelp.close": "Close","shortcutsHelp.pressToToggle": "Press {key} to toggle","shortcutsHelp.pressToClose": "Press {key} to close",- "shortcutsHelp.ctrl": "Ctrl"+ "shortcutsHelp.ctrl": "Ctrl",+ "common.saved": "Saved",+ "common.saving": "Saving...",+ "common.name": "Name",+ "common.cancel": "Cancel",+ "common.loading": "Loading...",+ "settings.account.loadFailed": "Failed to load account",+ "settings.account.detailsTitle": "Account details",+ "settings.account.detailsDescription": "Manage your identity, recovery options, and email preferences.",+ "settings.account.forwardingTitle": "Forwarding email",+ "settings.account.forwardingDescription": "Send a copy of incoming messages to another email address.",+ "settings.account.signatureTitle": "Email signature",+ "settings.account.signatureDescription": "Configure the signature for the inbox currently selected above.",+ "settings.profile.updateFailed": "Failed to update account",+ "settings.profile.recoveryFailed": "Failed to update recovery email",+ "settings.profile.pictureTitle": "Profile picture",+ "settings.profile.pictureDescription": "Choose a picture to show across your account.",+ "settings.profile.currentEmail": "Current email",+ "settings.profile.save": "Save profile",+ "settings.profile.recoveryTitle": "Recovery email",+ "settings.profile.recoveryDescription": "Used to recover access if you cannot sign in.",+ "settings.profile.emailAddress": "Email address",+ "settings.profile.saveRecovery": "Save recovery email",+ "settings.password.mismatch": "New passwords do not match",+ "settings.password.changed": "Password changed",+ "settings.password.failed": "Failed to change password",+ "settings.password.current": "Current password",+ "settings.password.new": "New password",+ "settings.password.confirm": "Confirm new password",+ "settings.password.changing": "Changing...",+ "settings.password.change": "Change password",+ "settings.theme.system": "Match system",+ "settings.theme.light": "Light",+ "settings.theme.dark": "Dark",+ "settings.theme.label": "Theme",+ "settings.theme.description": "Use a light or dark interface, or follow your system setting. Saved in this browser.",+ "settings.notifications.title": "Browser notifications",+ "settings.notifications.description": "Show a notification for new email while Mailflare is open in a background tab.",+ "settings.notifications.saveFailed": "Could not save the notification preference in this browser.",+ "settings.notifications.enableFailed": "Could not enable browser notifications.",+ "settings.notifications.enable": "Enable browser notifications",+ "settings.notifications.blocked": "Notifications are blocked. Allow them in your browser's site settings to enable this option.",+ "settings.notifications.unavailable": "Browser notifications are unavailable here.",+ "settings.mailbox.updateFailed": "Failed to update mailbox",+ "settings.mailbox.title": "Settings",+ "settings.mailbox.selectToView": "Select a mailbox to view its settings.",+ "settings.mailbox.saveChanges": "Save changes",+ "settings.forwarding.failed": "Failed to update forwarding email",+ "settings.forwarding.destination": "Destination email",+ "settings.forwarding.hint": "Incoming mail will also be sent to this verified Cloudflare Email Routing destination.",+ "settings.forwarding.save": "Save forwarding",+ "settings.signature.failed": "Failed to update signature",+ "settings.signature.loadingInbox": "Loading inbox…",+ "settings.signature.selectInbox": "Select an inbox to configure its signature.",+ "settings.signature.for": "Signature for {address}",+ "settings.signature.placeholder": "Your name\nRole or company\nContact details",+ "settings.signature.hint": "This signature is added when composing from the selected inbox. Plain text or HTML is supported; HTML is sanitized.",+ "settings.signature.preview": "Preview",+ "settings.signature.save": "Save signature",+ "settings.signature.needFullAccess": "Full access is required to edit this signature.",+ "settings.autoReply.needMessage": "Enter an auto-reply message before enabling it.",+ "settings.autoReply.failed": "Failed to update auto-reply",+ "settings.autoReply.selectInbox": "Select an inbox to configure auto-reply.",+ "settings.autoReply.enableFor": "Enable auto-reply for {address}",+ "settings.autoReply.limit": "Each sender receives at most one automatic response every 24 hours.",+ "settings.autoReply.subject": "Subject",+ "settings.autoReply.subjectPlaceholder": "Out of office",+ "settings.autoReply.message": "Message",+ "settings.autoReply.messagePlaceholder": "Thanks for your message. I am currently away and will reply when I return.",+ "settings.autoReply.save": "Save",+ "settings.autoReply.needFullAccess": "Full access is required to edit auto-reply.",+ "settings.timeZone.failed": "Could not save timezone",+ "settings.timeZone.title": "Time zone",+ "settings.timeZone.description": "Choose the time zone used for dates, search, and scheduling. Leave blank to follow this device ({zone}).",+ "settings.timeZone.placeholder": "Device time zone ({zone})",+ "settings.timeZone.current": "Current time: {time}",+ "settings.timeZone.save": "Save time zone"}diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.jsonindex cb52eac..82fcda6 100644--- a/src/lib/i18n/pt-BR.json+++ b/src/lib/i18n/pt-BR.json@@ -373,5 +373,81 @@"shortcutsHelp.close": "Fechar","shortcutsHelp.pressToToggle": "Pressione {key} para alternar","shortcutsHelp.pressToClose": "Pressione {key} para fechar",- "shortcutsHelp.ctrl": "Ctrl"+ "shortcutsHelp.ctrl": "Ctrl",+ "common.saved": "Salvo",+ "common.saving": "Salvando...",+ "common.name": "Nome",+ "common.cancel": "Cancelar",+ "common.loading": "Carregando...",+ "settings.account.loadFailed": "Falha ao carregar a conta",+ "settings.account.detailsTitle": "Detalhes da conta",+ "settings.account.detailsDescription": "Gerencie sua identidade, opções de recuperação e preferências de e-mail.",+ "settings.account.forwardingTitle": "E-mail de encaminhamento",+ "settings.account.forwardingDescription": "Envie uma cópia das mensagens recebidas para outro endereço de e-mail.",+ "settings.account.signatureTitle": "Assinatura de e-mail",+ "settings.account.signatureDescription": "Configure a assinatura da caixa de entrada selecionada acima.",+ "settings.profile.updateFailed": "Falha ao atualizar a conta",+ "settings.profile.recoveryFailed": "Falha ao atualizar o e-mail de recuperação",+ "settings.profile.pictureTitle": "Foto de perfil",+ "settings.profile.pictureDescription": "Escolha uma foto para exibir em toda a sua conta.",+ "settings.profile.currentEmail": "E-mail atual",+ "settings.profile.save": "Salvar perfil",+ "settings.profile.recoveryTitle": "E-mail de recuperação",+ "settings.profile.recoveryDescription": "Usado para recuperar o acesso caso você não consiga entrar.",+ "settings.profile.emailAddress": "Endereço de e-mail",+ "settings.profile.saveRecovery": "Salvar e-mail de recuperação",+ "settings.password.mismatch": "As novas senhas não coincidem",+ "settings.password.changed": "Senha alterada",+ "settings.password.failed": "Falha ao alterar a senha",+ "settings.password.current": "Senha atual",+ "settings.password.new": "Nova senha",+ "settings.password.confirm": "Confirmar nova senha",+ "settings.password.changing": "Alterando...",+ "settings.password.change": "Alterar senha",+ "settings.theme.system": "Seguir o sistema",+ "settings.theme.light": "Claro",+ "settings.theme.dark": "Escuro",+ "settings.theme.label": "Tema",+ "settings.theme.description": "Use uma interface clara ou escura, ou siga a configuração do sistema. Salvo neste navegador.",+ "settings.notifications.title": "Notificações do navegador",+ "settings.notifications.description": "Mostrar uma notificação de novo e-mail enquanto o Mailflare estiver aberto em uma aba em segundo plano.",+ "settings.notifications.saveFailed": "Não foi possível salvar a preferência de notificação neste navegador.",+ "settings.notifications.enableFailed": "Não foi possível ativar as notificações do navegador.",+ "settings.notifications.enable": "Ativar notificações do navegador",+ "settings.notifications.blocked": "As notificações estão bloqueadas. Permita-as nas configurações do site no navegador para ativar esta opção.",+ "settings.notifications.unavailable": "As notificações do navegador não estão disponíveis aqui.",+ "settings.mailbox.updateFailed": "Falha ao atualizar a caixa de correio",+ "settings.mailbox.title": "Configurações",+ "settings.mailbox.selectToView": "Selecione uma caixa de correio para ver suas configurações.",+ "settings.mailbox.saveChanges": "Salvar alterações",+ "settings.forwarding.failed": "Falha ao atualizar o e-mail de encaminhamento",+ "settings.forwarding.destination": "E-mail de destino",+ "settings.forwarding.hint": "Os e-mails recebidos também serão enviados a este destino verificado do Cloudflare Email Routing.",+ "settings.forwarding.save": "Salvar encaminhamento",+ "settings.signature.failed": "Falha ao atualizar a assinatura",+ "settings.signature.loadingInbox": "Carregando caixa de entrada…",+ "settings.signature.selectInbox": "Selecione uma caixa de entrada para configurar a assinatura.",+ "settings.signature.for": "Assinatura de {address}",+ "settings.signature.placeholder": "Seu nome\nCargo ou empresa\nDados de contato",+ "settings.signature.hint": "Esta assinatura é adicionada ao escrever pela caixa de entrada selecionada. Há suporte para texto simples ou HTML; o HTML é sanitizado.",+ "settings.signature.preview": "Pré-visualização",+ "settings.signature.save": "Salvar assinatura",+ "settings.signature.needFullAccess": "É necessário acesso total para editar esta assinatura.",+ "settings.autoReply.needMessage": "Digite uma mensagem de resposta automática antes de ativá-la.",+ "settings.autoReply.failed": "Falha ao atualizar a resposta automática",+ "settings.autoReply.selectInbox": "Selecione uma caixa de entrada para configurar a resposta automática.",+ "settings.autoReply.enableFor": "Ativar resposta automática para {address}",+ "settings.autoReply.limit": "Cada remetente recebe no máximo uma resposta automática a cada 24 horas.",+ "settings.autoReply.subject": "Assunto",+ "settings.autoReply.subjectPlaceholder": "Fora do escritório",+ "settings.autoReply.message": "Mensagem",+ "settings.autoReply.messagePlaceholder": "Obrigado pela sua mensagem. Estou ausente no momento e responderei quando voltar.",+ "settings.autoReply.save": "Salvar",+ "settings.autoReply.needFullAccess": "É necessário acesso total para editar a resposta automática.",+ "settings.timeZone.failed": "Não foi possível salvar o fuso horário",+ "settings.timeZone.title": "Fuso horário",+ "settings.timeZone.description": "Escolha o fuso horário usado para datas, pesquisa e agendamento. Deixe em branco para seguir este dispositivo ({zone}).",+ "settings.timeZone.placeholder": "Fuso horário do dispositivo ({zone})",+ "settings.timeZone.current": "Hora atual: {time}",+ "settings.timeZone.save": "Salvar fuso horário"}