${esc(product.en)}
${esc(product.name)}
${esc(product.body)}
${esc(product.cta)}import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { en } from "../src/i18n/en.ts";
import { fr } from "../src/i18n/fr.ts";
import { ja } from "../src/i18n/ja.ts";
import { zh } from "../src/i18n/zh.ts";
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
const outDir = path.join(root, "html");
const copies = { zh, en, ja, fr };
const LANGS = ["zh", "en", "ja", "fr"];
const htmlLang = { zh: "zh-CN", en: "en", ja: "ja", fr: "fr" };
const langLabels = { zh: "中文", en: "English", ja: "日本語", fr: "Français" };
function esc(value) {
return String(value)
.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll('"', """);
}
function assetPrefix(lang) {
return lang === "zh" ? "" : "../";
}
function pageHref(fromLang, toLang, page) {
const file = page === "home" ? "index.html" : "about.html";
if (fromLang === toLang) return file;
if (fromLang === "zh") return `${toLang}/${file}`;
if (toLang === "zh") return `../${file}`;
return `../${toLang}/${file}`;
}
function productHref(key, lang) {
if (key === "massiveedit" && (lang === "en" || lang === "fr")) {
return "/massiveedit/en/";
}
return `/${key}/`;
}
const ICONS = {
chevron: ``,
moon: ``,
sun: ``,
menu: ``,
};
function header(lang, page) {
const L = copies[lang];
const prefix = assetPrefix(lang);
const home = pageHref(lang, lang, "home");
const about = pageHref(lang, lang, "about");
const products = `${home}#products`;
const nav = [
{ label: L.nav.home, href: home, current: page === "home" },
{ label: L.nav.products, href: products, current: false },
{ label: L.nav.about, href: about, current: page === "about" },
];
return ` ${esc(L.brand.strong)} · ${esc(L.brand.suffix)} ${esc(L.home.heroSubtitle)} ${esc(L.home.productsLead)} ${esc(product.en)} ${esc(product.body)} ${esc(L.home.companyBody)} ${esc(L.home.contactBody)} ${esc(L.brand.strong)} · ${esc(L.brand.suffix)} ${esc(L.about.heroLead)} ${esc(L.about.visionBody)} ${esc(L.about.missionBody)} ${esc(L.about.storyBody)} ${esc(L.about.teamBody)}
${langLabels[lang]}
${ICONS.chevron}
${esc(L.home.heroTitle)}
${esc(L.home.productsTitle)}
${esc(product.name)}
${esc(L.home.companyTitle)}
${esc(L.home.contactTitle)}
${esc(L.about.heroTitle)}
${esc(L.about.visionTitle)}
${esc(L.about.missionTitle)}
${esc(L.about.storyTitle)}
${esc(L.about.teamTitle)}