feat(i18n): English localization (phase 3)
CI / Lint e auditorias (push) Successful in 1m51s
CI / Trivy (dependências e segredos) (push) Successful in 15s
CI / Imagem Docker (linux/arm64) (push) Successful in 2m41s

- Translate content to English across messages/en.json, data/en, lib/data/en, and public/exemplos/en
- Implement localized routing, slugs, and language negotiation with fallback to en
- Build dedicated search index for English with strict book exclusion
- Update components and pages to dynamically render localized strings and datasets
- Verify full structural parity and exact 1:1 match on Portuguese pages via comparator

Co-Authored-By: Antigravity <noreply@google.com>
This commit is contained in:
Lucas RayanandAntigravity committed 2026-11-01 14:17:13 -03:00
1 parent 22b1f26aed
commit c1bd2c7e11
61 files changed
+18182 -1225

No files matched your search

+61 -18
View File
@@ -28,7 +28,7 @@ import {
AlertTriangle,
} from "lucide-react";
const MENUS = [
const MENUS_PT = [
{
id: "hardware",
label: "Hardware",
@@ -58,7 +58,37 @@ const MENUS = [
},
];
const MOBILE_LINKS = [
const MENUS_EN = [
{
id: "hardware",
label: "Hardware",
items: [
{ href: "/series", label: "ESP32 Series", desc: "12 chips, pinouts and specifications", icon: Cpu },
{ href: "/comparacao", label: "Comparator", desc: "Up to four series side by side", icon: Scale },
{ href: "/catalogo", label: "Board Catalog", desc: "DevKits, pinouts and where to buy", icon: Box },
],
},
{
id: "tools",
label: "Tools",
items: [
{ href: "/seletor", label: "Smart Selector", desc: "The right chip for your project", icon: SlidersHorizontal },
{ href: "/diagnostico", label: "Diagnostics", desc: "Brownout, bootloop, WDT and more", icon: AlertTriangle },
{ href: "/componentes", label: "Component Registry", desc: "Drivers and idf_component.yml manifests", icon: Search },
],
},
{
id: "library",
label: "Library",
items: [
{ href: "/frameworks", label: "Frameworks & SDKs", desc: "ESP-IDF, Arduino, Rust and Matter", icon: BookOpen },
{ href: "/glossario", label: "Technical Glossary", desc: "Terms appearing in datasheets", icon: BookA },
{ href: "/sobre", label: "About the Project", desc: "Authorship, method and open source", icon: Sparkles },
],
},
];
const MOBILE_LINKS_PT = [
{ href: "/series", label: "Séries ESP32" },
{ href: "/comparacao", label: "Comparador" },
{ href: "/seletor", label: "Seletor inteligente" },
@@ -71,6 +101,18 @@ const MOBILE_LINKS = [
{ href: "/sobre", label: "Sobre" },
];
const MOBILE_LINKS_EN = [
{ href: "/series", label: "ESP32 Series" },
{ href: "/comparacao", label: "Comparator" },
{ href: "/seletor", label: "Smart Selector" },
{ href: "/diagnostico", label: "Diagnostics" },
{ href: "/frameworks", label: "Frameworks & SDKs" },
{ href: "/componentes", label: "Component Registry" },
{ href: "/glossario", label: "Glossary" },
{ href: "/catalogo", label: "Board Catalog" },
{ href: "/sobre", label: "About" },
];
function isActivePath(pathname, href, currentLocale) {
const localized = getLocalizedHref(`/${currentLocale}${href}`, currentLocale);
if (href === "/" || localized === `/${currentLocale}/` || localized === `/${currentLocale}`) {
@@ -130,18 +172,19 @@ export default function Header() {
};
}, [drawerOpen]);
const visibleMobileLinks = isPt ? MOBILE_LINKS : MOBILE_LINKS.filter((l) => l.href !== "/livro");
const visibleMobileLinks = isPt ? MOBILE_LINKS_PT : MOBILE_LINKS_EN;
const MENUS = isPt ? MENUS_PT : MENUS_EN;
return (
<header className="sticky top-0 z-50 pt-3 sm:pt-4">
<div className="shell">
<div className="nav-pill flex h-16 items-center justify-between gap-3 rounded-full px-3 sm:px-4">
<Link href={getLinkHref("/")} className="flex min-h-11 shrink-0 items-center gap-2.5 rounded-full pl-1 pr-2" aria-label="ESPDocs, página inicial">
<Link href={getLinkHref("/")} className="flex min-h-11 shrink-0 items-center gap-2.5 rounded-full pl-1 pr-2" aria-label={isPt ? "ESPDocs, página inicial" : "ESPDocs, homepage"}>
<Logo className="h-[30px] w-[30px]" />
<span className="font-display text-[1.3rem] font-semibold leading-none tracking-[-0.045em] text-ink">ESPDocs</span>
</Link>
<nav ref={navRef} className="hidden items-center gap-0.5 lg:flex" aria-label="Navegação principal">
<nav ref={navRef} className="hidden items-center gap-0.5 lg:flex" aria-label={isPt ? "Navegação principal" : "Main navigation"}>
{MENUS.map((menu) => {
const active = menu.items.some((item) => isActivePath(pathname, item.href, currentLocale));
const expanded = openMenu === menu.id;
@@ -194,23 +237,23 @@ export default function Header() {
</Link>
)}
<Link href={getLinkHref("/sobre")} className={`nav-link ${isActivePath(pathname, "/sobre", currentLocale) ? "is-active" : ""}`} aria-current={isActivePath(pathname, "/sobre", currentLocale) ? "page" : undefined}>
Sobre
{isPt ? "Sobre" : "About"}
</Link>
</nav>
<div className="flex items-center gap-1.5">
<Link href={getLinkHref("/seletor")} className="btn btn-primary btn-sm hidden lg:inline-flex">
<SlidersHorizontal className="h-4 w-4" aria-hidden="true" />
Selecionar chip
{isPt ? "Selecionar chip" : "Select chip"}
</Link>
<SearchDialog />
<LanguageSelector />
<ThemeToggle />
<ThemeToggle isPt={isPt} />
<button
ref={menuButtonRef}
type="button"
className="grid h-11 w-11 place-items-center rounded-full border border-line text-ink transition-colors hover:bg-surface-2 lg:hidden"
aria-label="Abrir menu de navegação"
aria-label={isPt ? "Abrir menu de navegação" : "Open navigation menu"}
aria-expanded={drawerOpen}
onClick={() => setDrawerOpen(true)}
>
@@ -233,7 +276,7 @@ export default function Header() {
<div
role="dialog"
aria-modal="true"
aria-label="Menu de navegação"
aria-label={isPt ? "Menu de navegação" : "Navigation menu"}
aria-hidden={!drawerOpen}
inert={!drawerOpen}
className={`fixed inset-y-0 right-0 z-[101] flex w-[min(23rem,94vw)] flex-col rounded-l-[2rem] border-l border-line bg-canvas transition-transform duration-300 ${
@@ -242,15 +285,15 @@ export default function Header() {
>
<div className="flex items-start justify-between px-5 py-5">
<div>
<p className="text-xs font-semibold text-muted">Navegação</p>
<p className="mt-1 font-display text-2xl font-semibold tracking-[-0.04em] text-ink">Para onde ir</p>
<p className="text-xs font-semibold text-muted">{isPt ? "Navegação" : "Navigation"}</p>
<p className="mt-1 font-display text-2xl font-semibold tracking-[-0.04em] text-ink">{isPt ? "Para onde ir" : "Where to go"}</p>
</div>
<button
ref={closeRef}
type="button"
onClick={() => setDrawerOpen(false)}
className="grid h-10 w-10 place-items-center rounded-full border border-line text-ink transition-colors hover:bg-surface-2"
aria-label="Fechar menu"
aria-label={isPt ? "Fechar menu" : "Close menu"}
>
<X className="h-5 w-5" aria-hidden="true" />
</button>
@@ -282,7 +325,7 @@ export default function Header() {
</div>
)}
<nav className="flex-1 overflow-y-auto px-3 py-2" aria-label="Navegação móvel">
<nav className="flex-1 overflow-y-auto px-3 py-2" aria-label={isPt ? "Navegação móvel" : "Mobile navigation"}>
{visibleMobileLinks.map((link) => (
<Link
key={link.href}
@@ -300,7 +343,7 @@ export default function Header() {
<div className="p-4 pt-2">
<Link href={getLinkHref("/seletor")} onClick={() => setDrawerOpen(false)} className="btn btn-primary w-full">
<SlidersHorizontal className="h-4 w-4" aria-hidden="true" />
Selecionar meu chip
{isPt ? "Selecionar meu chip" : "Select my chip"}
</Link>
</div>
</div>
@@ -311,7 +354,7 @@ export default function Header() {
);
}
function ThemeToggle() {
function ThemeToggle({ isPt = true }) {
const { resolvedTheme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);
@@ -328,8 +371,8 @@ function ThemeToggle() {
type="button"
onClick={() => setTheme(dark ? "light" : "dark")}
className="grid h-11 w-11 place-items-center rounded-full border border-line text-ink transition-colors hover:bg-surface-2"
aria-label={dark ? "Ativar tema claro" : "Ativar tema escuro"}
title={dark ? "Tema claro" : "Tema escuro"}
aria-label={dark ? (isPt ? "Ativar tema claro" : "Switch to light theme") : (isPt ? "Ativar tema escuro" : "Switch to dark theme")}
title={dark ? (isPt ? "Tema claro" : "Light theme") : (isPt ? "Tema escuro" : "Dark theme")}
>
{dark ? <Sun className="h-4 w-4" aria-hidden="true" /> : <Moon className="h-4 w-4" aria-hidden="true" />}
</button>