Skip to content

Email for professionals and teams

Move language and time zone to account settings, add README language docs

Hieu Nguyen (Jack)d7ae8f77d1b9
diff --git a/README.md b/README.md
index 439c230..89823a4 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ Want to support the mailflare? <a target="_blank" href="https://store.paymug.co/
- **Admin**: Manage users, permissions, API keys, webhooks, audit logs, and backups.
- **AI assistant**: Search your mail, draft replies, and manage calendar events with AI.
- **MCP access**: Connect AI clients over MCP, with separate permissions for each key.
+- **Languages**: Use the interface in English, Português (Brasil), Español, Français, Deutsch, Русский, 中文(简体), 日本語, Bahasa Indonesia, Türkçe, Tiếng Việt, हिन्दी, or العربية (right-to-left).
## How it works
@@ -134,6 +135,12 @@ The Cloudflare app uses vinext and the Cloudflare Vite plugin, with local D1, R2
The Node/Docker runtime still uses Next.js with `build:node`, `start:node`, and `dev:node`.
+## Languages
+
+Everyone can switch language from the homepage or sign-in page, and signed-in users can set it under **Settings → Account → General**, next to their time zone. The choice is kept in a cookie, so server-rendered pages use it too.
+
+To add a language, create a catalog next to `src/lib/i18n/en.json` with the same keys, then register it in `src/lib/i18n/locales.ts` with its native name (add `dir: "rtl"` for right-to-left scripts). The selector, validation, and cookie handling pick it up from that registry. Missing keys fall back to English. English ships in the main bundle; other catalogs load on demand.
+
## Documentation
- [Deployment and configuration](docs/deployment.md)
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 5153ad5..4fdce48 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -47,8 +47,8 @@ export default async function HomePage() {
</nav> */}
<div className="flex items-center gap-2">
- <div className="hidden w-44 sm:block">
- <LanguageSelector />
+ <div className="hidden sm:block">
+ <LanguageSelector variant="text" />
</div>
<HomeHeaderActions />
</div>
diff --git a/src/components/language-selector.tsx b/src/components/language-selector.tsx
index 03f55f1..bec4902 100644
--- a/src/components/language-selector.tsx
+++ b/src/components/language-selector.tsx
@@ -1,20 +1,36 @@
"use client";
import { useId } from "react";
+import { ChevronDown } from "lucide-react";
import { locales, supportedLocales } from "@/lib/i18n/locales";
import { resolveLocale } from "@/lib/i18n/utils";
import { useLanguage } from "./language-provider";
-export function LanguageSelector() {
+export function LanguageSelector({ variant = "field" }: { variant?: "field" | "text" }) {
const id = useId();
const { locale, setLocale, t } = useLanguage();
+ const options = supportedLocales.map((value) => (
+ <option key={value} value={value} lang={value}>{locales[value].label}</option>
+ ));
+
+ if (variant === "text") {
+ // The select is invisible and stretched over a span showing the current label, so the width follows the selected value rather than the longest option.
+ return (
+ <div className="relative inline-flex items-center gap-1 rounded-md text-sm font-medium text-neutral-600 hover:text-neutral-950 focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-blue-600">
+ <span aria-hidden="true" className="py-2">{locales[locale].label}</span>
+ <ChevronDown className="h-4 w-4" aria-hidden="true" />
+ <select id={id} aria-label={t("language.label")} value={locale} onChange={(event) => setLocale(resolveLocale(event.target.value))} className="absolute inset-0 h-full w-full cursor-pointer opacity-0">
+ {options}
+ </select>
+ </div>
+ );
+ }
+
return (
<div className="flex flex-col gap-1 px-1">
<label htmlFor={id} className="text-xs text-neutral-600">{t("language.label")}</label>
<select id={id} value={locale} onChange={(event) => setLocale(resolveLocale(event.target.value))} className="min-h-11 w-full rounded-lg border border-neutral-300 bg-white px-2 text-sm text-neutral-800 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600">
- {supportedLocales.map((value) => (
- <option key={value} value={value} lang={value}>{locales[value].label}</option>
- ))}
+ {options}
</select>
</div>
);
diff --git a/src/components/settings/account-settings.tsx b/src/components/settings/account-settings.tsx
index 275707a..3c464e5 100644
--- a/src/components/settings/account-settings.tsx
+++ b/src/components/settings/account-settings.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import { useLanguage } from "@/components/language-provider";
+import { LanguageSelector } from "@/components/language-selector";
import { Skeleton } from "@/components/ui/skeleton";
import { ForwardingEmailForm } from "./forwarding-email-form";
import { MailboxSignatureForm } from "./mailbox-signature-form";
@@ -63,8 +64,6 @@ export function AccountSettings() {
email={user.email}
/>
- <TimeZoneForm userId={user.id} initialTimeZone={user.timeZone} />
-
{user.canForwardEmail && (
<div className="space-y-4 rounded-lg bg-white p-6">
<div>
@@ -85,6 +84,19 @@ export function AccountSettings() {
</div>
</section>
+ <section className="space-y-4">
+ <div>
+ <h2 className="text-xl font-semibold text-neutral-900">{t("settings.account.generalTitle")}</h2>
+ <p className="mt-1 text-sm text-neutral-500">{t("settings.account.generalDescription")}</p>
+ </div>
+ <div className="space-y-1 overflow-hidden rounded-3xl">
+ <div className="rounded-t-3xl rounded-b-lg bg-white p-6">
+ <h3 className="mb-3 text-lg font-semibold text-neutral-900">{t("language.label")}</h3>
+ <div className="max-w-xs [&>div]:px-0 [&_label]:sr-only"><LanguageSelector /></div>
+ </div>
+ <TimeZoneForm userId={user.id} initialTimeZone={user.timeZone} />
+ </div>
+ </section>
</div>
);
}
diff --git a/src/components/sidebar-footer.tsx b/src/components/sidebar-footer.tsx
index 79eb7a3..d7f0c2b 100644
--- a/src/components/sidebar-footer.tsx
+++ b/src/components/sidebar-footer.tsx
@@ -4,7 +4,6 @@ import packageJson from "../../package.json";
import { useSidebar } from "./sidebar-state";
import { useShortcuts } from "./shortcuts";
import { Keyboard } from "lucide-react";
-import { LanguageSelector } from "./language-selector";
import { useLanguage } from "./language-provider";
export function SidebarFooter() {
@@ -15,7 +14,6 @@ export function SidebarFooter() {
return (
<div className="px-3 pt-3 flex flex-col gap-2">
- <LanguageSelector />
{shortcutsEnabled && !shortcutsPreferenceLoading && (
<button
type="button"
diff --git a/src/lib/i18n/ar.json b/src/lib/i18n/ar.json
index 88597fa..41d805d 100644
--- a/src/lib/i18n/ar.json
+++ b/src/lib/i18n/ar.json
@@ -395,6 +395,8 @@
"common.loading": "جارٍ التحميل...",
"settings.account.loadFailed": "فشل تحميل الحساب",
"settings.account.detailsTitle": "تفاصيل الحساب",
+ "settings.account.generalTitle": "عام",
+ "settings.account.generalDescription": "اللغة والمنطقة الزمنية لحسابك.",
"settings.account.detailsDescription": "أدِر هويتك وخيارات الاسترداد وتفضيلات البريد.",
"settings.account.forwardingTitle": "بريد إعادة التوجيه",
"settings.account.forwardingDescription": "أرسل نسخة من الرسائل الواردة إلى عنوان بريد آخر.",
diff --git a/src/lib/i18n/bn.json b/src/lib/i18n/bn.json
index 3acb0c2..74af1d6 100644
--- a/src/lib/i18n/bn.json
+++ b/src/lib/i18n/bn.json
@@ -1859,5 +1859,7 @@
"layout.resizeMenu": "বাম মেনুর আকার পরিবর্তন করুন",
"nav.loadingPage": "পৃষ্ঠা লোড হচ্ছে",
"message.blockRemote": "দূরবর্তী বিষয়বস্তু ব্লক করুন",
- "message.allowRemote": "দূরবর্তী বিষয়বস্তুর অনুমতি দিন"
+ "message.allowRemote": "দূরবর্তী বিষয়বস্তুর অনুমতি দিন",
+ "settings.account.generalTitle": "সাধারণ",
+ "settings.account.generalDescription": "আপনার অ্যাকাউন্টের ভাষা ও টাইম জোন।"
}
diff --git a/src/lib/i18n/de.json b/src/lib/i18n/de.json
index 865ecec..978259c 100644
--- a/src/lib/i18n/de.json
+++ b/src/lib/i18n/de.json
@@ -379,6 +379,8 @@
"common.loading": "Wird geladen...",
"settings.account.loadFailed": "Das Konto konnte nicht geladen werden",
"settings.account.detailsTitle": "Kontodetails",
+ "settings.account.generalTitle": "Allgemein",
+ "settings.account.generalDescription": "Sprache und Zeitzone für dein Konto.",
"settings.account.detailsDescription": "Verwalten Sie Ihre Identität, Wiederherstellungsoptionen und E-Mail-Einstellungen.",
"settings.account.forwardingTitle": "Weiterleitungs-E-Mail",
"settings.account.forwardingDescription": "Senden Sie eine Kopie eingehender Nachrichten an eine andere E-Mail-Adresse.",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 89b8399..60cf6de 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -379,6 +379,8 @@
"common.loading": "Loading...",
"settings.account.loadFailed": "Failed to load account",
"settings.account.detailsTitle": "Account details",
+ "settings.account.generalTitle": "General",
+ "settings.account.generalDescription": "Language and time zone for your account.",
"settings.account.detailsDescription": "Manage your identity, recovery options, and email preferences.",
"settings.account.forwardingTitle": "Forwarding email",
"settings.account.forwardingDescription": "Send a copy of incoming messages to another email address.",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 90615e9..029e47a 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -379,6 +379,8 @@
"common.loading": "Cargando...",
"settings.account.loadFailed": "No se pudo cargar la cuenta",
"settings.account.detailsTitle": "Detalles de la cuenta",
+ "settings.account.generalTitle": "General",
+ "settings.account.generalDescription": "Idioma y zona horaria de tu cuenta.",
"settings.account.detailsDescription": "Gestiona tu identidad, las opciones de recuperación y tus preferencias de correo.",
"settings.account.forwardingTitle": "Correo de reenvío",
"settings.account.forwardingDescription": "Envía una copia de los mensajes entrantes a otra dirección de correo.",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index 214fbe0..ca16234 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -379,6 +379,8 @@
"common.loading": "Chargement...",
"settings.account.loadFailed": "Échec du chargement du compte",
"settings.account.detailsTitle": "Détails du compte",
+ "settings.account.generalTitle": "Général",
+ "settings.account.generalDescription": "Langue et fuseau horaire de votre compte.",
"settings.account.detailsDescription": "Gérez votre identité, vos options de récupération et vos préférences d'e-mail.",
"settings.account.forwardingTitle": "E-mail de transfert",
"settings.account.forwardingDescription": "Envoyez une copie des messages entrants à une autre adresse e-mail.",
diff --git a/src/lib/i18n/hi.json b/src/lib/i18n/hi.json
index d041092..62da18b 100644
--- a/src/lib/i18n/hi.json
+++ b/src/lib/i18n/hi.json
@@ -379,6 +379,8 @@
"common.loading": "लोड हो रहा है...",
"settings.account.loadFailed": "खाता लोड नहीं हो सका",
"settings.account.detailsTitle": "खाते का विवरण",
+ "settings.account.generalTitle": "सामान्य",
+ "settings.account.generalDescription": "आपके खाते की भाषा और समय क्षेत्र।",
"settings.account.detailsDescription": "अपनी पहचान, रिकवरी विकल्प और ईमेल प्राथमिकताएँ प्रबंधित करें।",
"settings.account.forwardingTitle": "फ़ॉरवर्डिंग ईमेल",
"settings.account.forwardingDescription": "आने वाले संदेशों की एक प्रति किसी अन्य ईमेल पते पर भेजें।",
diff --git a/src/lib/i18n/id.json b/src/lib/i18n/id.json
index 3ce0e9d..0915b0f 100644
--- a/src/lib/i18n/id.json
+++ b/src/lib/i18n/id.json
@@ -375,6 +375,8 @@
"common.loading": "Memuat...",
"settings.account.loadFailed": "Gagal memuat akun",
"settings.account.detailsTitle": "Detail akun",
+ "settings.account.generalTitle": "Umum",
+ "settings.account.generalDescription": "Bahasa dan zona waktu untuk akun Anda.",
"settings.account.detailsDescription": "Kelola identitas, opsi pemulihan, dan preferensi email Anda.",
"settings.account.forwardingTitle": "Email penerusan",
"settings.account.forwardingDescription": "Kirim salinan pesan masuk ke alamat email lain.",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index dcd2a4b..dd93c6d 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -375,6 +375,8 @@
"common.loading": "読み込み中…",
"settings.account.loadFailed": "アカウントを読み込めませんでした",
"settings.account.detailsTitle": "アカウントの詳細",
+ "settings.account.generalTitle": "一般",
+ "settings.account.generalDescription": "アカウントの言語とタイムゾーン。",
"settings.account.detailsDescription": "ID、復旧オプション、メールの設定を管理します。",
"settings.account.forwardingTitle": "転送メール",
"settings.account.forwardingDescription": "受信メールのコピーを別のメールアドレスに送信します。",
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index b407666..718e729 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -379,6 +379,8 @@
"common.loading": "Carregando...",
"settings.account.loadFailed": "Falha ao carregar a conta",
"settings.account.detailsTitle": "Detalhes da conta",
+ "settings.account.generalTitle": "Geral",
+ "settings.account.generalDescription": "Idioma e fuso horário da sua conta.",
"settings.account.detailsDescription": "Gerencie sua identidade, opções de recuperação e preferências de e-mail.",
"settings.account.forwardingTitle": "E-mail de encaminhamento",
"settings.account.forwardingDescription": "Envie uma cópia das mensagens recebidas para outro endereço de e-mail.",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index 13f0e79..07ca085 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -383,6 +383,8 @@
"common.loading": "Загрузка...",
"settings.account.loadFailed": "Не удалось загрузить аккаунт",
"settings.account.detailsTitle": "Данные аккаунта",
+ "settings.account.generalTitle": "Общие",
+ "settings.account.generalDescription": "Язык и часовой пояс вашего аккаунта.",
"settings.account.detailsDescription": "Управляйте своими данными, способами восстановления и настройками почты.",
"settings.account.forwardingTitle": "Адрес для пересылки",
"settings.account.forwardingDescription": "Отправляйте копию входящих сообщений на другой адрес электронной почты.",
diff --git a/src/lib/i18n/tr.json b/src/lib/i18n/tr.json
index aa30282..7afda4d 100644
--- a/src/lib/i18n/tr.json
+++ b/src/lib/i18n/tr.json
@@ -379,6 +379,8 @@
"common.loading": "Yükleniyor...",
"settings.account.loadFailed": "Hesap yüklenemedi",
"settings.account.detailsTitle": "Hesap ayrıntıları",
+ "settings.account.generalTitle": "Genel",
+ "settings.account.generalDescription": "Hesabınızın dili ve saat dilimi.",
"settings.account.detailsDescription": "Kimliğinizi, kurtarma seçeneklerinizi ve e-posta tercihlerinizi yönetin.",
"settings.account.forwardingTitle": "E-posta yönlendirme",
"settings.account.forwardingDescription": "Gelen iletilerin bir kopyasını başka bir e-posta adresine gönderin.",
diff --git a/src/lib/i18n/vi.json b/src/lib/i18n/vi.json
index ffd185f..bbe5bfa 100644
--- a/src/lib/i18n/vi.json
+++ b/src/lib/i18n/vi.json
@@ -375,6 +375,8 @@
"common.loading": "Đang tải...",
"settings.account.loadFailed": "Không thể tải tài khoản",
"settings.account.detailsTitle": "Chi tiết tài khoản",
+ "settings.account.generalTitle": "Chung",
+ "settings.account.generalDescription": "Ngôn ngữ và múi giờ cho tài khoản của bạn.",
"settings.account.detailsDescription": "Quản lý danh tính, tùy chọn khôi phục và tùy chọn email của bạn.",
"settings.account.forwardingTitle": "Email chuyển tiếp",
"settings.account.forwardingDescription": "Gửi bản sao các thư đến tới một địa chỉ email khác.",
diff --git a/src/lib/i18n/zh-CN.json b/src/lib/i18n/zh-CN.json
index c5d6041..88c43f0 100644
--- a/src/lib/i18n/zh-CN.json
+++ b/src/lib/i18n/zh-CN.json
@@ -375,6 +375,8 @@
"common.loading": "正在加载…",
"settings.account.loadFailed": "无法加载账户",
"settings.account.detailsTitle": "账户详情",
+ "settings.account.generalTitle": "常规",
+ "settings.account.generalDescription": "账户的语言和时区。",
"settings.account.detailsDescription": "管理你的身份、恢复选项和邮件偏好设置。",
"settings.account.forwardingTitle": "转发邮件",
"settings.account.forwardingDescription": "将收到的邮件副本发送到另一个邮箱地址。",