Skip to content

Email for professionals and teams

Translate mailbox and domain routing rules

Hieu Nguyen (Jack)c3a7d108ae7d
diff --git a/src/components/settings/domain-routing/domain-routing.tsx b/src/components/settings/domain-routing/domain-routing.tsx
index 1a481e8..0640bb8 100644
--- a/src/components/settings/domain-routing/domain-routing.tsx
+++ b/src/components/settings/domain-routing/domain-routing.tsx
@@ -3,6 +3,7 @@
import { useState } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Ban, Forward, Inbox, Info, Pencil, Plus, Trash2 } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -42,6 +43,7 @@ const ACTION_ICONS = {
} as const;
export function DomainRouting({ domain }: DomainRoutingProps = {}) {
+ const { t } = useLanguage();
const qc = useQueryClient();
const { selectedMailbox, isLoading: isMailboxLoading } = useSelectedMailbox();
const [dialogOpen, setDialogOpen] = useState(false);
@@ -113,18 +115,18 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className="flex flex-wrap items-end justify-between gap-4">
<div>
<div className="flex items-center gap-2">
- <h2 className="text-2xl font-semibold">Domain routing</h2>
- <Tooltip label="Block, forward, or deliver mail arriving at this domain.">
- <button type="button" aria-label="About domain routing" className="text-neutral-400 hover:text-neutral-700">
+ <h2 className="text-2xl font-semibold">{t("routing.title")}</h2>
+ <Tooltip label={t("routing.about")}>
+ <button type="button" aria-label={t("routing.aboutLabel")} className="text-neutral-400 hover:text-neutral-700">
<Info className="h-4 w-4" />
</button>
</Tooltip>
</div>
- <p className="mt-1 text-sm text-neutral-500">Rules for {hostname || "Select an inbox"}</p>
+ <p className="mt-1 text-sm text-neutral-500">{t("routing.rulesFor", { host: hostname || t("routing.selectInbox") })}</p>
</div>
<div className="flex items-end gap-2">
<Button onClick={openCreate} disabled={!domainId || (!domain && !mailboxId) || !canManage}>
- <Plus className="h-4 w-4" /> Add route
+ <Plus className="h-4 w-4" /> {t("routing.addRoute")}
</Button>
</div>
</div>
@@ -134,21 +136,21 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
) : !domain && !mailboxId ? (
<Card>
<CardContent className="pt-6 text-sm text-neutral-500">
- Select an inbox before creating routing rules.
+ {t("routing.selectInboxFirst")}
</CardContent>
</Card>
) : !canManage ? (
<Card>
<CardContent className="pt-6 text-sm text-neutral-500">
- Full access to the selected inbox is required to manage domain routing.
+ {t("routing.needFullAccess")}
</CardContent>
</Card>
) : (
<div className="space-y-1 overflow-hidden rounded-3xl">
<RuleSection
className="rounded-b-lg rounded-t-3xl"
- title="Block rules"
- description="Evaluated before delivery. Matching mail is rejected at the edge."
+ title={t("routing.blockRules")}
+ description={t("routing.blockRulesDescription")}
rules={blockRules}
hostname={hostname}
mailboxes={mailboxes}
@@ -158,8 +160,8 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
/>
<RuleSection
className="rounded-b-3xl rounded-t-lg"
- title="Catch-all and forwarding"
- description="Evaluated only when no mailbox on the domain matched the recipient."
+ title={t("routing.catchAll")}
+ description={t("routing.catchAllDescription")}
rules={fallbackRules}
hostname={hostname}
mailboxes={mailboxes}
@@ -174,8 +176,8 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
{/* The form grows when the action changes, so the dialog must scroll rather than overflow the viewport. */}
<DialogContent className="max-h-[calc(100vh-4rem)] overflow-y-auto sm:max-w-[560px]">
<DialogHeader>
- <DialogTitle>{editing ? "Edit rule" : "Add routing rule"}</DialogTitle>
- <DialogDescription>Choose what happens to matching mail.</DialogDescription>
+ <DialogTitle>{editing ? t("routing.editRule") : t("routing.addRule")}</DialogTitle>
+ <DialogDescription>{t("routing.dialogDescription")}</DialogDescription>
</DialogHeader>
<form
@@ -187,17 +189,17 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
>
<div className="grid grid-cols-1 items-end gap-4 sm:grid-cols-2">
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-name">Name</Label>
+ <Label htmlFor="rule-name">{t("common.name")}</Label>
<Input
id="rule-name"
value={form.name ?? ""}
- placeholder="Optional label"
+ placeholder={t("routing.optionalLabel")}
onChange={(e) => setForm({ ...form, name: e.target.value })}
/>
</div>
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-action">Action</Label>
+ <Label htmlFor="rule-action">{t("routing.action")}</Label>
<RoutingRuleSelect
id="rule-action"
value={form.action}
@@ -207,7 +209,7 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
>
{Object.entries(ACTION_LABELS).map(([value, label]) => (
<option key={value} value={value}>
- {label}
+ {t(label)}
</option>
))}
</RoutingRuleSelect>
@@ -216,7 +218,7 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className="grid grid-cols-1 items-end gap-4 sm:grid-cols-2">
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-field">Match on</Label>
+ <Label htmlFor="rule-field">{t("routing.matchOn")}</Label>
<RoutingRuleSelect
id="rule-field"
value={form.matchField}
@@ -226,13 +228,13 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
>
{Object.entries(MATCH_FIELD_LABELS).map(([value, label]) => (
<option key={value} value={value}>
- {label}
+ {t(label)}
</option>
))}
</RoutingRuleSelect>
</div>
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-operator">Condition</Label>
+ <Label htmlFor="rule-operator">{t("routing.condition")}</Label>
<RoutingRuleSelect
id="rule-operator"
value={form.matchOperator}
@@ -245,7 +247,7 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
>
{Object.entries(MATCH_OPERATOR_LABELS).map(([value, label]) => (
<option key={value} value={value}>
- {label}
+ {t(label)}
</option>
))}
</RoutingRuleSelect>
@@ -255,8 +257,8 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className="grid grid-cols-1 items-end gap-4 sm:grid-cols-2">
<div className="grid min-w-0 gap-2">
<div className="flex items-center gap-2">
- <Label htmlFor="rule-value">Match value</Label>
- <Tooltip label="Use * to match every message.">
+ <Label htmlFor="rule-value">{t("routing.matchValue")}</Label>
+ <Tooltip label={t("routing.matchAllHint")}>
<span className="text-neutral-400"><Info className="h-4 w-4" /></span>
</Tooltip>
</div>
@@ -264,14 +266,14 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
id="rule-value"
required
value={form.matchValue}
- placeholder="* to match everything"
+ placeholder={t("routing.matchAllPlaceholder")}
onChange={(e) => setForm({ ...form, matchValue: e.target.value })}
/>
</div>
<div className="grid min-w-0 gap-2">
<div className="flex items-center gap-2">
- <Label htmlFor="rule-priority">Priority</Label>
- <Tooltip label="Higher numbers run first.">
+ <Label htmlFor="rule-priority">{t("routing.priority")}</Label>
+ <Tooltip label={t("routing.priorityHint")}>
<span className="text-neutral-400"><Info className="h-4 w-4" /></span>
</Tooltip>
</div>
@@ -290,25 +292,25 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className={form.action === "forward" ? "grid grid-cols-1 items-end gap-4 sm:grid-cols-2" : "grid min-w-0 gap-2"}>
<div className="grid min-w-0 gap-2">
<Label htmlFor="rule-mailbox">
- {form.action === "forward" ? "Mailbox for the kept copy" : "Destination mailbox"}
+ {form.action === "forward" ? t("routing.keptCopyMailbox") : t("routing.destinationMailbox")}
</Label>
<RoutingRuleSelect
id="rule-mailbox"
value={form.mailboxId ?? ""}
onChange={(e) => setForm({ ...form, mailboxId: e.target.value || null })}
>
- <option value="">Select a mailbox</option>
+ <option value="">{t("routing.selectMailbox")}</option>
{mailboxes.map((mailbox) => (
<option key={mailbox.id} value={mailbox.id}>
{mailbox.localPart}@{hostname}
- {mailbox.disabled ? " (disabled)" : ""}
+ {mailbox.disabled ? t("routing.disabledSuffix") : ""}
</option>
))}
</RoutingRuleSelect>
</div>
{form.action === "forward" && (
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-forward">Forward to</Label>
+ <Label htmlFor="rule-forward">{t("routing.forwardTo")}</Label>
<Input
id="rule-forward"
type="email"
@@ -325,8 +327,8 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className="flex items-center justify-between rounded-lg border border-neutral-200 px-3 py-2">
<div>
<div className="flex items-center gap-2">
- <p className="text-sm font-medium">Keep a copy</p>
- <Tooltip label="Also store the message in the selected inbox.">
+ <p className="text-sm font-medium">{t("routing.keepCopy")}</p>
+ <Tooltip label={t("routing.keepCopyHint")}>
<span className="text-neutral-400"><Info className="h-4 w-4" /></span>
</Tooltip>
</div>
@@ -340,11 +342,11 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
{form.action === "reject" && (
<div className="grid min-w-0 gap-2">
- <Label htmlFor="rule-reason">Rejection reason</Label>
+ <Label htmlFor="rule-reason">{t("routing.rejectReason")}</Label>
<Input
id="rule-reason"
value={form.rejectReason ?? ""}
- placeholder="Message rejected by routing rule"
+ placeholder={t("routing.rejectPlaceholder")}
onChange={(e) => setForm({ ...form, rejectReason: e.target.value })}
/>
</div>
@@ -354,10 +356,10 @@ export function DomainRouting({ domain }: DomainRoutingProps = {}) {
<div className="flex justify-end gap-2 border-t border-neutral-200 pt-4">
<Button type="button" variant="outline" onClick={() => setDialogOpen(false)}>
- Cancel
+ {t("common.cancel")}
</Button>
<Button type="submit" disabled={save.isPending}>
- {editing ? "Save changes" : "Create rule"}
+ {editing ? t("rules.saveChanges") : t("rules.create")}
</Button>
</div>
</form>
@@ -388,6 +390,7 @@ function RuleSection({
onDelete: (id: string) => void;
onToggle: (rule: DomainRule) => void;
}) {
+ const { t } = useLanguage();
return (
<Card className={`${className} border-0 bg-white px-6`}>
<CardHeader>
@@ -400,7 +403,7 @@ function RuleSection({
</CardHeader>
<CardContent className="space-y-2 pb-5">
{rules.length === 0 ? (
- <p className="text-sm text-neutral-500">No rules yet.</p>
+ <p className="text-sm text-neutral-500">{t("routing.noRules")}</p>
) : (
rules.map((rule) => {
const Icon = ACTION_ICONS[rule.action];
@@ -413,18 +416,17 @@ function RuleSection({
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<p className="truncate text-sm font-medium">
- {rule.name || describeRule(rule, mailboxes, hostname)}
+ {rule.name || describeRule(rule, mailboxes, hostname, t)}
</p>
- {!rule.enabled && <Badge variant="secondary">Disabled</Badge>}
+ {!rule.enabled && <Badge variant="secondary">{t("routing.disabled")}</Badge>}
</div>
{rule.name && (
<p className="truncate text-xs text-neutral-500">
- {describeRule(rule, mailboxes, hostname)}
+ {describeRule(rule, mailboxes, hostname, t)}
</p>
)}
<p className="text-xs text-neutral-400">
- Priority {rule.priority} · matched {rule.matchCount}× · last{" "}
- {formatLastMatched(rule.lastMatchedAt)}
+ {t("routing.stats", { priority: rule.priority, count: rule.matchCount, last: formatLastMatched(rule.lastMatchedAt, t) })}
</p>
</div>
<Switch checked={rule.enabled} onCheckedChange={() => onToggle(rule)} />
diff --git a/src/components/settings/domain-routing/utils.ts b/src/components/settings/domain-routing/utils.ts
index ade1702..eb2733d 100644
--- a/src/components/settings/domain-routing/utils.ts
+++ b/src/components/settings/domain-routing/utils.ts
@@ -1,3 +1,5 @@
+import type { TranslationKey } from "@/lib/i18n/types";
+import { defaultTranslator, type Translator } from "@/lib/i18n/utils";
import { authFetch } from "@/lib/auth/client";
import { formatUserDate } from "@/lib/time/utils";
import type {
@@ -8,31 +10,31 @@ import type {
DomainRuleOperator,
} from "./types";
-export const MATCH_FIELD_LABELS: Record<DomainRuleField, string> = {
- recipient: "Recipient address",
- sender: "Sender address",
- title: "Subject",
- content: "Body",
+export const MATCH_FIELD_LABELS: Record<DomainRuleField, TranslationKey> = {
+ recipient: "routing.field.recipient",
+ sender: "routing.field.sender",
+ title: "routing.field.title",
+ content: "routing.field.content",
};
-export const MATCH_OPERATOR_LABELS: Record<DomainRuleOperator, string> = {
- contains: "contains",
- exact: "is exactly",
- starts_with: "starts with",
- ends_with: "ends with",
- regex: "matches regex",
+export const MATCH_OPERATOR_LABELS: Record<DomainRuleOperator, TranslationKey> = {
+ contains: "routing.operator.contains",
+ exact: "routing.operator.exact",
+ starts_with: "routing.operator.starts_with",
+ ends_with: "routing.operator.ends_with",
+ regex: "routing.operator.regex",
};
export const ACTION_LABELS = {
- store: "Deliver to mailbox",
- forward: "Forward to address",
- reject: "Reject / block",
-} as const;
+ store: "routing.action.store",
+ forward: "routing.action.forward",
+ reject: "routing.action.reject",
+} satisfies Record<DomainRule["action"], TranslationKey>;
async function readJson<T>(res: Response): Promise<T> {
const json = (await res.json()) as T & { error?: unknown };
if (!res.ok) {
- throw new Error(typeof json.error === "string" ? json.error : "Request failed");
+ throw new Error(typeof json.error === "string" ? json.error : defaultTranslator("routing.requestFailed"));
}
return json;
}
@@ -81,26 +83,25 @@ export async function deleteDomainRule(id: string, mailboxId?: string) {
return readJson(await authFetch(domainRuleUrl(id, mailboxId), { method: "DELETE" }));
}
-export function describeRule(rule: DomainRule, mailboxes: DomainRuleMailbox[], hostname: string): string {
+export function describeRule(rule: DomainRule, mailboxes: DomainRuleMailbox[], hostname: string, t: Translator = defaultTranslator): string {
const condition =
rule.matchValue === "*"
- ? "Any message"
- : `${MATCH_FIELD_LABELS[rule.matchField]} ${MATCH_OPERATOR_LABELS[rule.matchOperator]} "${rule.matchValue}"`;
+ ? t("routing.anyMessage")
+ : `${t(MATCH_FIELD_LABELS[rule.matchField])} ${t(MATCH_OPERATOR_LABELS[rule.matchOperator])} "${rule.matchValue}"`;
- if (rule.action === "reject") return `${condition} → reject`;
+ if (rule.action === "reject") return t("routing.describe.reject", { condition });
if (rule.action === "forward") {
- const copy = rule.keepCopy ? " and keep a copy" : "";
- return `${condition} → forward to ${rule.forwardTo ?? "—"}${copy}`;
+ return t(rule.keepCopy ? "routing.describe.forwardCopy" : "routing.describe.forward", { condition, to: rule.forwardTo ?? "—" });
}
const mailbox = mailboxes.find((m) => m.id === rule.mailboxId);
const address = mailbox ? `${mailbox.localPart}@${hostname}` : "—";
- return `${condition} → deliver to ${address}`;
+ return t("routing.describe.store", { condition, address });
}
-export function formatLastMatched(value: DomainRule["lastMatchedAt"]): string {
- if (value === null || value === undefined) return "Never";
+export function formatLastMatched(value: DomainRule["lastMatchedAt"], t: Translator = defaultTranslator): string {
+ if (value === null || value === undefined) return t("routing.never");
const numeric = typeof value === "number" ? value : Date.parse(String(value));
- if (!Number.isFinite(numeric)) return "Never";
+ if (!Number.isFinite(numeric)) return t("routing.never");
// Drizzle timestamps serialise as seconds when they bypass the mapper.
const ms = numeric < 1e12 ? numeric * 1000 : numeric;
return formatUserDate(new Date(ms), { dateStyle: "medium", timeStyle: "short" });
diff --git a/src/components/settings/inbox-rules-utils.ts b/src/components/settings/inbox-rules-utils.ts
index c57e642..d1bc8cf 100644
--- a/src/components/settings/inbox-rules-utils.ts
+++ b/src/components/settings/inbox-rules-utils.ts
@@ -1,3 +1,4 @@
+import { defaultTranslator, type Translator } from "@/lib/i18n/utils";
import { authFetch } from "@/lib/auth/client";
import type { InboxRule, InboxRuleInput, InboxRulesResponse, RuleFoldersResponse } from "./inbox-rules-types";
@@ -42,14 +43,14 @@ export async function deleteInboxRule(ruleId: string) {
if (!response.ok) throw new Error("Failed to delete rule");
}
-export function getRuleFieldLabel(field: string): string {
- if (field === "content") return "Content";
- if (field === "title") return "Title";
- return "Email address";
+export function getRuleFieldLabel(field: string, t: Translator = defaultTranslator): string {
+ if (field === "content") return t("rules.field.content");
+ if (field === "title") return t("rules.field.title");
+ return t("rules.field.email");
}
-export function getRuleOperatorLabel(operator: string): string {
- return operator === "exact" ? "exact match" : "contains";
+export function getRuleOperatorLabel(operator: string, t: Translator = defaultTranslator): string {
+ return operator === "exact" ? t("rules.operator.exact") : t("rules.operator.contains");
}
export function getInboxRuleDestination(rule: Pick<InboxRule, "action" | "folderId">): string {
diff --git a/src/components/settings/inbox-rules.tsx b/src/components/settings/inbox-rules.tsx
index ce6a30a..4249dfd 100644
--- a/src/components/settings/inbox-rules.tsx
+++ b/src/components/settings/inbox-rules.tsx
@@ -4,6 +4,7 @@ import type { FormEvent, KeyboardEvent } from "react";
import { useState } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Folder, Plus, ShieldAlert, Trash2 } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { useSelectedMailbox } from "@/components/mailbox-provider";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -30,6 +31,7 @@ import {
} from "./inbox-rules-utils";
export function InboxRules() {
+ const { t } = useLanguage();
const queryClient = useQueryClient();
const { selectedMailbox } = useSelectedMailbox();
const [dialogOpen, setDialogOpen] = useState(false);
@@ -88,9 +90,9 @@ export function InboxRules() {
function getRuleDestinationLabel(
rule: Pick<InboxRule, "action" | "folderId">,
) {
- if (rule.action === "spam") return "Spam";
- if (rule.action === "trash") return "Trash";
- return folderMap.get(rule.folderId ?? "") ?? "Unknown folder";
+ if (rule.action === "spam") return t("navigation.spam");
+ if (rule.action === "trash") return t("navigation.trash");
+ return folderMap.get(rule.folderId ?? "") ?? t("rules.unknownFolder");
}
function openCreateDialog() {
@@ -132,21 +134,21 @@ export function InboxRules() {
<div className="flex flex-row items-center">
<header className="flex-1">
<h2 className="text-2xl font-semibold text-neutral-900">
- Mailbox rules
+ {t("rules.mailboxTitle")}
</h2>
<p className="mt-1 text-sm text-neutral-500">
- Applied after delivery.
+ {t("rules.appliedAfterDelivery")}
</p>
</header>
<Button type="button" onClick={openCreateDialog} disabled={!mailboxId}>
<Plus className="h-4 w-4" />
- New rule
+ {t("rules.new")}
</Button>
</div>
<div className="rounded-3xl bg-white p-6">
{(rules.data?.rules ?? []).length === 0 && (
- <p className="text-sm text-neutral-500">No rules yet</p>
+ <p className="text-sm text-neutral-500">{t("rules.none")}</p>
)}
<div className="space-y-1">
{(rules.data?.rules ?? []).map((rule) => (
@@ -169,8 +171,8 @@ export function InboxRules() {
</div>
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium text-neutral-900">
- {getRuleFieldLabel(rule.matchField)}{" "}
- {getRuleOperatorLabel(rule.matchOperator)}{" "}
+ {getRuleFieldLabel(rule.matchField, t)}{" "}
+ {getRuleOperatorLabel(rule.matchOperator, t)}{" "}
{rule.matchValue || rule.pattern}
</p>
<p className="truncate text-xs text-neutral-500">
@@ -188,7 +190,7 @@ export function InboxRules() {
}}
onKeyDown={(event) => event.stopPropagation()}
className="opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100"
- aria-label="Delete rule"
+ aria-label={t("rules.delete")}
>
<Trash2 className="h-4 w-4" />
</Button>
@@ -201,16 +203,16 @@ export function InboxRules() {
<DialogContent className="max-h-[calc(100vh-4rem)] overflow-y-auto sm:max-w-[560px]">
<DialogHeader>
<DialogTitle>
- {editingRule ? "Update rule" : "New rule"}
+ {editingRule ? t("rules.update") : t("rules.new")}
</DialogTitle>
<DialogDescription>
- Choose what to match and where the message should go.
+ {t("rules.dialogDescription")}
</DialogDescription>
</DialogHeader>
<form onSubmit={onSubmit} className="space-y-4">
<div className="grid grid-cols-1 items-end gap-4 sm:grid-cols-2">
<div className="grid min-w-0 gap-2">
- <Label htmlFor="matchField">Field</Label>
+ <Label htmlFor="matchField">{t("rules.fieldLabel")}</Label>
<RoutingRuleSelect
id="matchField"
value={matchField}
@@ -220,13 +222,13 @@ export function InboxRules() {
)
}
>
- <option value="email">Email address</option>
- <option value="content">Content</option>
- <option value="title">Title</option>
+ <option value="email">{t("rules.field.email")}</option>
+ <option value="content">{t("rules.field.content")}</option>
+ <option value="title">{t("rules.field.title")}</option>
</RoutingRuleSelect>
</div>
<div className="grid min-w-0 gap-2">
- <Label htmlFor="matchOperator">Match</Label>
+ <Label htmlFor="matchOperator">{t("rules.matchLabel")}</Label>
<RoutingRuleSelect
id="matchOperator"
value={matchOperator}
@@ -234,33 +236,33 @@ export function InboxRules() {
setMatchOperator(event.target.value as "contains" | "exact")
}
>
- <option value="contains">Contains</option>
- <option value="exact">Exact match</option>
+ <option value="contains">{t("rules.operatorOption.contains")}</option>
+ <option value="exact">{t("rules.operatorOption.exact")}</option>
</RoutingRuleSelect>
</div>
</div>
<div className="grid grid-cols-1 items-end gap-4 sm:grid-cols-2">
<div className="grid min-w-0 gap-2">
- <Label htmlFor="matchValue">Value</Label>
+ <Label htmlFor="matchValue">{t("rules.valueLabel")}</Label>
<Input
id="matchValue"
value={matchValue}
onChange={(event) => setMatchValue(event.target.value)}
placeholder={
- matchField === "email" ? "[email protected]" : "Invoice"
+ matchField === "email" ? t("rules.valuePlaceholderEmail") : t("rules.valuePlaceholderOther")
}
/>
</div>
<div className="grid min-w-0 gap-2">
- <Label htmlFor="destination">Destination</Label>
+ <Label htmlFor="destination">{t("rules.destination")}</Label>
<RoutingRuleSelect
id="destination"
value={destination}
onChange={(event) => setDestination(event.target.value)}
>
- <option value="">Select destination</option>
- <option value="spam">Spam</option>
- <option value="trash">Trash</option>
+ <option value="">{t("rules.selectDestination")}</option>
+ <option value="spam">{t("navigation.spam")}</option>
+ <option value="trash">{t("navigation.trash")}</option>
{(folders.data?.folders ?? []).map((folder) => (
<option key={folder.id} value={`folder:${folder.id}`}>
{folder.name}
@@ -278,7 +280,7 @@ export function InboxRules() {
variant="outline"
onClick={() => setDialogOpen(false)}
>
- Cancel
+ {t("common.cancel")}
</Button>
<Button
type="submit"
@@ -290,10 +292,10 @@ export function InboxRules() {
}
>
{save.isPending
- ? "Saving..."
+ ? t("common.saving")
: editingRule
- ? "Save changes"
- : "Create rule"}
+ ? t("rules.saveChanges")
+ : t("rules.create")}
</Button>
</div>
</form>
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 66e1e2d..5b25999 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -596,5 +596,84 @@
"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"
+ "mcp.copyPrompt": "Copy prompt",
+ "rules.field.email": "Email address",
+ "rules.field.content": "Content",
+ "rules.field.title": "Title",
+ "rules.operator.contains": "contains",
+ "rules.operator.exact": "exact match",
+ "rules.operatorOption.contains": "Contains",
+ "rules.operatorOption.exact": "Exact match",
+ "rules.unknownFolder": "Unknown folder",
+ "rules.mailboxTitle": "Mailbox rules",
+ "rules.appliedAfterDelivery": "Applied after delivery.",
+ "rules.new": "New rule",
+ "rules.none": "No rules yet",
+ "rules.delete": "Delete rule",
+ "rules.update": "Update rule",
+ "rules.dialogDescription": "Choose what to match and where the message should go.",
+ "rules.fieldLabel": "Field",
+ "rules.matchLabel": "Match",
+ "rules.valueLabel": "Value",
+ "rules.valuePlaceholderEmail": "[email protected]",
+ "rules.valuePlaceholderOther": "Invoice",
+ "rules.destination": "Destination",
+ "rules.selectDestination": "Select destination",
+ "rules.saveChanges": "Save changes",
+ "rules.create": "Create rule",
+ "routing.field.recipient": "Recipient address",
+ "routing.field.sender": "Sender address",
+ "routing.field.title": "Subject",
+ "routing.field.content": "Body",
+ "routing.operator.contains": "contains",
+ "routing.operator.exact": "is exactly",
+ "routing.operator.starts_with": "starts with",
+ "routing.operator.ends_with": "ends with",
+ "routing.operator.regex": "matches regex",
+ "routing.action.store": "Deliver to mailbox",
+ "routing.action.forward": "Forward to address",
+ "routing.action.reject": "Reject / block",
+ "routing.requestFailed": "Request failed",
+ "routing.anyMessage": "Any message",
+ "routing.describe.reject": "{condition} → reject",
+ "routing.describe.forward": "{condition} → forward to {to}",
+ "routing.describe.forwardCopy": "{condition} → forward to {to} and keep a copy",
+ "routing.describe.store": "{condition} → deliver to {address}",
+ "routing.never": "Never",
+ "routing.title": "Domain routing",
+ "routing.about": "Block, forward, or deliver mail arriving at this domain.",
+ "routing.aboutLabel": "About domain routing",
+ "routing.rulesFor": "Rules for {host}",
+ "routing.selectInbox": "Select an inbox",
+ "routing.addRoute": "Add route",
+ "routing.selectInboxFirst": "Select an inbox before creating routing rules.",
+ "routing.needFullAccess": "Full access to the selected inbox is required to manage domain routing.",
+ "routing.blockRules": "Block rules",
+ "routing.blockRulesDescription": "Evaluated before delivery. Matching mail is rejected at the edge.",
+ "routing.catchAll": "Catch-all and forwarding",
+ "routing.catchAllDescription": "Evaluated only when no mailbox on the domain matched the recipient.",
+ "routing.editRule": "Edit rule",
+ "routing.addRule": "Add routing rule",
+ "routing.dialogDescription": "Choose what happens to matching mail.",
+ "routing.optionalLabel": "Optional label",
+ "routing.action": "Action",
+ "routing.matchOn": "Match on",
+ "routing.condition": "Condition",
+ "routing.matchValue": "Match value",
+ "routing.matchAllHint": "Use * to match every message.",
+ "routing.matchAllPlaceholder": "* to match everything",
+ "routing.priority": "Priority",
+ "routing.priorityHint": "Higher numbers run first.",
+ "routing.keptCopyMailbox": "Mailbox for the kept copy",
+ "routing.destinationMailbox": "Destination mailbox",
+ "routing.selectMailbox": "Select a mailbox",
+ "routing.disabledSuffix": " (disabled)",
+ "routing.forwardTo": "Forward to",
+ "routing.keepCopy": "Keep a copy",
+ "routing.keepCopyHint": "Also store the message in the selected inbox.",
+ "routing.rejectReason": "Rejection reason",
+ "routing.rejectPlaceholder": "Message rejected by routing rule",
+ "routing.noRules": "No rules yet.",
+ "routing.disabled": "Disabled",
+ "routing.stats": "Priority {priority} · matched {count}× · last {last}"
}
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index 62a37f7..947bc8f 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -596,5 +596,84 @@
"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"
+ "mcp.copyPrompt": "Copiar prompt",
+ "rules.field.email": "Endereço de e-mail",
+ "rules.field.content": "Conteúdo",
+ "rules.field.title": "Título",
+ "rules.operator.contains": "contém",
+ "rules.operator.exact": "correspondência exata",
+ "rules.operatorOption.contains": "Contém",
+ "rules.operatorOption.exact": "Correspondência exata",
+ "rules.unknownFolder": "Pasta desconhecida",
+ "rules.mailboxTitle": "Regras da caixa de correio",
+ "rules.appliedAfterDelivery": "Aplicadas após a entrega.",
+ "rules.new": "Nova regra",
+ "rules.none": "Nenhuma regra ainda",
+ "rules.delete": "Excluir regra",
+ "rules.update": "Atualizar regra",
+ "rules.dialogDescription": "Escolha o que corresponder e para onde a mensagem deve ir.",
+ "rules.fieldLabel": "Campo",
+ "rules.matchLabel": "Correspondência",
+ "rules.valueLabel": "Valor",
+ "rules.valuePlaceholderEmail": "[email protected]",
+ "rules.valuePlaceholderOther": "Fatura",
+ "rules.destination": "Destino",
+ "rules.selectDestination": "Selecionar destino",
+ "rules.saveChanges": "Salvar alterações",
+ "rules.create": "Criar regra",
+ "routing.field.recipient": "Endereço do destinatário",
+ "routing.field.sender": "Endereço do remetente",
+ "routing.field.title": "Assunto",
+ "routing.field.content": "Corpo",
+ "routing.operator.contains": "contém",
+ "routing.operator.exact": "é exatamente",
+ "routing.operator.starts_with": "começa com",
+ "routing.operator.ends_with": "termina com",
+ "routing.operator.regex": "corresponde à regex",
+ "routing.action.store": "Entregar na caixa de correio",
+ "routing.action.forward": "Encaminhar para endereço",
+ "routing.action.reject": "Rejeitar / bloquear",
+ "routing.requestFailed": "Falha na requisição",
+ "routing.anyMessage": "Qualquer mensagem",
+ "routing.describe.reject": "{condition} → rejeitar",
+ "routing.describe.forward": "{condition} → encaminhar para {to}",
+ "routing.describe.forwardCopy": "{condition} → encaminhar para {to} e manter uma cópia",
+ "routing.describe.store": "{condition} → entregar em {address}",
+ "routing.never": "Nunca",
+ "routing.title": "Roteamento de domínio",
+ "routing.about": "Bloqueie, encaminhe ou entregue e-mails que chegam a este domínio.",
+ "routing.aboutLabel": "Sobre o roteamento de domínio",
+ "routing.rulesFor": "Regras para {host}",
+ "routing.selectInbox": "Selecione uma caixa de entrada",
+ "routing.addRoute": "Adicionar rota",
+ "routing.selectInboxFirst": "Selecione uma caixa de entrada antes de criar regras de roteamento.",
+ "routing.needFullAccess": "É necessário acesso total à caixa de entrada selecionada para gerenciar o roteamento de domínio.",
+ "routing.blockRules": "Regras de bloqueio",
+ "routing.blockRulesDescription": "Avaliadas antes da entrega. E-mails correspondentes são rejeitados na borda.",
+ "routing.catchAll": "Captura geral e encaminhamento",
+ "routing.catchAllDescription": "Avaliadas apenas quando nenhuma caixa de correio do domínio correspondeu ao destinatário.",
+ "routing.editRule": "Editar regra",
+ "routing.addRule": "Adicionar regra de roteamento",
+ "routing.dialogDescription": "Escolha o que acontece com os e-mails correspondentes.",
+ "routing.optionalLabel": "Rótulo opcional",
+ "routing.action": "Ação",
+ "routing.matchOn": "Corresponder em",
+ "routing.condition": "Condição",
+ "routing.matchValue": "Valor de correspondência",
+ "routing.matchAllHint": "Use * para corresponder a todas as mensagens.",
+ "routing.matchAllPlaceholder": "* para corresponder a tudo",
+ "routing.priority": "Prioridade",
+ "routing.priorityHint": "Números maiores são executados primeiro.",
+ "routing.keptCopyMailbox": "Caixa de correio da cópia mantida",
+ "routing.destinationMailbox": "Caixa de correio de destino",
+ "routing.selectMailbox": "Selecione uma caixa de correio",
+ "routing.disabledSuffix": " (desativada)",
+ "routing.forwardTo": "Encaminhar para",
+ "routing.keepCopy": "Manter uma cópia",
+ "routing.keepCopyHint": "Também armazena a mensagem na caixa de entrada selecionada.",
+ "routing.rejectReason": "Motivo da rejeição",
+ "routing.rejectPlaceholder": "Mensagem rejeitada por regra de roteamento",
+ "routing.noRules": "Nenhuma regra ainda.",
+ "routing.disabled": "Desativada",
+ "routing.stats": "Prioridade {priority} · correspondeu {count}× · última {last}"
}