Skip to content

Email for professionals and teams

Translate inbox, spam, import and email client settings

Hieu Nguyen (Jack)c4c3bb58651b
diff --git a/src/components/settings/email-clients-settings.tsx b/src/components/settings/email-clients-settings.tsx
index 96fd68a..e7a714c 100644
--- a/src/components/settings/email-clients-settings.tsx
+++ b/src/components/settings/email-clients-settings.tsx
@@ -3,6 +3,7 @@
import { useState } from "react";
import Link from "next/link";
import { Copy, KeyRound } from "lucide-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";
@@ -20,6 +21,7 @@ const MAX_KEY_MAILBOXES = 30;
* only lists the mailboxes a key was granted, so the card asks which to include.
*/
export function EmailClientsSettings() {
+ const { t } = useLanguage();
const { mailboxes, selectedMailbox, isLoading } = useSelectedMailbox();
const [name, setName] = useState("");
// `null` until the user changes the selection, which means every accessible mailbox —
@@ -38,10 +40,10 @@ export function EmailClientsSettings() {
setBusy(true);
setError(null);
try {
- setKey(await createJmapApiKey(name.trim() || "Mail app", mailboxIds));
+ setKey(await createJmapApiKey(name.trim() || t("emailClients.defaultName"), mailboxIds));
setName("");
} catch (err) {
- setError(err instanceof Error ? err.message : "Could not create a key");
+ setError(err instanceof Error ? err.message : t("emailClients.createFailed"));
} finally {
setBusy(false);
}
@@ -54,35 +56,35 @@ export function EmailClientsSettings() {
return (
<div className="space-y-4">
<p className="text-sm text-neutral-500">
- App Password for email clients that support JMAP. Point the app at this server and sign in with your email address and an API key as the password.
+ {t("emailClients.description")}
</p>
{key ? (
<div className="space-y-3 rounded-2xl bg-neutral-50 p-4">
- <Field label="Server" value={server} onCopy={copy} copied={copied} />
- <Field label="Username" value="any value" onCopy={copy} copied={copied} />
- <Field label="Password (API key)" value={key} onCopy={copy} copied={copied} mono />
+ <Field label={t("emailClients.server")} value={server} onCopy={copy} copied={copied} />
+ <Field label={t("emailClients.username")} value={t("emailClients.anyValue")} onCopy={copy} copied={copied} />
+ <Field label={t("emailClients.passwordApiKey")} value={key} onCopy={copy} copied={copied} mono />
<p className="text-xs text-neutral-500">
- This key is shown once. You can revoke it in <Link href="/settings/api-keys" className="text-blue-700 underline">API keys</Link>. Session discovery is at <code>{server}/.well-known/jmap</code>.
+ {t("emailClients.shownOnce", { link: "\u0001", url: "\u0002" }).split(/(\u0001|\u0002)/).map((part, index) => part === "\u0001" ? <Link key={index} href="/settings/api-keys" className="text-blue-700 underline">{t("settings.nav.apiKeys")}</Link> : part === "\u0002" ? <code key={index}>{server}/.well-known/jmap</code> : part)}
</p>
</div>
) : (
<form onSubmit={submit} className="space-y-4">
<div className="flex flex-wrap items-end gap-3">
<div className="min-w-56 flex-1 space-y-2">
- <Label htmlFor="jmap-key-name">Device or app name</Label>
- <Input id="jmap-key-name" value={name} onChange={(event) => setName(event.target.value)} placeholder="Phone" />
+ <Label htmlFor="jmap-key-name">{t("emailClients.deviceName")}</Label>
+ <Input id="jmap-key-name" value={name} onChange={(event) => setName(event.target.value)} placeholder={t("emailClients.devicePlaceholder")} />
</div>
<Button type="submit" disabled={busy || isLoading || !mailboxIds.length || mailboxIds.length > MAX_KEY_MAILBOXES}>
<KeyRound className="h-4 w-4" />
- {busy ? "Creating..." : "Create app password"}
+ {busy ? t("emailClients.creating") : t("emailClients.create")}
</Button>
</div>
<fieldset className="space-y-2">
- <legend className="text-sm font-medium">Mailboxes this app can use</legend>
+ <legend className="text-sm font-medium">{t("emailClients.mailboxesLegend")}</legend>
{isLoading ? (
- <p className="text-sm text-neutral-500">Loading mailboxes...</p>
+ <p className="text-sm text-neutral-500">{t("emailClients.loadingMailboxes")}</p>
) : mailboxes.length === 0 ? (
- <p className="text-sm text-neutral-500">No accessible mailboxes.</p>
+ <p className="text-sm text-neutral-500">{t("apiKeys.noMailboxes")}</p>
) : (
mailboxes.map((mailbox) => (
<label key={mailbox.id} className="flex items-center gap-3 text-sm">
@@ -94,7 +96,7 @@ export function EmailClientsSettings() {
</label>
))
)}
- <p className="text-xs text-neutral-500">Aliases share their parent mailbox and are included with it. Up to {MAX_KEY_MAILBOXES} mailboxes per key.</p>
+ <p className="text-xs text-neutral-500">{t("emailClients.aliasLimit", { max: MAX_KEY_MAILBOXES })}</p>
</fieldset>
{error && <p className="w-full text-sm text-red-600">{error}</p>}
</form>
@@ -104,13 +106,14 @@ export function EmailClientsSettings() {
}
function Field({ label, value, onCopy, copied, mono }: { label: string; value: string; onCopy: (label: string, value: string) => void; copied: string | null; mono?: boolean }) {
+ const { t } = useLanguage();
return (
<div className="flex items-center gap-3">
<span className="w-36 shrink-0 text-xs font-medium uppercase tracking-wide text-neutral-500">{label}</span>
<code className={`min-w-0 flex-1 truncate rounded-md bg-white px-2 py-1 text-sm ${mono ? "font-mono" : "font-sans"}`}>{value}</code>
- <Button type="button" variant="ghost" size="sm" onClick={() => onCopy(label, value)} aria-label={`Copy ${label}`}>
+ <Button type="button" variant="ghost" size="sm" onClick={() => onCopy(label, value)} aria-label={t("common.copyLabel", { label })}>
<Copy className="h-4 w-4" />
- {copied === label ? "Copied" : "Copy"}
+ {copied === label ? t("common.copied") : t("common.copy")}
</Button>
</div>
);
diff --git a/src/components/settings/import-messages-utils.ts b/src/components/settings/import-messages-utils.ts
index 257848e..5d96450 100644
--- a/src/components/settings/import-messages-utils.ts
+++ b/src/components/settings/import-messages-utils.ts
@@ -1,3 +1,4 @@
+import { defaultTranslator, type Translator } from "@/lib/i18n/utils";
import { getAuthHeaders } from "@/lib/auth/client";
import type { ImportMessagesResult, ImportProgressHandler } from "./import-messages-types";
@@ -35,7 +36,7 @@ export async function importMessageFiles(
});
}
-export function getImportSummary(result: ImportMessagesResult | null): string {
+export function getImportSummary(result: ImportMessagesResult | null, t: Translator = defaultTranslator): string {
if (!result) return "";
- return `${result.imported ?? 0} imported, ${result.skipped ?? 0} skipped`;
+ return t("import.summary", { imported: result.imported ?? 0, skipped: result.skipped ?? 0 });
}
diff --git a/src/components/settings/import-messages.tsx b/src/components/settings/import-messages.tsx
index 212ccb7..a8ed188 100644
--- a/src/components/settings/import-messages.tsx
+++ b/src/components/settings/import-messages.tsx
@@ -3,6 +3,7 @@
import type { FormEvent } from "react";
import { useState } from "react";
import { Upload } 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";
@@ -12,6 +13,7 @@ import type { ImportMessagesProps, ImportMessagesResult } from "./import-message
import { getImportSummary, importMessageFiles } from "./import-messages-utils";
export function ImportMessages({ destination, sourceLabel }: ImportMessagesProps) {
+ const { t } = useLanguage();
const { selectedMailbox } = useSelectedMailbox();
const [files, setFiles] = useState<File[]>([]);
const [loading, setLoading] = useState(false);
@@ -30,7 +32,7 @@ export function ImportMessages({ destination, sourceLabel }: ImportMessagesProps
setResult(nextResult);
window.dispatchEvent(new Event("mailflare:messages-changed"));
} catch (err) {
- setError(err instanceof Error ? err.message : "Import failed");
+ setError(err instanceof Error ? err.message : t("import.failed"));
} finally {
setLoading(false);
}
@@ -41,17 +43,16 @@ export function ImportMessages({ destination, sourceLabel }: ImportMessagesProps
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Upload className="h-4 w-4" />
- Import mail
+ {t("import.title")}
</CardTitle>
<CardDescription>
- Upload exported .eml or .mbox files from source {sourceLabel}. They will be saved to the
- matching section in the selected mailbox.
+ {t("import.description", { source: sourceLabel })}
</CardDescription>
</CardHeader>
<CardContent>
<form onSubmit={onSubmit} className="space-y-4">
<div className="space-y-2">
- <Label htmlFor="mail-import">Mail export files</Label>
+ <Label htmlFor="mail-import">{t("import.filesLabel")}</Label>
<Input
id="mail-import"
type="file"
@@ -61,17 +62,17 @@ export function ImportMessages({ destination, sourceLabel }: ImportMessagesProps
className="block w-full rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm shadow-sm shadow-neutral-200/50 file:mr-3 file:rounded-md file:border-0 file:bg-neutral-100 file:px-3 file:py-1.5 file:text-sm file:font-medium"
/>
<p className="text-xs leading-5 text-neutral-500">
- Imports up to 100 messages and 25 MB per upload. Duplicate Message-ID values are skipped.
+ {t("import.limits")}
</p>
</div>
<Button type="submit" disabled={!selectedMailbox || files.length === 0 || loading}>
- {loading ? "Importing..." : "Import messages"}
+ {loading ? t("import.importing") : t("import.submit")}
</Button>
{result && (
<div className="rounded-lg border border-green-100 bg-green-50 px-4 py-3 text-sm text-green-700">
- <p className="font-medium">{getImportSummary(result)}</p>
+ <p className="font-medium">{getImportSummary(result, t)}</p>
{(result.errors ?? []).length > 0 && (
<ul className="mt-2 list-disc space-y-1 pl-5 text-xs">
{result.errors.slice(0, 5).map((item) => (
diff --git a/src/components/settings/inbox-reading-layout-settings.tsx b/src/components/settings/inbox-reading-layout-settings.tsx
index 78abe3b..89eb675 100644
--- a/src/components/settings/inbox-reading-layout-settings.tsx
+++ b/src/components/settings/inbox-reading-layout-settings.tsx
@@ -1,20 +1,22 @@
"use client";
+import { useLanguage } from "@/components/language-provider";
import { Switch } from "@/components/ui/switch";
import { useTwoColumnReading } from "@/components/messages/use-two-column-reading";
export function InboxReadingLayoutSettings() {
+ const { t } = useLanguage();
const [twoColumnReading, setTwoColumnReading] = useTwoColumnReading();
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">Two column reading view</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.reading.title")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Show the email list beside an open email. Turn this off to read emails in one column.
+ {t("settings.reading.description")}
</span>
</span>
- <Switch checked={twoColumnReading} onCheckedChange={setTwoColumnReading} aria-label="Two column reading view" />
+ <Switch checked={twoColumnReading} onCheckedChange={setTwoColumnReading} aria-label={t("settings.reading.title")} />
</label>
);
}
diff --git a/src/components/settings/inbox-shortcuts-settings.tsx b/src/components/settings/inbox-shortcuts-settings.tsx
index 0c9048e..bea0219 100644
--- a/src/components/settings/inbox-shortcuts-settings.tsx
+++ b/src/components/settings/inbox-shortcuts-settings.tsx
@@ -1,10 +1,12 @@
"use client";
import { useState } from "react";
+import { useLanguage } from "@/components/language-provider";
import { useShortcuts } from "@/components/shortcuts";
import { Switch } from "@/components/ui/switch";
export function InboxShortcutsSettings() {
+ const { t } = useLanguage();
const {
shortcutsEnabled,
shortcutsPreferenceLoading,
@@ -18,9 +20,9 @@ export function InboxShortcutsSettings() {
<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">Keyboard shortcuts</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.shortcuts.title")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Use quick keys to navigate, compose, and manage messages on this account.
+ {t("settings.shortcuts.description")}
</span>
</span>
<Switch
@@ -30,10 +32,10 @@ export function InboxShortcutsSettings() {
setSaving(true);
setSaveError(null);
void setShortcutsEnabled(enabled)
- .catch((error) => setSaveError(error instanceof Error ? error.message : "Failed to update shortcut settings"))
+ .catch((error) => setSaveError(error instanceof Error ? error.message : t("settings.shortcuts.failed")))
.finally(() => setSaving(false));
}}
- aria-label="Enable keyboard shortcuts"
+ aria-label={t("settings.shortcuts.enable")}
/>
</label>
{(saveError || shortcutsPreferenceError) && (
diff --git a/src/components/settings/inbox-threading-settings.tsx b/src/components/settings/inbox-threading-settings.tsx
index 1e32d13..1bdc6ea 100644
--- a/src/components/settings/inbox-threading-settings.tsx
+++ b/src/components/settings/inbox-threading-settings.tsx
@@ -1,10 +1,12 @@
"use client";
+import { useLanguage } from "@/components/language-provider";
import { Switch } from "@/components/ui/switch";
import { useConversationView } from "@/components/messages/use-conversation-view";
import { useLatestMessagesFirst } from "@/components/messages/use-latest-messages-first";
export function InboxThreadingSettings() {
+ const { t } = useLanguage();
const [conversationView, setConversationView] = useConversationView();
const [latestMessagesFirst, setLatestMessagesFirst] = useLatestMessagesFirst();
@@ -12,18 +14,18 @@ export function InboxThreadingSettings() {
<div className="space-y-3">
<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">Group emails into conversations</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.threading.groupTitle")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Show related messages together as a single thread in message lists.
+ {t("settings.threading.groupDescription")}
</span>
</span>
<Switch checked={conversationView} onCheckedChange={setConversationView} />
</label>
<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">Sort latest messages first</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.threading.latestTitle")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Show the newest email at the top of a conversation. Turn this off to show it last.
+ {t("settings.threading.latestDescription")}
</span>
</span>
<Switch checked={latestMessagesFirst} onCheckedChange={setLatestMessagesFirst} />
diff --git a/src/components/settings/mcp-agent-instructions.tsx b/src/components/settings/mcp-agent-instructions.tsx
index b77a71a..5323548 100644
--- a/src/components/settings/mcp-agent-instructions.tsx
+++ b/src/components/settings/mcp-agent-instructions.tsx
@@ -2,11 +2,13 @@
import { useEffect, useState } from "react";
import { Copy } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Button } from "@/components/ui/button";
import { buildMcpAgentPrompt } from "./mcp-agent-instructions-utils";
import type { McpAgentInstructionsProps } from "./mcp-agent-instructions-types";
export function McpAgentInstructions(props: McpAgentInstructionsProps) {
+ const { t } = useLanguage();
const [origin, setOrigin] = useState("");
const [copied, setCopied] = useState(false);
useEffect(() => setOrigin(window.location.origin), []);
@@ -14,8 +16,8 @@ export function McpAgentInstructions(props: McpAgentInstructionsProps) {
return <div className="space-y-2 rounded-lg border border-neutral-200 p-3">
<div className="flex items-center justify-between gap-3">
- <strong className="text-sm">Instructions for your AI agent</strong>
- <Button type="button" size="sm" variant="outline" onClick={() => void navigator.clipboard.writeText(prompt).then(() => setCopied(true))}><Copy className="h-4 w-4" />{copied ? "Copied" : "Copy prompt"}</Button>
+ <strong className="text-sm">{t("mcp.instructions")}</strong>
+ <Button type="button" size="sm" variant="outline" onClick={() => void navigator.clipboard.writeText(prompt).then(() => setCopied(true))}><Copy className="h-4 w-4" />{copied ? t("common.copied") : t("mcp.copyPrompt")}</Button>
</div>
<pre className="max-h-48 overflow-auto whitespace-pre-wrap break-all rounded bg-neutral-50 p-3 text-xs text-neutral-700">{prompt}</pre>
</div>;
diff --git a/src/components/settings/recipient-address-settings.tsx b/src/components/settings/recipient-address-settings.tsx
index f7bb482..bd6001f 100644
--- a/src/components/settings/recipient-address-settings.tsx
+++ b/src/components/settings/recipient-address-settings.tsx
@@ -2,9 +2,11 @@
import { useState } from "react";
import { useShowFullRecipientAddresses } from "@/components/messages/use-show-full-recipient-addresses";
+import { useLanguage } from "@/components/language-provider";
import { Switch } from "@/components/ui/switch";
export function RecipientAddressSettings() {
+ const { t } = useLanguage();
const { enabled, error, isLoading, setEnabled } = useShowFullRecipientAddresses();
const [saving, setSaving] = useState(false);
const [saveError, setSaveError] = useState<string | null>(null);
@@ -13,9 +15,9 @@ export function RecipientAddressSettings() {
<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">Show full recipient addresses</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.recipient.title")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- On To, Cc, and Bcc, show Name &lt;[email protected]&gt; when the message includes a name. Off shows only the email address. This follows your sign-in, on every mailbox.
+ {t("settings.recipient.description")}
</span>
</span>
<Switch
@@ -25,10 +27,10 @@ export function RecipientAddressSettings() {
setSaving(true);
setSaveError(null);
void setEnabled(next)
- .catch((updateError) => setSaveError(updateError instanceof Error ? updateError.message : "Failed to update recipient address settings"))
+ .catch((updateError) => setSaveError(updateError instanceof Error ? updateError.message : t("settings.recipient.failed")))
.finally(() => setSaving(false));
}}
- aria-label="Show full recipient addresses"
+ aria-label={t("settings.recipient.title")}
/>
</label>
{(saveError || error) && <p className="mt-2 px-4 text-sm text-red-600">{saveError || error}</p>}
diff --git a/src/components/settings/spam-filter-settings.tsx b/src/components/settings/spam-filter-settings.tsx
index 6bae64d..68532cc 100644
--- a/src/components/settings/spam-filter-settings.tsx
+++ b/src/components/settings/spam-filter-settings.tsx
@@ -2,9 +2,11 @@
import { useEffect, useState } from "react";
import { authFetch } from "@/lib/auth/client";
+import { useLanguage } from "@/components/language-provider";
import { Switch } from "@/components/ui/switch";
export function SpamFilterSettings() {
+ const { t } = useLanguage();
const [enabled, setEnabled] = useState(true);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -13,10 +15,10 @@ export function SpamFilterSettings() {
void authFetch("/api/settings/spam")
.then(async (response) => {
const data = await response.json() as { enabled?: boolean; error?: string };
- if (!response.ok) throw new Error(data.error ?? "Failed to load spam filter settings");
+ if (!response.ok) throw new Error(data.error ?? t("settings.spam.loadFailed"));
setEnabled(data.enabled !== false);
})
- .catch((nextError) => setError(nextError instanceof Error ? nextError.message : "Failed to load spam filter settings"))
+ .catch((nextError) => setError(nextError instanceof Error ? nextError.message : t("settings.spam.loadFailed")))
.finally(() => setLoading(false));
}, []);
@@ -32,11 +34,11 @@ export function SpamFilterSettings() {
body: JSON.stringify({ enabled: nextEnabled }),
});
const data = await response.json() as { enabled?: boolean; error?: string };
- if (!response.ok) throw new Error(data.error ?? "Failed to update spam filter settings");
+ if (!response.ok) throw new Error(data.error ?? t("settings.spam.updateFailed"));
setEnabled(data.enabled !== false);
} catch (nextError) {
setEnabled(previous);
- setError(nextError instanceof Error ? nextError.message : "Failed to update spam filter settings");
+ setError(nextError instanceof Error ? nextError.message : t("settings.spam.updateFailed"));
} finally {
setLoading(false);
}
@@ -46,10 +48,10 @@ export function SpamFilterSettings() {
<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">Spam Filter</span>
- <span className="mt-1 block text-sm text-neutral-500">Analyze incoming messages locally and detect high-confidence spam</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.spam.title")}</span>
+ <span className="mt-1 block text-sm text-neutral-500">{t("settings.spam.description")}</span>
</span>
- <Switch checked={enabled} disabled={loading} onCheckedChange={(value) => void updateEnabled(value)} aria-label="Enable spam filter" />
+ <Switch checked={enabled} disabled={loading} onCheckedChange={(value) => void updateEnabled(value)} aria-label={t("settings.spam.enable")} />
</label>
{error && <p className="mt-2 px-4 text-sm text-red-600">{error}</p>}
</div>
diff --git a/src/components/settings/trash-retention-settings.tsx b/src/components/settings/trash-retention-settings.tsx
index dee10f7..02722c9 100644
--- a/src/components/settings/trash-retention-settings.tsx
+++ b/src/components/settings/trash-retention-settings.tsx
@@ -1,11 +1,13 @@
"use client";
import { useEffect, useState } from "react";
+import { useLanguage } from "@/components/language-provider";
import { authFetch } from "@/lib/auth/client";
import { TRASH_RETENTION_OPTIONS, describeTrashRetention } from "@/lib/email/trash-retention-utils";
import type { TrashRetentionSettingsResponse } from "@/app/api/settings/trash-retention/types";
export function TrashRetentionSettings() {
+ const { t } = useLanguage();
const [days, setDays] = useState<number | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -14,10 +16,10 @@ export function TrashRetentionSettings() {
void authFetch("/api/settings/trash-retention")
.then(async (response) => {
const data = await response.json() as TrashRetentionSettingsResponse;
- if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : "Failed to load clean-up settings");
+ if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : t("settings.trash.loadFailed"));
setDays(data.days ?? null);
})
- .catch((nextError) => setError(nextError instanceof Error ? nextError.message : "Failed to load clean-up settings"))
+ .catch((nextError) => setError(nextError instanceof Error ? nextError.message : t("settings.trash.loadFailed")))
.finally(() => setLoading(false));
}, []);
@@ -33,11 +35,11 @@ export function TrashRetentionSettings() {
body: JSON.stringify({ days: nextDays }),
});
const data = await response.json() as TrashRetentionSettingsResponse;
- if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : "Failed to update clean-up settings");
+ if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : t("settings.trash.updateFailed"));
setDays(data.days ?? null);
} catch (nextError) {
setDays(previous);
- setError(nextError instanceof Error ? nextError.message : "Failed to update clean-up settings");
+ setError(nextError instanceof Error ? nextError.message : t("settings.trash.updateFailed"));
} finally {
setLoading(false);
}
@@ -52,9 +54,9 @@ export function TrashRetentionSettings() {
<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">Auto-delete Trash and Spam</span>
+ <span className="block text-sm font-medium text-neutral-900">{t("settings.trash.title")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Permanently delete messages once they have been in Trash or Spam for this long. Applies to the mailboxes you own.
+ {t("settings.trash.description")}
</span>
</span>
<select
@@ -62,11 +64,11 @@ export function TrashRetentionSettings() {
disabled={loading}
onChange={(event) => void updateDays(event.target.value ? Number(event.target.value) : null)}
className="rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-800 disabled:opacity-60"
- aria-label="Auto-delete Trash and Spam"
+ aria-label={t("settings.trash.title")}
>
- <option value="">{describeTrashRetention(null)}</option>
+ <option value="">{describeTrashRetention(null, t)}</option>
{options.map((value) => (
- <option key={value} value={value}>{describeTrashRetention(value)}</option>
+ <option key={value} value={value}>{describeTrashRetention(value, t)}</option>
))}
</select>
</label>
diff --git a/src/lib/email/trash-retention-utils.ts b/src/lib/email/trash-retention-utils.ts
index 21d6eef..1af399c 100644
--- a/src/lib/email/trash-retention-utils.ts
+++ b/src/lib/email/trash-retention-utils.ts
@@ -1,3 +1,5 @@
+import { defaultTranslator, type Translator } from "../i18n/utils";
+
/** Choices offered in Settings; any whole number in range is accepted by the API. */
export const TRASH_RETENTION_OPTIONS = [7, 14, 30, 60, 90] as const;
export const MIN_TRASH_RETENTION_DAYS = 1;
@@ -19,7 +21,7 @@ export function normalizeTrashRetentionDays(value: unknown): number | null {
return value;
}
-export function describeTrashRetention(days: number | null): string {
- if (!days) return "Never";
- return days === 1 ? "After 1 day" : `After ${days} days`;
+export function describeTrashRetention(days: number | null, t: Translator = defaultTranslator): string {
+ if (!days) return t("settings.trash.never");
+ return t("settings.trash.afterDay", { count: days });
}
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index e0d7fcf..66e1e2d 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -544,5 +544,57 @@
"apiKeys.lastUsed": "Last used {date}",
"apiKeys.neverUsed": "Never used",
"apiKeys.mailboxesLabel": "Mailboxes: {list}",
- "apiKeys.allAccessible": "All accessible mailboxes (existing key)"
+ "apiKeys.allAccessible": "All accessible mailboxes (existing key)",
+ "common.copy": "Copy",
+ "common.copyLabel": "Copy {label}",
+ "emailClients.defaultName": "Mail app",
+ "emailClients.createFailed": "Could not create a key",
+ "emailClients.description": "App Password for email clients that support JMAP. Point the app at this server and sign in with your email address and an API key as the password.",
+ "emailClients.server": "Server",
+ "emailClients.username": "Username",
+ "emailClients.anyValue": "any value",
+ "emailClients.passwordApiKey": "Password (API key)",
+ "emailClients.shownOnce": "This key is shown once. You can revoke it in {link}. Session discovery is at {url}.",
+ "emailClients.deviceName": "Device or app name",
+ "emailClients.devicePlaceholder": "Phone",
+ "emailClients.creating": "Creating...",
+ "emailClients.create": "Create app password",
+ "emailClients.mailboxesLegend": "Mailboxes this app can use",
+ "emailClients.loadingMailboxes": "Loading mailboxes...",
+ "emailClients.aliasLimit": "Aliases share their parent mailbox and are included with it. Up to {max} mailboxes per key.",
+ "import.failed": "Import failed",
+ "import.title": "Import mail",
+ "import.description": "Upload exported .eml or .mbox files from source {source}. They will be saved to the matching section in the selected mailbox.",
+ "import.filesLabel": "Mail export files",
+ "import.limits": "Imports up to 100 messages and 25 MB per upload. Duplicate Message-ID values are skipped.",
+ "import.importing": "Importing...",
+ "import.submit": "Import messages",
+ "import.summary": "{imported} imported, {skipped} skipped",
+ "settings.reading.title": "Two column reading view",
+ "settings.reading.description": "Show the email list beside an open email. Turn this off to read emails in one column.",
+ "settings.shortcuts.title": "Keyboard shortcuts",
+ "settings.shortcuts.description": "Use quick keys to navigate, compose, and manage messages on this account.",
+ "settings.shortcuts.failed": "Failed to update shortcut settings",
+ "settings.shortcuts.enable": "Enable keyboard shortcuts",
+ "settings.threading.groupTitle": "Group emails into conversations",
+ "settings.threading.groupDescription": "Show related messages together as a single thread in message lists.",
+ "settings.threading.latestTitle": "Sort latest messages first",
+ "settings.threading.latestDescription": "Show the newest email at the top of a conversation. Turn this off to show it last.",
+ "settings.spam.loadFailed": "Failed to load spam filter settings",
+ "settings.spam.updateFailed": "Failed to update spam filter settings",
+ "settings.spam.title": "Spam Filter",
+ "settings.spam.description": "Analyze incoming messages locally and detect high-confidence spam",
+ "settings.spam.enable": "Enable spam filter",
+ "settings.trash.loadFailed": "Failed to load clean-up settings",
+ "settings.trash.updateFailed": "Failed to update clean-up settings",
+ "settings.trash.title": "Auto-delete Trash and Spam",
+ "settings.trash.description": "Permanently delete messages once they have been in Trash or Spam for this long. Applies to the mailboxes you own.",
+ "settings.trash.never": "Never",
+ "settings.trash.afterDay.one": "After {count} day",
+ "settings.trash.afterDay.other": "After {count} days",
+ "settings.recipient.title": "Show full recipient addresses",
+ "settings.recipient.description": "On To, Cc, and Bcc, show Name <[email protected]> when the message includes a name. Off shows only the email address. This follows your sign-in, on every mailbox.",
+ "settings.recipient.failed": "Failed to update recipient address settings",
+ "mcp.instructions": "Instructions for your AI agent",
+ "mcp.copyPrompt": "Copy prompt"
}
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index 268918b..62a37f7 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -544,5 +544,57 @@
"apiKeys.lastUsed": "Último uso em {date}",
"apiKeys.neverUsed": "Nunca usada",
"apiKeys.mailboxesLabel": "Caixas de correio: {list}",
- "apiKeys.allAccessible": "Todas as caixas de correio acessíveis (chave existente)"
+ "apiKeys.allAccessible": "Todas as caixas de correio acessíveis (chave existente)",
+ "common.copy": "Copiar",
+ "common.copyLabel": "Copiar {label}",
+ "emailClients.defaultName": "Aplicativo de e-mail",
+ "emailClients.createFailed": "Não foi possível criar uma chave",
+ "emailClients.description": "Senha de aplicativo para clientes de e-mail com suporte a JMAP. Aponte o aplicativo para este servidor e entre com seu endereço de e-mail e uma chave de API como senha.",
+ "emailClients.server": "Servidor",
+ "emailClients.username": "Nome de usuário",
+ "emailClients.anyValue": "qualquer valor",
+ "emailClients.passwordApiKey": "Senha (chave de API)",
+ "emailClients.shownOnce": "Esta chave é exibida uma única vez. Você pode revogá-la em {link}. A descoberta de sessão fica em {url}.",
+ "emailClients.deviceName": "Nome do dispositivo ou aplicativo",
+ "emailClients.devicePlaceholder": "Celular",
+ "emailClients.creating": "Criando...",
+ "emailClients.create": "Criar senha de aplicativo",
+ "emailClients.mailboxesLegend": "Caixas de correio que este aplicativo pode usar",
+ "emailClients.loadingMailboxes": "Carregando caixas de correio...",
+ "emailClients.aliasLimit": "Os aliases compartilham a caixa de correio principal e são incluídos com ela. Até {max} caixas de correio por chave.",
+ "import.failed": "Falha na importação",
+ "import.title": "Importar e-mails",
+ "import.description": "Envie arquivos .eml ou .mbox exportados da origem {source}. Eles serão salvos na seção correspondente da caixa de correio selecionada.",
+ "import.filesLabel": "Arquivos de exportação de e-mail",
+ "import.limits": "Importa até 100 mensagens e 25 MB por envio. Valores de Message-ID duplicados são ignorados.",
+ "import.importing": "Importando...",
+ "import.submit": "Importar mensagens",
+ "import.summary": "{imported} importadas, {skipped} ignoradas",
+ "settings.reading.title": "Leitura em duas colunas",
+ "settings.reading.description": "Mostra a lista de e-mails ao lado do e-mail aberto. Desative para ler e-mails em uma coluna.",
+ "settings.shortcuts.title": "Atalhos de teclado",
+ "settings.shortcuts.description": "Use teclas rápidas para navegar, escrever e gerenciar mensagens nesta conta.",
+ "settings.shortcuts.failed": "Falha ao atualizar as configurações de atalhos",
+ "settings.shortcuts.enable": "Ativar atalhos de teclado",
+ "settings.threading.groupTitle": "Agrupar e-mails em conversas",
+ "settings.threading.groupDescription": "Mostra mensagens relacionadas juntas como uma única conversa nas listas de mensagens.",
+ "settings.threading.latestTitle": "Ordenar mensagens mais recentes primeiro",
+ "settings.threading.latestDescription": "Mostra o e-mail mais recente no topo da conversa. Desative para mostrá-lo por último.",
+ "settings.spam.loadFailed": "Falha ao carregar as configurações do filtro de spam",
+ "settings.spam.updateFailed": "Falha ao atualizar as configurações do filtro de spam",
+ "settings.spam.title": "Filtro de spam",
+ "settings.spam.description": "Analisa as mensagens recebidas localmente e detecta spam com alta confiança",
+ "settings.spam.enable": "Ativar filtro de spam",
+ "settings.trash.loadFailed": "Falha ao carregar as configurações de limpeza",
+ "settings.trash.updateFailed": "Falha ao atualizar as configurações de limpeza",
+ "settings.trash.title": "Excluir automaticamente Lixeira e Spam",
+ "settings.trash.description": "Exclui mensagens permanentemente depois que ficam na Lixeira ou em Spam por este tempo. Vale para as caixas de correio que você possui.",
+ "settings.trash.never": "Nunca",
+ "settings.trash.afterDay.one": "Após {count} dia",
+ "settings.trash.afterDay.other": "Após {count} dias",
+ "settings.recipient.title": "Mostrar endereços completos dos destinatários",
+ "settings.recipient.description": "Em Para, Cc e Cco, mostra Nome <[email protected]> quando a mensagem inclui um nome. Desativado, mostra apenas o endereço de e-mail. Isto acompanha o seu login, em todas as caixas de correio.",
+ "settings.recipient.failed": "Falha ao atualizar as configurações de endereço de destinatário",
+ "mcp.instructions": "Instruções para o seu agente de IA",
+ "mcp.copyPrompt": "Copiar prompt"
}