Skip to content

Email for professionals and teams

Translate landing page

Hieu Nguyen (Jack)93c00e3f10cc
diff --git a/src/app/home-header-actions.tsx b/src/app/home-header-actions.tsx
index d20131d..40a91e9 100644
--- a/src/app/home-header-actions.tsx
+++ b/src/app/home-header-actions.tsx
@@ -1,12 +1,15 @@
"use client";
import Link from "next/link";
+import { useLanguage } from "@/components/language-provider";
+import { LanguageSelector } from "@/components/language-selector";
import { Button } from "@/components/ui/button";
import { getHomeActions } from "./utils";
import { HomeAccountMenu } from "./home-account-menu";
import { useHomeAuth } from "./home-auth";
export function HomeHeaderActions() {
+ const { t } = useLanguage();
const user = useHomeAuth();
if (user) return <HomeAccountMenu user={user} />;
@@ -14,7 +17,7 @@ export function HomeHeaderActions() {
<>
{getHomeActions(false).map((action) => (
<Button key={action.href} variant={action.variant} asChild>
- <Link href={action.href}>{action.label}</Link>
+ <Link href={action.href}>{t(action.labelKey)}</Link>
</Button>
))}
</>
diff --git a/src/app/home-hero-actions.tsx b/src/app/home-hero-actions.tsx
index 17a3bc7..fea495f 100644
--- a/src/app/home-hero-actions.tsx
+++ b/src/app/home-hero-actions.tsx
@@ -2,23 +2,25 @@
import Link from "next/link";
import { ArrowRight } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { Button } from "@/components/ui/button";
import { useHomeAuth } from "./home-auth";
export function HomeHeroActions() {
+ const { t } = useLanguage();
const hasUser = !!useHomeAuth();
return (
<div className="mt-8 flex flex-col gap-3 sm:flex-row">
<Button size="lg" asChild className="rounded-full px-6">
<Link href={hasUser ? "/inbox" : "/setup"}>
- {hasUser ? "Open dashboard" : "Create account"}
+ {hasUser ? t("home.openDashboard") : t("home.createAccount")}
<ArrowRight className="h-4 w-4" />
</Link>
</Button>
<Button size="lg" variant="outline" asChild className="rounded-full border-neutral-200 bg-white px-6">
<Link href={hasUser ? "/inbox" : "/login"}>
- {hasUser ? "View inbox" : "Log in"}
+ {hasUser ? t("home.viewInbox") : t("home.logIn")}
</Link>
</Button>
</div>
diff --git a/src/app/page.tsx b/src/app/page.tsx
index d36c6de..5153ad5 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -2,6 +2,8 @@ import type { Metadata } from "next";
import Link from "next/link";
import { heroMessages, sidebarItems } from "./utils";
import { Inbox, Mail, Search, ShieldCheck } from "lucide-react";
+import { getServerTranslator } from "@/lib/i18n/server";
+import { LanguageSelector } from "@/components/language-selector";
import { getHomeBranding } from "./home-server-utils";
import { HomeAuthProvider } from "./home-auth";
import { HomeHeaderActions } from "./home-header-actions";
@@ -19,6 +21,7 @@ export async function generateMetadata(): Promise<Metadata> {
export default async function HomePage() {
const branding = await getHomeBranding();
+ const t = await getServerTranslator();
return (
<HomeAuthProvider>
@@ -27,7 +30,7 @@ export default async function HomePage() {
<Link
href="/"
className="flex items-center gap-3"
- aria-label={`${branding.appName} home`}
+ aria-label={t("home.homeLabel", { app: branding.appName })}
>
<img src={branding.hasCustomIcon ? "/api/branding/icon" : "/icon-96.png"} height={32} width={32} alt="" />
<span className="text-base font-semibold tracking-tight">
@@ -44,6 +47,9 @@ export default async function HomePage() {
</nav> */}
<div className="flex items-center gap-2">
+ <div className="hidden w-44 sm:block">
+ <LanguageSelector />
+ </div>
<HomeHeaderActions />
</div>
</header>
@@ -53,14 +59,13 @@ export default async function HomePage() {
<div className="flex max-w-2xl flex-col justify-center">
<div className="mb-6 flex w-fit items-center gap-2 text-sm font-medium text-blue-800">
<ShieldCheck className="h-4 w-4" />
- Cloudflare-native email operations
+ {t("home.badge")}
</div>
<h1 className="max-w-[12ch] text-5xl font-semibold leading-[0.96] tracking-tight text-neutral-950 sm:text-6xl lg:text-7xl">
- Mailboxes that feel like your inbox.
+ {t("home.headline")}
</h1>
<p className="mt-6 max-w-xl text-lg leading-8 text-neutral-600">
- Add domains, route inbound mail, send through API keys, and manage
- your mailboxes from one quiet workspace built around the message list.
+ {t("home.subheadline")}
</p>
<HomeHeroActions />
</div>
@@ -70,17 +75,17 @@ export default async function HomePage() {
<aside className="hidden flex-col gap-2 bg-[#f6f8fc] px-3 py-5 sm:flex">
<div className="mb-4 flex items-center gap-3 px-3 text-neutral-700">
<Inbox className="h-5 w-5" />
- <span className="font-semibold">Mail</span>
+ <span className="font-semibold">{t("home.mockMail")}</span>
</div>
<div className="mb-3 flex h-12 w-fit items-center gap-2 rounded-2xl bg-blue-100 px-5 text-sm font-semibold text-blue-950 shadow-sm">
<Mail className="h-4 w-4" />
- Compose
+ {t("navigation.compose")}
</div>
{sidebarItems.map((item) => {
const Icon = item.icon;
return (
<div
- key={item.label}
+ key={item.labelKey}
className={`flex h-9 items-center justify-between rounded-r-full px-3 text-sm font-medium ${
item.active
? "bg-blue-100 text-blue-950"
@@ -89,7 +94,7 @@ export default async function HomePage() {
>
<span className="flex items-center gap-3">
<Icon className="h-4 w-4" />
- {item.label}
+ {t(item.labelKey)}
</span>
{item.count && (
<span className="text-xs text-blue-800">
@@ -105,7 +110,7 @@ export default async function HomePage() {
<div className="flex h-16 items-center gap-3 bg-[#f6f8fc] px-4">
<div className="flex h-12 flex-1 items-center gap-3 rounded-full bg-[#eaf1fb] px-4 text-neutral-600">
<Search className="h-5 w-5" />
- <span className="text-[15px]">Search mail</span>
+ <span className="text-[15px]">{t("search.mail")}</span>
</div>
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-600 text-white">
<Mail className="h-4 w-4" />
@@ -116,14 +121,14 @@ export default async function HomePage() {
<div className="flex h-14 items-center justify-between border-b border-neutral-200 px-6">
<div className="flex items-center gap-3">
<h2 className="text-xl font-medium text-neutral-800">
- Priority inbox
+ {t("home.mockPriority")}
</h2>
<span className="rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-medium text-neutral-600">
18
</span>
</div>
<span className="hidden text-sm font-medium text-neutral-500 md:inline">
- Updated 2 min ago
+ {t("home.mockUpdated")}
</span>
</div>
<div className="divide-y divide-neutral-100">
@@ -138,15 +143,15 @@ export default async function HomePage() {
</span>
<span className="truncate text-neutral-600">
<span className="font-medium text-neutral-900">
- {message.subject}
+ {t(message.subjectKey)}
</span>
<span className="hidden text-neutral-500 md:inline">
{" "}
- - {message.preview}
+ - {t(message.previewKey)}
</span>
</span>
<span className="rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">
- {message.badge}
+ {t(message.badgeKey)}
</span>
</div>
))}
diff --git a/src/app/types.d.ts b/src/app/types.d.ts
index 1f1e50e..872a22d 100644
--- a/src/app/types.d.ts
+++ b/src/app/types.d.ts
@@ -1,3 +1,4 @@
+import type { TranslationKey } from "@/lib/i18n/types";
import type { LucideIcon } from "lucide-react";
import type { ButtonProps } from "@/components/ui/button";
import type { MailboxSelectorUser } from "@/components/mailbox-selector-types";
@@ -17,7 +18,7 @@ export type HomeAccountMenuProps = {
export type HomeAction = {
href: string;
- label: string;
+ labelKey: TranslationKey;
variant: ButtonProps["variant"];
};
@@ -27,7 +28,7 @@ export type LandingNavItem = {
};
export type SidebarItem = {
- label: string;
+ labelKey: TranslationKey;
icon: LucideIcon;
active?: boolean;
count?: string;
@@ -36,9 +37,9 @@ export type SidebarItem = {
export type MailPreview = {
icon: LucideIcon;
sender: string;
- subject: string;
- preview: string;
- badge: string;
+ subjectKey: TranslationKey;
+ previewKey: TranslationKey;
+ badgeKey: TranslationKey;
};
export type LandingStat = {
diff --git a/src/app/utils.ts b/src/app/utils.ts
index 9a3ef94..ed306df 100644
--- a/src/app/utils.ts
+++ b/src/app/utils.ts
@@ -8,41 +8,41 @@ export const landingNavItems: LandingNavItem[] = [
];
export const sidebarItems: SidebarItem[] = [
- { label: "Inbox", icon: Inbox, active: true, count: "18" },
- { label: "Sent", icon: Send },
- { label: "Drafts", icon: FileText, count: "4" },
- { label: "Spam", icon: ShieldAlert },
- { label: "Trash", icon: Trash2 },
+ { labelKey: "navigation.inbox", icon: Inbox, active: true, count: "18" },
+ { labelKey: "navigation.sent", icon: Send },
+ { labelKey: "navigation.drafts", icon: FileText, count: "4" },
+ { labelKey: "navigation.spam", icon: ShieldAlert },
+ { labelKey: "navigation.trash", icon: Trash2 },
];
export const heroMessages: MailPreview[] = [
{
icon: MailCheck,
sender: "[email protected]",
- subject: "Route matched",
- preview: "Inbound mail was delivered to support after DNS validation.",
- badge: "Inbound",
+ subjectKey: "home.msg1.subject",
+ previewKey: "home.msg1.preview",
+ badgeKey: "home.msg1.badge",
},
{
icon: MailCheck,
sender: "[email protected]",
- subject: "API send accepted",
- preview: "Message queued through the production API key.",
- badge: "Sent",
+ subjectKey: "home.msg2.subject",
+ previewKey: "home.msg2.preview",
+ badgeKey: "home.msg2.badge",
},
{
icon: MailCheck,
sender: "[email protected]",
- subject: "Webhook delivered",
- preview: "Event payload reached your billing workspace endpoint.",
- badge: "Hook",
+ subjectKey: "home.msg3.subject",
+ previewKey: "home.msg3.preview",
+ badgeKey: "home.msg3.badge",
},
{
icon: MailCheck,
sender: "[email protected]",
- subject: "Mailbox provisioned",
- preview: "New routing mailbox is ready for customer replies.",
- badge: "Admin",
+ subjectKey: "home.msg4.subject",
+ previewKey: "home.msg4.preview",
+ badgeKey: "home.msg4.badge",
},
];
@@ -60,11 +60,11 @@ export const deliverySignals = [
export function getHomeActions(isLoggedIn: boolean): HomeAction[] {
if (isLoggedIn) {
- return [{ href: "/inbox", label: "Dashboard", variant: "default" }];
+ return [{ href: "/inbox", labelKey: "home.dashboard", variant: "default" }];
}
return [
- { href: "/login", label: "Log in", variant: "outline" },
- { href: "/setup", label: "Create account", variant: "default" },
+ { href: "/login", labelKey: "home.logIn", variant: "outline" },
+ { href: "/setup", labelKey: "home.createAccount", variant: "default" },
];
}
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 7a0ba29..5410058 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -830,5 +830,29 @@
"onboarding.adding": "Adding...",
"onboarding.addDomain": "Add domain",
"onboarding.mailboxAddress": "Mailbox address",
- "onboarding.goToInbox": "Go to inbox"
+ "onboarding.goToInbox": "Go to inbox",
+ "home.homeLabel": "{app} home",
+ "home.badge": "Cloudflare-native email operations",
+ "home.headline": "Mailboxes that feel like your inbox.",
+ "home.subheadline": "Add domains, route inbound mail, send through API keys, and manage your mailboxes from one quiet workspace built around the message list.",
+ "home.mockMail": "Mail",
+ "home.mockPriority": "Priority inbox",
+ "home.mockUpdated": "Updated 2 min ago",
+ "home.msg1.subject": "Route matched",
+ "home.msg1.preview": "Inbound mail was delivered to support after DNS validation.",
+ "home.msg1.badge": "Inbound",
+ "home.msg2.subject": "API send accepted",
+ "home.msg2.preview": "Message queued through the production API key.",
+ "home.msg2.badge": "Sent",
+ "home.msg3.subject": "Webhook delivered",
+ "home.msg3.preview": "Event payload reached your billing workspace endpoint.",
+ "home.msg3.badge": "Hook",
+ "home.msg4.subject": "Mailbox provisioned",
+ "home.msg4.preview": "New routing mailbox is ready for customer replies.",
+ "home.msg4.badge": "Admin",
+ "home.dashboard": "Dashboard",
+ "home.logIn": "Log in",
+ "home.createAccount": "Create account",
+ "home.openDashboard": "Open dashboard",
+ "home.viewInbox": "View inbox"
}
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index 6c4db5c..be257f1 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -830,5 +830,29 @@
"onboarding.adding": "Adicionando...",
"onboarding.addDomain": "Adicionar domínio",
"onboarding.mailboxAddress": "Endereço da caixa de correio",
- "onboarding.goToInbox": "Ir para a caixa de entrada"
+ "onboarding.goToInbox": "Ir para a caixa de entrada",
+ "home.homeLabel": "Página inicial de {app}",
+ "home.badge": "Operações de e-mail nativas da Cloudflare",
+ "home.headline": "Caixas de correio que parecem a sua caixa de entrada.",
+ "home.subheadline": "Adicione domínios, roteie e-mails recebidos, envie por chaves de API e gerencie suas caixas de correio em um espaço de trabalho tranquilo, construído em torno da lista de mensagens.",
+ "home.mockMail": "E-mail",
+ "home.mockPriority": "Caixa de entrada prioritária",
+ "home.mockUpdated": "Atualizado há 2 min",
+ "home.msg1.subject": "Rota correspondida",
+ "home.msg1.preview": "O e-mail recebido foi entregue ao suporte após a validação do DNS.",
+ "home.msg1.badge": "Recebido",
+ "home.msg2.subject": "Envio por API aceito",
+ "home.msg2.preview": "Mensagem enfileirada pela chave de API de produção.",
+ "home.msg2.badge": "Enviado",
+ "home.msg3.subject": "Webhook entregue",
+ "home.msg3.preview": "O payload do evento chegou ao endpoint do seu espaço de cobrança.",
+ "home.msg3.badge": "Hook",
+ "home.msg4.subject": "Caixa de correio provisionada",
+ "home.msg4.preview": "A nova caixa de correio de roteamento está pronta para respostas de clientes.",
+ "home.msg4.badge": "Admin",
+ "home.dashboard": "Painel",
+ "home.logIn": "Entrar",
+ "home.createAccount": "Criar conta",
+ "home.openDashboard": "Abrir painel",
+ "home.viewInbox": "Ver caixa de entrada"
}