Skip to content

Email for professionals and teams

Translate admin overview, general, routing and accounts

Hieu Nguyen (Jack)316fce247989
diff --git a/src/app/(admin)/accounts/account-aliases.tsx b/src/app/(admin)/accounts/account-aliases.tsx
index dfcb2e6..d833478 100644
--- a/src/app/(admin)/accounts/account-aliases.tsx
+++ b/src/app/(admin)/accounts/account-aliases.tsx
@@ -1,6 +1,7 @@
"use client";
import { Plus, Trash2 } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
@@ -8,32 +9,32 @@ import { Select } from "@/components/ui/select";
import type { AccountAliasesProps } from "./types";
export function AccountAliases({ domains, domainId, username, useAllDomains, onUseAllDomainsChange, aliases, onAliasesChange }: AccountAliasesProps) {
+ const { t } = useLanguage();
const availableDomains = domains.filter((domain) => domain.status === "active");
return (
<div className="space-y-4 border-t border-neutral-100 pt-4">
<label className="flex items-start gap-3 rounded-xl bg-neutral-50 p-4">
<Checkbox checked={useAllDomains} onChange={(event) => onUseAllDomainsChange(event.target.checked)} />
<span>
- <span className="block text-sm font-medium">Use all domains</span>
+ <span className="block text-sm font-medium">{t("aliases.useAll")}</span>
<span className="mt-1 block text-sm text-neutral-500">
- Use this username on every available domain, including domains added later.
- When off, only the primary address and the aliases below are assigned.
+ {t("aliases.useAllHint")}
</span>
</span>
</label>
<div className="space-y-3">
<div>
- <p className="text-sm font-medium">Additional aliases <span className="font-normal text-neutral-500">(optional)</span></p>
- <p className="mt-1 text-sm text-neutral-500">These addresses share the new account’s inbox and can also be used to send mail.</p>
+ <p className="text-sm font-medium">{t("aliases.additional")} <span className="font-normal text-neutral-500">{t("aliases.optional")}</span></p>
+ <p className="mt-1 text-sm text-neutral-500">{t("aliases.hint")}</p>
</div>
{aliases.map((alias, index) => (
<div key={alias.id} className="flex items-center gap-2">
<div className="flex min-w-0 flex-1 items-center gap-1 rounded-md border border-neutral-200 bg-white">
<Input
- aria-label={`Alias ${index + 1} username`}
+ aria-label={t("aliases.usernameLabel", { n: index + 1 })}
value={alias.localPart}
onChange={(event) => onAliasesChange(aliases.map((item) => item.id === alias.id ? { ...item, localPart: event.target.value } : item))}
- placeholder="username"
+ placeholder={t("accounts.username")}
className="min-w-0 flex-1 rounded-none border-0 shadow-none"
pattern="[a-zA-Z0-9._%+\-]+"
maxLength={64}
@@ -41,7 +42,7 @@ export function AccountAliases({ domains, domainId, username, useAllDomains, onU
/>
<span className="text-sm text-neutral-400">@</span>
<Select
- aria-label={`Alias ${index + 1} domain`}
+ aria-label={t("aliases.domainLabel", { n: index + 1 })}
value={alias.domainId}
onChange={(event) => onAliasesChange(aliases.map((item) => item.id === alias.id ? { ...item, domainId: event.target.value } : item))}
containerClassName="min-w-0 flex-1 self-stretch rounded-none border-0 px-0"
@@ -51,7 +52,7 @@ export function AccountAliases({ domains, domainId, username, useAllDomains, onU
{availableDomains.map((domain) => <option key={domain.id} value={domain.id}>{domain.hostname}</option>)}
</Select>
</div>
- <Button type="button" variant="ghost" size="sm" className="h-10 w-10 shrink-0 p-0" aria-label={`Remove alias ${index + 1}`} onClick={() => onAliasesChange(aliases.filter((item) => item.id !== alias.id))}>
+ <Button type="button" variant="ghost" size="sm" className="h-10 w-10 shrink-0 p-0" aria-label={t("aliases.remove", { n: index + 1 })} onClick={() => onAliasesChange(aliases.filter((item) => item.id !== alias.id))}>
<Trash2 className="h-4 w-4" />
</Button>
</div>
@@ -60,7 +61,7 @@ export function AccountAliases({ domains, domainId, username, useAllDomains, onU
...aliases,
{ id: crypto.randomUUID(), localPart: username.trim(), domainId: (availableDomains.find((domain) => domain.id !== domainId) ?? availableDomains[0]).id },
])}>
- <Plus className="h-4 w-4" /> Add alias
+ <Plus className="h-4 w-4" /> {t("aliases.add")}
</Button>
</div>
</div>
diff --git a/src/app/(admin)/accounts/page.tsx b/src/app/(admin)/accounts/page.tsx
index 8271b64..33a1f5b 100644
--- a/src/app/(admin)/accounts/page.tsx
+++ b/src/app/(admin)/accounts/page.tsx
@@ -4,6 +4,7 @@ import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useEffect, useState } from "react";
import Link from "next/link";
import { Plus } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
@@ -15,17 +16,19 @@ import { getAvatarColorStyle } from "@/lib/avatar-colors";
import { LicenseRequiredOverlay } from "@/components/license-required-overlay";
import { List, ListRow } from "@/components/ui/list";
import { useCurrentUser } from "@/hooks/use-current-user";
+import { defaultTranslator } from "@/lib/i18n/utils";
import { AccountAliases } from "./account-aliases";
import type { Account, AccountAliasDraft, AccountResponse, Domain } from "./types";
async function fetchAccounts(): Promise<Account[]> {
const response = await authFetch("/api/accounts");
const data = (await response.json()) as AccountResponse;
- if (!response.ok) throw new Error(data.error ?? "Unable to load accounts");
+ if (!response.ok) throw new Error(data.error ?? defaultTranslator("accounts.loadFailed"));
return data.accounts ?? [];
}
export default function AccountsPage() {
+ const { t } = useLanguage();
const currentUser = useCurrentUser();
const canManage = !!currentUser && (currentUser.isPrimaryAdmin || currentUser.canManageUsers);
const canChooseRole = !!currentUser?.isPrimaryAdmin;
@@ -52,11 +55,11 @@ export default function AccountsPage() {
setAccounts(accounts);
const response = await authFetch("/api/domains");
const data = (await response.json()) as { domains?: Domain[]; error?: string };
- if (!response.ok) throw new Error(data.error ?? "Unable to load domains");
+ if (!response.ok) throw new Error(data.error ?? t("accounts.domainsFailed"));
setDomains(data.domains ?? []);
setDomainId(data.domains?.[0]?.id ?? "");
}).catch((error) => {
- const text = error instanceof Error ? error.message : "Unable to load accounts";
+ const text = error instanceof Error ? error.message : t("accounts.loadFailed");
setTeamRequired(/team license/i.test(text));
setMessage(text);
}).finally(() => setLoading(false));
@@ -73,7 +76,7 @@ export default function AccountsPage() {
body: JSON.stringify({ username, domainId, password, role, useAllDomains, aliases: aliases.map(({ domainId, localPart }) => ({ domainId, localPart })) }),
});
const data = (await response.json()) as AccountResponse;
- if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : "Check the account and alias details and try again");
+ if (!response.ok) throw new Error(typeof data.error === "string" ? data.error : t("accounts.checkDetails"));
setUsername("");
setPassword("");
setUseAllDomains(false);
@@ -81,34 +84,34 @@ export default function AccountsPage() {
setCreateOpen(false);
await loadAccounts();
} catch (error) {
- setMessage(error instanceof Error ? error.message : "Unable to create account");
+ setMessage(error instanceof Error ? error.message : t("accounts.createFailed"));
} finally {
setSaving(false);
}
}
return <div className="space-y-6">
- <div className="flex items-center justify-between gap-4"><div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Accounts</h1><p className="mt-2 text-sm text-neutral-500">Manage Team accounts and their inboxes.</p></div>{!teamRequired && canManage && <Button className={mobilePrimaryActionClass} onClick={() => setCreateOpen(true)}><Plus className="h-4 w-4" />New account</Button>}</div>
+ <div className="flex items-center justify-between gap-4"><div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("accounts.title")}</h1><p className="mt-2 text-sm text-neutral-500">{t("accounts.description")}</p></div>{!teamRequired && canManage && <Button className={mobilePrimaryActionClass} onClick={() => setCreateOpen(true)}><Plus className="h-4 w-4" />{t("accounts.new")}</Button>}</div>
<div className="relative">{teamRequired && <LicenseRequiredOverlay required="Team"><div className="min-h-48 rounded-3xl bg-white" /></LicenseRequiredOverlay>}<List>
- {loading && <p className="text-sm text-neutral-500">Loading...</p>}
+ {loading && <p className="text-sm text-neutral-500">{t("common.loading")}</p>}
{accounts.map((account) => {
const locked = !currentUser?.isPrimaryAdmin && account.role === "admin" && account.id !== currentUser?.id;
const row = <>
<span style={getAvatarColorStyle(account.email)} className="relative flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-full font-semibold duration-200">{account.name.charAt(0).toUpperCase()}{account.hasAvatar && <ProgressiveAvatarImage src={`/api/accounts/${account.id}/avatar`} alt="" className="absolute inset-0 h-full w-full object-cover" />}</span>
- <span className="min-w-0"><span className="flex items-center gap-2"><span className="truncate font-semibold text-neutral-900">{account.name}</span><span className={`rounded-full px-2 py-0.5 text-xs font-medium capitalize ${account.isPrimaryAdmin ? "bg-amber-100 text-amber-800" : "bg-neutral-100 text-neutral-600"}`}>{account.isPrimaryAdmin ? "Primary admin" : account.role}</span></span><span className="block truncate text-sm text-neutral-500">{account.email}</span></span>
+ <span className="min-w-0"><span className="flex items-center gap-2"><span className="truncate font-semibold text-neutral-900">{account.name}</span><span className={`rounded-full px-2 py-0.5 text-xs font-medium capitalize ${account.isPrimaryAdmin ? "bg-amber-100 text-amber-800" : "bg-neutral-100 text-neutral-600"}`}>{account.isPrimaryAdmin ? t("accounts.primaryAdmin") : t(account.role === "admin" ? "accounts.role.admin" : "accounts.role.user")}</span></span><span className="block truncate text-sm text-neutral-500">{account.email}</span></span>
</>;
if (locked) {
- return <ListRow key={account.id} aria-disabled="true" title="Only the primary admin can open admin accounts" className="cursor-not-allowed opacity-50">{row}</ListRow>;
+ return <ListRow key={account.id} aria-disabled="true" title={t("accounts.lockedAdmin")} className="cursor-not-allowed opacity-50">{row}</ListRow>;
}
return <ListRow key={account.id} asChild><Link href={`/accounts/${account.id}`}>{row}</Link></ListRow>;
})}
</List></div>
- <Dialog open={createOpen} onOpenChange={setCreateOpen}><DialogContent className="max-h-[calc(100dvh-4rem)] w-[min(640px,calc(100vw-32px))] overflow-y-auto"><DialogHeader><DialogTitle>Add user account</DialogTitle><DialogDescription>The user can sign in with this email and password.</DialogDescription></DialogHeader><form onSubmit={createAccount}><fieldset disabled={saving} className="space-y-4">
- <div className="space-y-2"><Label htmlFor="account-username">Email</Label><div className="flex h-10 overflow-hidden rounded-md border border-neutral-200 bg-white"><Input id="account-username" value={username} onChange={(event) => setUsername(event.target.value)} placeholder="username" className="min-w-0 flex-1 rounded-none border-0 shadow-none" required /><span className="flex items-center text-sm text-neutral-400">@</span><Select aria-label="Domain" value={domainId} onChange={(event) => setDomainId(event.target.value)} containerClassName="min-w-0 max-w-[55%] shrink-0 rounded-none border-0 px-0" className="bg-transparent px-3 text-sm" required><option value="">Select domain</option>{domains.map((domain) => <option key={domain.id} value={domain.id}>{domain.hostname}</option>)}</Select></div></div>
- <div className="space-y-2"><Label htmlFor="account-password">Password</Label><Input id="account-password" type="password" minLength={8} value={password} onChange={(event) => setPassword(event.target.value)} required /></div>
- {canChooseRole && <div className="space-y-2"><Label htmlFor="account-role">Role</Label><Select id="account-role" value={role} onChange={(event) => setRole(event.target.value as "admin" | "user")} containerClassName="h-10 w-full bg-white px-0" className="px-3 text-sm"><option value="user">User</option><option value="admin">Admin</option></Select></div>}
+ <Dialog open={createOpen} onOpenChange={setCreateOpen}><DialogContent className="max-h-[calc(100dvh-4rem)] w-[min(640px,calc(100vw-32px))] overflow-y-auto"><DialogHeader><DialogTitle>{t("accounts.addTitle")}</DialogTitle><DialogDescription>{t("accounts.addDescription")}</DialogDescription></DialogHeader><form onSubmit={createAccount}><fieldset disabled={saving} className="space-y-4">
+ <div className="space-y-2"><Label htmlFor="account-username">{t("auth.email")}</Label><div className="flex h-10 overflow-hidden rounded-md border border-neutral-200 bg-white"><Input id="account-username" value={username} onChange={(event) => setUsername(event.target.value)} placeholder={t("accounts.username")} className="min-w-0 flex-1 rounded-none border-0 shadow-none" required /><span className="flex items-center text-sm text-neutral-400">@</span><Select aria-label={t("accounts.domain")} value={domainId} onChange={(event) => setDomainId(event.target.value)} containerClassName="min-w-0 max-w-[55%] shrink-0 rounded-none border-0 px-0" className="bg-transparent px-3 text-sm" required><option value="">{t("accounts.selectDomain")}</option>{domains.map((domain) => <option key={domain.id} value={domain.id}>{domain.hostname}</option>)}</Select></div></div>
+ <div className="space-y-2"><Label htmlFor="account-password">{t("auth.password")}</Label><Input id="account-password" type="password" minLength={8} value={password} onChange={(event) => setPassword(event.target.value)} required /></div>
+ {canChooseRole && <div className="space-y-2"><Label htmlFor="account-role">{t("accounts.role")}</Label><Select id="account-role" value={role} onChange={(event) => setRole(event.target.value as "admin" | "user")} containerClassName="h-10 w-full bg-white px-0" className="px-3 text-sm"><option value="user">{t("accounts.roleUser")}</option><option value="admin">{t("accounts.roleAdmin")}</option></Select></div>}
<AccountAliases domains={domains} domainId={domainId} username={username} useAllDomains={useAllDomains} onUseAllDomainsChange={setUseAllDomains} aliases={aliases} onAliasesChange={setAliases} />
- {message && <p className="text-sm text-red-600">{message}</p>}<Button type="submit" disabled={saving || !domainId}>{saving ? "Creating..." : "Create account"}</Button>
+ {message && <p className="text-sm text-red-600">{message}</p>}<Button type="submit" disabled={saving || !domainId}>{saving ? t("accounts.creating") : t("accounts.create")}</Button>
</fieldset></form></DialogContent></Dialog>
</div>;
}
diff --git a/src/app/(admin)/admin/page.tsx b/src/app/(admin)/admin/page.tsx
index 9973e4f..f6deacf 100644
--- a/src/app/(admin)/admin/page.tsx
+++ b/src/app/(admin)/admin/page.tsx
@@ -2,14 +2,16 @@
import Link from "next/link";
import { BadgeDollarSign, Bot, Globe2, KeyRound, Mail, Palette, Users } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
+import type { TranslationKey } from "@/lib/i18n/types";
import { AdminUpdateCard } from "@/components/admin-update-card";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { useCurrentUser } from "@/hooks/use-current-user";
type AdminSection = {
href: string;
- title: string;
- description: string;
+ titleKey: TranslationKey;
+ descriptionKey: TranslationKey;
icon: typeof Bot;
permission?: "primary" | "domains" | "users";
};
@@ -17,48 +19,48 @@ type AdminSection = {
const sections: AdminSection[] = [
{
href: "/agent",
- title: "Agent",
- description: "Choose the email assistant's AI provider and model.",
+ titleKey: "admin.nav.agent",
+ descriptionKey: "admin.section.agent",
icon: Bot,
permission: "primary",
},
{
href: "/mailboxes",
- title: "Mailboxes",
- description: "Create and manage mailbox addresses.",
+ titleKey: "admin.nav.mailboxes",
+ descriptionKey: "admin.section.mailboxes",
icon: Mail,
},
{
href: "/domains",
- title: "Domains",
- description: "Add Cloudflare domains and inspect DNS state.",
+ titleKey: "admin.nav.domains",
+ descriptionKey: "admin.section.domains",
icon: Globe2,
permission: "domains",
},
{
href: "/branding",
- title: "Branding",
- description: "Customize the app name, icon, and favicon.",
+ titleKey: "admin.nav.branding",
+ descriptionKey: "admin.section.branding",
icon: Palette,
permission: "primary",
},
{
href: "/licenses",
- title: "Licenses",
- description: "Compare Pro and Team one-time licenses.",
+ titleKey: "admin.nav.licenses",
+ descriptionKey: "admin.section.licenses",
icon: BadgeDollarSign,
permission: "primary",
},
{
href: "/accounts",
- title: "Accounts",
- description: "Add and manage user accounts with a Team license.",
+ titleKey: "admin.nav.accounts",
+ descriptionKey: "admin.section.accounts",
icon: Users,
},
{
href: "/api-keys",
- title: "Admin API keys",
- description: "Manage API access to domains, accounts, and mailboxes.",
+ titleKey: "admin.section.apiKeysTitle",
+ descriptionKey: "admin.section.apiKeys",
icon: KeyRound,
permission: "primary",
},
@@ -77,6 +79,7 @@ const sections: AdminSection[] = [
];
export default function AdminSettingsPage() {
+ const { t } = useLanguage();
const user = useCurrentUser();
function canSee(section: AdminSection): boolean {
@@ -90,9 +93,9 @@ export default function AdminSettingsPage() {
return (
<div>
<div className="mb-8">
- <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Admin settings</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("admin.title")}</h1>
<p className="mt-2 text-sm text-neutral-500">
- Manage workspace-level mail infrastructure and integrations.
+ {t("admin.description")}
</p>
</div>
<div className="grid lg:grid-cols-2 gap-4">
@@ -106,10 +109,10 @@ export default function AdminSettingsPage() {
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 text-blue-700">
<Icon className="h-5 w-5" />
</div>
- <CardTitle className="text-base">{section.title}</CardTitle>
+ <CardTitle className="text-base">{t(section.titleKey)}</CardTitle>
</CardHeader>
<CardContent className="pt-4">
- <p className="text-sm text-neutral-500">{section.description}</p>
+ <p className="text-sm text-neutral-500">{t(section.descriptionKey)}</p>
</CardContent>
</Card>
</Link>
diff --git a/src/app/(admin)/general/page.tsx b/src/app/(admin)/general/page.tsx
index 503a568..9a9b6ec 100644
--- a/src/app/(admin)/general/page.tsx
+++ b/src/app/(admin)/general/page.tsx
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useState } from "react";
+import { useLanguage } from "@/components/language-provider";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
@@ -8,6 +9,7 @@ import { Label } from "@/components/ui/label";
import { loadGeneralSettings, saveGeneralSettings } from "./utils";
export default function GeneralSettingsPage() {
+ const { t } = useLanguage();
const [maxMb, setMaxMb] = useState(25);
const [loaded, setLoaded] = useState(false);
const [saving, setSaving] = useState(false);
@@ -17,9 +19,9 @@ export default function GeneralSettingsPage() {
let active = true;
void loadGeneralSettings().then((settings) => {
if (active) { setMaxMb(settings.outboundAttachmentMaxMb); setLoaded(true); }
- }).catch((error) => { if (active) setStatus(error instanceof Error ? error.message : "Could not load settings"); });
+ }).catch((error) => { if (active) setStatus(error instanceof Error ? error.message : t("general.loadFailed")); });
return () => { active = false; };
- }, []);
+ }, [t]);
async function save(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
@@ -28,21 +30,21 @@ export default function GeneralSettingsPage() {
try {
const settings = await saveGeneralSettings(maxMb);
setMaxMb(settings.outboundAttachmentMaxMb);
- setStatus("Attachment limit saved");
+ setStatus(t("general.saved"));
} catch (error) {
- setStatus(error instanceof Error ? error.message : "Could not save settings");
+ setStatus(error instanceof Error ? error.message : t("general.saveFailed"));
} finally { setSaving(false); }
}
return <div className="space-y-6">
- <div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">General</h1><p className="mt-2 text-sm text-neutral-500">Set limits for outgoing mail.</p></div>
+ <div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("general.title")}</h1><p className="mt-2 text-sm text-neutral-500">{t("general.description")}</p></div>
<Card className="rounded-3xl border-0 bg-white p-6">
- <CardHeader className="py-0"><CardTitle>File attachments</CardTitle></CardHeader>
+ <CardHeader className="py-0"><CardTitle>{t("general.attachments")}</CardTitle></CardHeader>
<CardContent className="pt-6"><form onSubmit={save} className="space-y-4">
- <div className="space-y-2"><Label htmlFor="attachment-limit">Maximum attachments per email (MB)</Label><Input id="attachment-limit" type="number" min="1" max="25" step="1" value={maxMb} onChange={(event) => setMaxMb(Number(event.target.value))} disabled={!loaded || saving} className="max-w-40" required /><p className="text-sm text-neutral-500">Applies to each file and all files combined. Maximum: 25 MB; up to 10 files.</p></div>
- <div className="space-y-2 rounded-xl bg-neutral-50 p-4 text-sm text-neutral-700"><p>Cloudflare Email Sending limits the complete email, including attachments and encoding, to 5 MiB for general recipients. The 25 MiB exception applies only to verified destination addresses.</p><p>Files over 3 MB, and smaller files that would make the email exceed Cloudflare’s 5 MiB limit, are stored in R2 and sent as download links. Links expire after 30 days. Anyone with a link can download the file until it expires. Set APP_URL to your public HTTPS address when sending through API or background workflows.</p></div>
+ <div className="space-y-2"><Label htmlFor="attachment-limit">{t("general.maxAttachments")}</Label><Input id="attachment-limit" type="number" min="1" max="25" step="1" value={maxMb} onChange={(event) => setMaxMb(Number(event.target.value))} disabled={!loaded || saving} className="max-w-40" required /><p className="text-sm text-neutral-500">{t("general.appliesTo")}</p></div>
+ <div className="space-y-2 rounded-xl bg-neutral-50 p-4 text-sm text-neutral-700"><p>{t("general.cloudflareLimit")}</p><p>{t("general.largeFiles")}</p></div>
{status && <p role="status" className="text-sm text-neutral-700">{status}</p>}
- <Button type="submit" disabled={!loaded || saving || !Number.isInteger(maxMb) || maxMb < 1 || maxMb > 25}>{saving ? "Saving…" : "Save settings"}</Button>
+ <Button type="submit" disabled={!loaded || saving || !Number.isInteger(maxMb) || maxMb < 1 || maxMb > 25}>{saving ? t("common.saving") : t("general.save")}</Button>
</form></CardContent>
</Card>
</div>;
diff --git a/src/app/(admin)/layout.tsx b/src/app/(admin)/layout.tsx
index e7d91db..53b9e89 100644
--- a/src/app/(admin)/layout.tsx
+++ b/src/app/(admin)/layout.tsx
@@ -2,6 +2,7 @@
import Link from "next/link";
import { HelpCircle, Search } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { AuthGuard } from "@/components/auth/auth-guard";
import { ComposeProvider } from "@/components/compose/compose-context";
import { FloatingComposer } from "@/components/compose/floating-composer";
@@ -35,12 +36,14 @@ export default function DashboardLayout({
}: {
children: React.ReactNode;
}) {
+ const { t } = useLanguage();
const pathname = usePathname();
const requirePrimary = primaryOnlyPrefixes.some(
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`),
);
- const mobileTitle = adminPageTitles[pathname];
+ const mobileTitleKey = adminPageTitles[pathname];
+ const mobileTitle = mobileTitleKey ? t(mobileTitleKey) : undefined;
return (
<AuthGuard requireMailbox requireRole="admin" requirePrimary={requirePrimary}>
diff --git a/src/app/(admin)/routing/page.tsx b/src/app/(admin)/routing/page.tsx
index 069d1f1..a7d5a7b 100644
--- a/src/app/(admin)/routing/page.tsx
+++ b/src/app/(admin)/routing/page.tsx
@@ -2,6 +2,7 @@
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { useLanguage } from "@/components/language-provider";
import { DomainRouting } from "@/components/settings/domain-routing/domain-routing";
import { RoutingRuleSelect } from "@/components/settings/domain-routing/routing-rule-select";
import { Label } from "@/components/ui/label";
@@ -9,6 +10,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { fetchAdminRoutingDomains } from "./utils";
export default function RoutingPage() {
+ const { t } = useLanguage();
const [domainId, setDomainId] = useState("");
const domains = useQuery({
queryKey: ["admin-routing-domains"],
@@ -20,16 +22,16 @@ export default function RoutingPage() {
return (
<div className="space-y-8">
<div>
- <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Routing</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">{t("routingAdmin.title")}</h1>
<p className="mt-1 text-sm text-neutral-500">
- Configure domain-wide delivery, forwarding, and blocking rules.
+ {t("routingAdmin.description")}
</p>
</div>
<section className="space-y-4">
<div>
- <h2 className="text-xl font-semibold text-neutral-900">Domain</h2>
- <p className="mt-1 text-sm text-neutral-500">Choose which domain these global rules apply to.</p>
+ <h2 className="text-xl font-semibold text-neutral-900">{t("routingAdmin.domain")}</h2>
+ <p className="mt-1 text-sm text-neutral-500">{t("routingAdmin.chooseDomain")}</p>
</div>
<div className="rounded-3xl bg-white p-6">
{domains.isLoading ? (
@@ -37,10 +39,10 @@ export default function RoutingPage() {
) : domains.isError ? (
<p className="text-sm text-red-600">{domains.error.message}</p>
) : availableDomains.length === 0 ? (
- <p className="text-sm text-neutral-500">Add a domain before configuring routing rules.</p>
+ <p className="text-sm text-neutral-500">{t("routingAdmin.addDomainFirst")}</p>
) : (
<div className="grid gap-2">
- <Label htmlFor="routing-domain">Managed domain</Label>
+ <Label htmlFor="routing-domain">{t("routingAdmin.managedDomain")}</Label>
<RoutingRuleSelect
id="routing-domain"
value={selectedDomain?.id ?? ""}
diff --git a/src/components/admin-page-titles.ts b/src/components/admin-page-titles.ts
index f461c1f..f7f643b 100644
--- a/src/components/admin-page-titles.ts
+++ b/src/components/admin-page-titles.ts
@@ -1,18 +1,20 @@
+import type { TranslationKey } from "@/lib/i18n/types";
+
// Titles shown in the phone top bar, keyed by exact path. Detail pages are absent on purpose:
// they keep their own in-page heading.
-export const adminPageTitles: Record<string, string> = {
- "/admin": "Admin settings",
- "/mailboxes": "Mailboxes",
- "/domains": "Domains",
- "/routing": "Routing",
- "/webhooks": "Webhooks",
- "/api-keys": "Admin API keys",
- "/general": "General",
- "/agent": "Agent",
- "/accounts": "Accounts",
- "/activity": "Activity",
- "/backups": "Backups",
- "/branding": "Branding",
- "/licenses": "Licenses",
- "/ai-usage": "AI usage",
+export const adminPageTitles: Record<string, TranslationKey> = {
+ "/admin": "admin.title",
+ "/mailboxes": "admin.nav.mailboxes",
+ "/domains": "admin.nav.domains",
+ "/routing": "admin.nav.routing",
+ "/webhooks": "admin.nav.webhooks",
+ "/api-keys": "admin.section.apiKeysTitle",
+ "/general": "admin.nav.general",
+ "/agent": "admin.nav.agent",
+ "/accounts": "admin.nav.accounts",
+ "/activity": "admin.nav.activity",
+ "/backups": "admin.nav.backups",
+ "/branding": "admin.nav.branding",
+ "/licenses": "admin.nav.licenses",
+ "/ai-usage": "admin.page.aiUsage",
};
diff --git a/src/components/admin-update-card.tsx b/src/components/admin-update-card.tsx
index 8866e9c..bfa4136 100644
--- a/src/components/admin-update-card.tsx
+++ b/src/components/admin-update-card.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import { CheckCircle2, CircleX, Database, RefreshCw } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import {
@@ -13,6 +14,7 @@ import {
import type { MigrationStatusResponse, UpdateStatusResponse, UpdateWorkflowResponse } from "./admin-update-card-types";
export function AdminUpdateCard() {
+ const { t } = useLanguage();
const [status, setStatus] = useState<UpdateStatusResponse>();
const [result, setResult] = useState<UpdateWorkflowResponse>();
const [error, setError] = useState("");
@@ -32,7 +34,7 @@ export function AdminUpdateCard() {
})
.catch((statusError) => {
if (isActive) {
- setError(statusError instanceof Error ? statusError.message : "Could not check for updates");
+ setError(statusError instanceof Error ? statusError.message : t("update.checkFailed"));
}
})
.finally(() => {
@@ -45,7 +47,7 @@ export function AdminUpdateCard() {
})
.catch((statusError) => {
if (isActive) {
- setMigrationError(statusError instanceof Error ? statusError.message : "Could not check database migrations");
+ setMigrationError(statusError instanceof Error ? statusError.message : t("update.migrationCheckFailed"));
}
})
.finally(() => {
@@ -65,7 +67,7 @@ export function AdminUpdateCard() {
try {
setResult(await triggerApplicationUpdate());
} catch (updateError) {
- setError(updateError instanceof Error ? updateError.message : "Could not start the update");
+ setError(updateError instanceof Error ? updateError.message : t("update.startFailed"));
} finally {
setIsPending(false);
}
@@ -78,7 +80,7 @@ export function AdminUpdateCard() {
setMigrationStatus(await applyDatabaseMigrations());
} catch (migrationFailure) {
setMigrationError(
- migrationFailure instanceof Error ? migrationFailure.message : "Could not apply database migrations",
+ migrationFailure instanceof Error ? migrationFailure.message : t("update.migrateFailed"),
);
} finally {
setIsMigrating(false);
@@ -92,9 +94,9 @@ export function AdminUpdateCard() {
<RefreshCw className="h-5 w-5" />
</div>
<div>
- <CardTitle className="text-base">Application update</CardTitle>
+ <CardTitle className="text-base">{t("update.title")}</CardTitle>
<p className="mt-1 text-sm text-neutral-500">
- Sync the latest Mailflare release and keep its database schema up to date.
+ {t("update.description")}
</p>
</div>
</CardHeader>
@@ -103,7 +105,7 @@ export function AdminUpdateCard() {
{!isChecking && status?.configured === false && (
<div className="space-y-3">
- <p className="text-sm text-neutral-600">Complete the required Cloudflare Worker configuration:</p>
+ <p className="text-sm text-neutral-600">{t("update.completeConfig")}</p>
<ul className="divide-y divide-neutral-100 overflow-hidden rounded-2xl border border-neutral-100">
{status.configuration?.map((item) => (
<li key={item.name} className="flex items-center gap-3 px-4 py-3 text-sm">
@@ -114,7 +116,7 @@ export function AdminUpdateCard() {
)}
<code className="text-xs font-medium text-neutral-800">{item.name}</code>
<span className={`ml-auto text-xs font-medium ${item.configured ? "text-green-700" : "text-red-600"}`}>
- {item.configured ? "Configured" : "Missing"}
+ {item.configured ? t("update.configured") : t("update.missing")}
</span>
</li>
))}
@@ -132,8 +134,8 @@ export function AdminUpdateCard() {
)}
<p className="min-w-0 text-sm text-neutral-700">
{status.available
- ? `Mailflare v${status.targetVersion} is available. You are using v${status.currentVersion}.`
- : `Mailflare v${status.currentVersion} is up to date.`}
+ ? t("update.available", { target: status.targetVersion, current: status.currentVersion })
+ : t("update.upToDate", { current: status.currentVersion })}
</p>
{status.available && (
<button
@@ -142,7 +144,7 @@ export function AdminUpdateCard() {
disabled={isPending}
className="ml-auto shrink-0 text-sm font-medium text-blue-700 hover:underline disabled:pointer-events-none disabled:opacity-50"
>
- {isPending ? "Starting update..." : "Update Mailflare"}
+ {isPending ? t("update.starting") : t("update.updateButton")}
</button>
)}
</div>
@@ -158,7 +160,7 @@ export function AdminUpdateCard() {
<div className="flex items-center gap-3 px-4 py-4">
<Database className={`h-4 w-4 shrink-0 text-amber-600 ${isMigrating ? "animate-pulse" : ""}`} />
<p className="text-sm text-neutral-700">
- {migrationStatus.pending.length} database {migrationStatus.pending.length === 1 ? "migration is" : "migrations are"} pending.
+ {t("update.pendingMigrations", { count: migrationStatus.pending.length })}
</p>
<button
type="button"
@@ -166,7 +168,7 @@ export function AdminUpdateCard() {
disabled={isMigrating}
className="ml-auto shrink-0 text-sm font-medium text-blue-700 hover:underline disabled:pointer-events-none disabled:opacity-50"
>
- {isMigrating ? "Updating database..." : "Update database"}
+ {isMigrating ? t("update.updatingDatabase") : t("update.updateDatabase")}
</button>
</div>
)}
@@ -174,7 +176,7 @@ export function AdminUpdateCard() {
{!isCheckingMigrations && !!migrationStatus?.unknown.length && (
<div className="flex items-center gap-3 px-4 py-4 text-sm text-red-600">
<CircleX className="h-4 w-4 shrink-0" />
- Deploy the matching Mailflare release before changing this database.
+ {t("update.deployMatching")}
</div>
)}
</div>
@@ -182,10 +184,10 @@ export function AdminUpdateCard() {
{result?.ok && (
<p className="text-sm text-green-700">
- Update started for {result.repository}@{result.ref}. Refresh this page after Cloudflare deploys it. {" "}
+ {t("update.started", { repo: result.repository, ref: result.ref })}{" "}
{result.runUrl && (
<a className="font-medium underline" href={result.runUrl} target="_blank" rel="noreferrer">
- View workflow
+ {t("update.viewWorkflow")}
</a>
)}
</p>
diff --git a/src/components/license-required-overlay.tsx b/src/components/license-required-overlay.tsx
index 703e240..98479f8 100644
--- a/src/components/license-required-overlay.tsx
+++ b/src/components/license-required-overlay.tsx
@@ -1,8 +1,10 @@
import Link from "next/link";
import { LockKeyhole } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { useLanguage } from "@/components/language-provider";
import type { LicenseRequiredOverlayProps } from "./license-required-overlay-types";
export function LicenseRequiredOverlay({ required, children }: LicenseRequiredOverlayProps) {
- return <div className="relative">{children}<div className="absolute inset-0 z-10 flex items-center justify-center rounded-3xl bg-white/50 p-6 backdrop-blur-[1px]"><div className="max-w-sm rounded-2xl border border-neutral-200 bg-white p-6 text-center shadow-xl"><LockKeyhole className="mx-auto h-6 w-6 text-blue-600" /><h2 className="mt-3 font-semibold text-neutral-900">{required} license required</h2><p className="mt-2 text-sm text-neutral-600">Upgrade your license to use this feature.</p><Button asChild className="mt-4"><Link href="/licenses">View licenses</Link></Button></div></div></div>;
+ const { t } = useLanguage();
+ return <div className="relative">{children}<div className="absolute inset-0 z-10 flex items-center justify-center rounded-3xl bg-white/50 p-6 backdrop-blur-[1px]"><div className="max-w-sm rounded-2xl border border-neutral-200 bg-white p-6 text-center shadow-xl"><LockKeyhole className="mx-auto h-6 w-6 text-blue-600" /><h2 className="mt-3 font-semibold text-neutral-900">{t("license.required", { tier: required })}</h2><p className="mt-2 text-sm text-neutral-600">{t("license.upgradeHint")}</p><Button asChild className="mt-4"><Link href="/licenses">{t("license.view")}</Link></Button></div></div></div>;
}
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 5410058..249ef7b 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -854,5 +854,86 @@
"home.logIn": "Log in",
"home.createAccount": "Create account",
"home.openDashboard": "Open dashboard",
- "home.viewInbox": "View inbox"
+ "home.viewInbox": "View inbox",
+ "admin.title": "Admin settings",
+ "admin.description": "Manage workspace-level mail infrastructure and integrations.",
+ "admin.section.agent": "Choose the email assistant's AI provider and model.",
+ "admin.section.mailboxes": "Create and manage mailbox addresses.",
+ "admin.section.domains": "Add Cloudflare domains and inspect DNS state.",
+ "admin.section.branding": "Customize the app name, icon, and favicon.",
+ "admin.section.licenses": "Compare Pro and Team one-time licenses.",
+ "admin.section.accounts": "Add and manage user accounts with a Team license.",
+ "admin.section.apiKeys": "Manage API access to domains, accounts, and mailboxes.",
+ "admin.section.apiKeysTitle": "Admin API keys",
+ "admin.page.aiUsage": "AI usage",
+ "general.loadFailed": "Could not load settings",
+ "general.saved": "Attachment limit saved",
+ "general.saveFailed": "Could not save settings",
+ "general.title": "General",
+ "general.description": "Set limits for outgoing mail.",
+ "general.attachments": "File attachments",
+ "general.maxAttachments": "Maximum attachments per email (MB)",
+ "general.appliesTo": "Applies to each file and all files combined. Maximum: 25 MB; up to 10 files.",
+ "general.cloudflareLimit": "Cloudflare Email Sending limits the complete email, including attachments and encoding, to 5 MiB for general recipients. The 25 MiB exception applies only to verified destination addresses.",
+ "general.largeFiles": "Files over 3 MB, and smaller files that would make the email exceed Cloudflare’s 5 MiB limit, are stored in R2 and sent as download links. Links expire after 30 days. Anyone with a link can download the file until it expires. Set APP_URL to your public HTTPS address when sending through API or background workflows.",
+ "general.save": "Save settings",
+ "routingAdmin.title": "Routing",
+ "routingAdmin.description": "Configure domain-wide delivery, forwarding, and blocking rules.",
+ "routingAdmin.domain": "Domain",
+ "routingAdmin.chooseDomain": "Choose which domain these global rules apply to.",
+ "routingAdmin.addDomainFirst": "Add a domain before configuring routing rules.",
+ "routingAdmin.managedDomain": "Managed domain",
+ "accounts.loadFailed": "Unable to load accounts",
+ "accounts.domainsFailed": "Unable to load domains",
+ "accounts.checkDetails": "Check the account and alias details and try again",
+ "accounts.createFailed": "Unable to create account",
+ "accounts.title": "Accounts",
+ "accounts.description": "Manage Team accounts and their inboxes.",
+ "accounts.new": "New account",
+ "accounts.primaryAdmin": "Primary admin",
+ "accounts.role.admin": "admin",
+ "accounts.role.user": "user",
+ "accounts.lockedAdmin": "Only the primary admin can open admin accounts",
+ "accounts.addTitle": "Add user account",
+ "accounts.addDescription": "The user can sign in with this email and password.",
+ "accounts.username": "username",
+ "accounts.selectDomain": "Select domain",
+ "accounts.domain": "Domain",
+ "accounts.role": "Role",
+ "accounts.roleUser": "User",
+ "accounts.roleAdmin": "Admin",
+ "accounts.creating": "Creating...",
+ "accounts.create": "Create account",
+ "aliases.useAll": "Use all domains",
+ "aliases.useAllHint": "Use this username on every available domain, including domains added later. When off, only the primary address and the aliases below are assigned.",
+ "aliases.additional": "Additional aliases",
+ "aliases.optional": "(optional)",
+ "aliases.hint": "These addresses share the new account’s inbox and can also be used to send mail.",
+ "aliases.usernameLabel": "Alias {n} username",
+ "aliases.domainLabel": "Alias {n} domain",
+ "aliases.remove": "Remove alias {n}",
+ "aliases.add": "Add alias",
+ "license.required": "{tier} license required",
+ "license.upgradeHint": "Upgrade your license to use this feature.",
+ "license.view": "View licenses",
+ "update.checkFailed": "Could not check for updates",
+ "update.migrationCheckFailed": "Could not check database migrations",
+ "update.startFailed": "Could not start the update",
+ "update.migrateFailed": "Could not apply database migrations",
+ "update.title": "Application update",
+ "update.description": "Sync the latest Mailflare release and keep its database schema up to date.",
+ "update.completeConfig": "Complete the required Cloudflare Worker configuration:",
+ "update.configured": "Configured",
+ "update.missing": "Missing",
+ "update.available": "Mailflare v{target} is available. You are using v{current}.",
+ "update.upToDate": "Mailflare v{current} is up to date.",
+ "update.starting": "Starting update...",
+ "update.updateButton": "Update Mailflare",
+ "update.pendingMigrations.one": "{count} database migration is pending.",
+ "update.pendingMigrations.other": "{count} database migrations are pending.",
+ "update.updatingDatabase": "Updating database...",
+ "update.updateDatabase": "Update database",
+ "update.deployMatching": "Deploy the matching Mailflare release before changing this database.",
+ "update.started": "Update started for {repo}@{ref}. Refresh this page after Cloudflare deploys it.",
+ "update.viewWorkflow": "View workflow"
}
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index be257f1..cdc9497 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -854,5 +854,86 @@
"home.logIn": "Entrar",
"home.createAccount": "Criar conta",
"home.openDashboard": "Abrir painel",
- "home.viewInbox": "Ver caixa de entrada"
+ "home.viewInbox": "Ver caixa de entrada",
+ "admin.title": "Configurações de administração",
+ "admin.description": "Gerencie a infraestrutura de e-mail e as integrações do espaço de trabalho.",
+ "admin.section.agent": "Escolha o provedor de IA e o modelo do assistente de e-mail.",
+ "admin.section.mailboxes": "Crie e gerencie endereços de caixas de correio.",
+ "admin.section.domains": "Adicione domínios da Cloudflare e inspecione o estado do DNS.",
+ "admin.section.branding": "Personalize o nome, o ícone e o favicon do aplicativo.",
+ "admin.section.licenses": "Compare as licenças únicas Pro e Team.",
+ "admin.section.accounts": "Adicione e gerencie contas de usuário com uma licença Team.",
+ "admin.section.apiKeys": "Gerencie o acesso por API a domínios, contas e caixas de correio.",
+ "admin.section.apiKeysTitle": "Chaves de API de administração",
+ "admin.page.aiUsage": "Uso de IA",
+ "general.loadFailed": "Não foi possível carregar as configurações",
+ "general.saved": "Limite de anexos salvo",
+ "general.saveFailed": "Não foi possível salvar as configurações",
+ "general.title": "Geral",
+ "general.description": "Defina limites para os e-mails enviados.",
+ "general.attachments": "Anexos de arquivos",
+ "general.maxAttachments": "Máximo de anexos por e-mail (MB)",
+ "general.appliesTo": "Aplica-se a cada arquivo e a todos os arquivos combinados. Máximo: 25 MB; até 10 arquivos.",
+ "general.cloudflareLimit": "O Cloudflare Email Sending limita o e-mail completo, incluindo anexos e codificação, a 5 MiB para destinatários em geral. A exceção de 25 MiB vale apenas para endereços de destino verificados.",
+ "general.largeFiles": "Arquivos acima de 3 MB, e arquivos menores que fariam o e-mail exceder o limite de 5 MiB da Cloudflare, são armazenados no R2 e enviados como links de download. Os links expiram após 30 dias. Qualquer pessoa com o link pode baixar o arquivo até que ele expire. Defina APP_URL com seu endereço HTTPS público ao enviar por API ou fluxos em segundo plano.",
+ "general.save": "Salvar configurações",
+ "routingAdmin.title": "Roteamento",
+ "routingAdmin.description": "Configure regras de entrega, encaminhamento e bloqueio para todo o domínio.",
+ "routingAdmin.domain": "Domínio",
+ "routingAdmin.chooseDomain": "Escolha a qual domínio estas regras globais se aplicam.",
+ "routingAdmin.addDomainFirst": "Adicione um domínio antes de configurar regras de roteamento.",
+ "routingAdmin.managedDomain": "Domínio gerenciado",
+ "accounts.loadFailed": "Não foi possível carregar as contas",
+ "accounts.domainsFailed": "Não foi possível carregar os domínios",
+ "accounts.checkDetails": "Verifique os dados da conta e dos aliases e tente novamente",
+ "accounts.createFailed": "Não foi possível criar a conta",
+ "accounts.title": "Contas",
+ "accounts.description": "Gerencie contas Team e suas caixas de entrada.",
+ "accounts.new": "Nova conta",
+ "accounts.primaryAdmin": "Administrador principal",
+ "accounts.role.admin": "administrador",
+ "accounts.role.user": "usuário",
+ "accounts.lockedAdmin": "Somente o administrador principal pode abrir contas de administrador",
+ "accounts.addTitle": "Adicionar conta de usuário",
+ "accounts.addDescription": "O usuário poderá entrar com este e-mail e esta senha.",
+ "accounts.username": "usuario",
+ "accounts.selectDomain": "Selecionar domínio",
+ "accounts.domain": "Domínio",
+ "accounts.role": "Função",
+ "accounts.roleUser": "Usuário",
+ "accounts.roleAdmin": "Administrador",
+ "accounts.creating": "Criando...",
+ "accounts.create": "Criar conta",
+ "aliases.useAll": "Usar todos os domínios",
+ "aliases.useAllHint": "Use este nome de usuário em todos os domínios disponíveis, incluindo os adicionados depois. Desativado, apenas o endereço principal e os aliases abaixo são atribuídos.",
+ "aliases.additional": "Aliases adicionais",
+ "aliases.optional": "(opcional)",
+ "aliases.hint": "Estes endereços compartilham a caixa de entrada da nova conta e também podem ser usados para enviar e-mails.",
+ "aliases.usernameLabel": "Nome de usuário do alias {n}",
+ "aliases.domainLabel": "Domínio do alias {n}",
+ "aliases.remove": "Remover alias {n}",
+ "aliases.add": "Adicionar alias",
+ "license.required": "Licença {tier} necessária",
+ "license.upgradeHint": "Faça upgrade da sua licença para usar este recurso.",
+ "license.view": "Ver licenças",
+ "update.checkFailed": "Não foi possível verificar atualizações",
+ "update.migrationCheckFailed": "Não foi possível verificar as migrações do banco de dados",
+ "update.startFailed": "Não foi possível iniciar a atualização",
+ "update.migrateFailed": "Não foi possível aplicar as migrações do banco de dados",
+ "update.title": "Atualização do aplicativo",
+ "update.description": "Sincronize a versão mais recente do Mailflare e mantenha o esquema do banco de dados atualizado.",
+ "update.completeConfig": "Conclua a configuração necessária do Cloudflare Worker:",
+ "update.configured": "Configurado",
+ "update.missing": "Ausente",
+ "update.available": "O Mailflare v{target} está disponível. Você está usando a v{current}.",
+ "update.upToDate": "O Mailflare v{current} está atualizado.",
+ "update.starting": "Iniciando atualização...",
+ "update.updateButton": "Atualizar o Mailflare",
+ "update.pendingMigrations.one": "{count} migração do banco de dados está pendente.",
+ "update.pendingMigrations.other": "{count} migrações do banco de dados estão pendentes.",
+ "update.updatingDatabase": "Atualizando banco de dados...",
+ "update.updateDatabase": "Atualizar banco de dados",
+ "update.deployMatching": "Faça o deploy da versão correspondente do Mailflare antes de alterar este banco de dados.",
+ "update.started": "Atualização iniciada para {repo}@{ref}. Atualize esta página depois que a Cloudflare fizer o deploy.",
+ "update.viewWorkflow": "Ver workflow"
}
diff --git a/src/lib/i18n/utils.ts b/src/lib/i18n/utils.ts
index 0497ca7..8cc0781 100644
--- a/src/lib/i18n/utils.ts
+++ b/src/lib/i18n/utils.ts
@@ -18,12 +18,12 @@ export function getMessages(locale: Locale): Messages {
return locales[locale].messages;
}
-export type TranslationVars = Record<string, string | number>;
+export type TranslationVars = Record<string, string | number | null | undefined>;
export type Translator = (key: TranslationKey | PluralKey, vars?: TranslationVars) => string;
function interpolate(template: string, vars?: TranslationVars): string {
if (!vars) return template;
- return template.replace(/\{(\w+)\}/g, (match, name: string) => (Object.hasOwn(vars, name) ? String(vars[name]) : match));
+ return template.replace(/\{(\w+)\}/g, (match, name: string) => (Object.hasOwn(vars, name) ? String(vars[name] ?? "") : match));
}
export function translate(messages: Partial<Messages>, key: TranslationKey, vars?: TranslationVars): string {