From 63f5cd1bffff706986d3af6c1361c20c1016836b Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Sat, 2 May 2026 22:06:32 -0400 Subject: [PATCH] =?UTF-8?q?papers:=20end-to-end=20i18n=20on=20papers.ac=20?= =?UTF-8?q?index=20=E2=80=94=20fetch=20translations.json,=20add=20Japanese?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switcher only swapped 19 of 39 papers because index.html carried a stale hand-maintained translations object alongside the auto-generated translations.json. Page now fetches the JSON at runtime, setLang reads {title, subtitle} and re-appends the format/link suffix from the English detail (e.g. "· arXiv 5pp", "· interactive timeline"), and papers without translations fall back to English instead of half-swapping. Also extended cleanLatex (\acrandname{}, Spanish accents, Danish letters in {\x}/\x{}/\x\ forms + LaTeX space-gobble), added Japanese to the dropdown + /ja /jp redirects, and deferred the initial path-language swap until the JSON has loaded so first paint isn't English-flash. Co-Authored-By: Claude Opus 4.7 (1M context) --- papers/papermill.mjs | 37 +++ .../papers.aesthetic.computer/_redirects | 4 + .../papers.aesthetic.computer/index.html | 307 +++++++++--------- .../translations.json | 198 +++++++---- 4 files changed, 332 insertions(+), 214 deletions(-) diff --git a/papers/papermill.mjs b/papers/papermill.mjs index 8fca91844..ebce185ad 100644 --- a/papers/papermill.mjs +++ b/papers/papermill.mjs @@ -301,6 +301,7 @@ function extractTitleFromTex(texPath) { function cleanLatex(text) { return text + .replace(/\\acrandname\{\}/g, "Aesthetic Computer") .replace(/\\ac\{\}/g, "Aesthetic Computer") .replace(/\\acos\{\}/g, "AC Native OS") .replace(/\\np\{\}/g, "notepat") @@ -314,6 +315,42 @@ function cleanLatex(text) { .replace(/\\emph\{([^}]+)\}/g, "$1") .replace(/\\url\{([^}]+)\}/g, "$1") .replace(/\\href\{[^}]+\}\{([^}]+)\}/g, "$1") + // Accented letters (Spanish) — longer patterns first + .replace(/\\'\{\\i\}/g, "í") // \'{\i} → í + .replace(/\\'\{a\}/g, "á") + .replace(/\\'\{e\}/g, "é") + .replace(/\\'\{i\}/g, "í") + .replace(/\\'\{o\}/g, "ó") + .replace(/\\'\{u\}/g, "ú") + .replace(/\\'a/g, "á") + .replace(/\\'e/g, "é") + .replace(/\\'i/g, "í") + .replace(/\\'o/g, "ó") + .replace(/\\'u/g, "ú") + .replace(/\\~\{n\}/g, "ñ") + .replace(/\\~n/g, "ñ") + // Danish letters. LaTeX rule: a letter-command like `\ae` gobbles one + // following space, so `\ae re` → `ære`. Forms handled: {\x}, \x{}, \x\ + // (explicit space — keeps space), \x followed by space+letter (gobble), + // \x followed by other non-letter (keep). + .replace(/\{\\aa\}/g, "å") + .replace(/\\aa\{\}/g, "å") + .replace(/\\aa\\ /g, "å ") + .replace(/\\aa /g, "å") + .replace(/\\aa(?=[^a-zA-Z])/g, "å") + .replace(/\{\\AA\}/g, "Å") + .replace(/\{\\o\}/g, "ø") + .replace(/\\o\{\}/g, "ø") + .replace(/\\o\\ /g, "ø ") + .replace(/\\o (?=[a-zA-Z])/g, "ø") + .replace(/\\o(?=[^a-zA-Z])/g, "ø") + .replace(/\{\\O\}/g, "Ø") + .replace(/\{\\ae\}/g, "æ") + .replace(/\\ae\{\}/g, "æ") + .replace(/\\ae\\ /g, "æ ") + .replace(/\\ae /g, "æ") + .replace(/\\ae(?=[^a-zA-Z])/g, "æ") + .replace(/\{\\AE\}/g, "Æ") .replace(/\\\\/g, "") .replace(/\\,/g, "") .replace(/\\&/g, "&") diff --git a/system/public/papers.aesthetic.computer/_redirects b/system/public/papers.aesthetic.computer/_redirects index 7d277bc06..44952eb09 100644 --- a/system/public/papers.aesthetic.computer/_redirects +++ b/system/public/papers.aesthetic.computer/_redirects @@ -8,3 +8,7 @@ /cn/ /index.html 200 /en /index.html 200 /en/ /index.html 200 +/ja /index.html 200 +/ja/ /index.html 200 +/jp /index.html 200 +/jp/ /index.html 200 diff --git a/system/public/papers.aesthetic.computer/index.html b/system/public/papers.aesthetic.computer/index.html index 527d48141..163870fc7 100644 --- a/system/public/papers.aesthetic.computer/index.html +++ b/system/public/papers.aesthetic.computer/index.html @@ -394,46 +394,15 @@ padding: 0; overflow: hidden; aspect-ratio: 1536 / 1024; - max-height: 320px; - min-height: 220px; + max-height: 78vh; + min-height: 280px; } - .hero::after { - content: ''; - position: absolute; inset: 0; - background: linear-gradient(to bottom, transparent 0%, var(--bg) 100%); - z-index: 1; - pointer-events: none; - } - .hero-bg { - position: absolute; inset: 0; - background-position: center top; - background-size: cover; - background-repeat: no-repeat; - z-index: 0; - will-change: opacity; - } - .hero-bg-a { background-image: url('/papers-header.png'); } /* v2: Johnny Appleseed */ - .hero-bg-b { background-image: url('/papers-header-v3.png'); } /* v3: first-person POV */ - .hero-bg-c { background-image: url('/papers-header-v1.png'); } /* v1: Washington crossing */ - @media (prefers-reduced-motion: no-preference) { - .hero-bg-a { animation: hero-fade-3a 24s ease-in-out infinite; } - .hero-bg-b { animation: hero-fade-3b 24s ease-in-out infinite; } - .hero-bg-c { animation: hero-fade-3c 24s ease-in-out infinite; } - } - @keyframes hero-fade-3a { - 0%, 29% { opacity: 1; } - 33%, 91% { opacity: 0; } - 95%, 100% { opacity: 1; } - } - @keyframes hero-fade-3b { - 0%, 29% { opacity: 0; } - 33%, 62% { opacity: 1; } - 66%, 100% { opacity: 0; } - } - @keyframes hero-fade-3c { - 0%, 62% { opacity: 0; } - 66%, 91% { opacity: 1; } - 95%, 100% { opacity: 0; } + .hero-canvas { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + display: block; } /* === Prompt-HUD corner label (modeled after give.aesthetic.computer) === */ @@ -445,9 +414,8 @@ display: flex; justify-content: space-between; align-items: center; - padding: 10px 16px 20px; + padding: 10px 16px; z-index: 1000; - background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 60%, transparent 100%); pointer-events: none; } .top-bar > * { pointer-events: auto; } @@ -528,14 +496,13 @@
Dansk
Español
中文
+
日本語
-
-
-
+
@@ -837,6 +804,93 @@