Skip to content

feat(i18n): add CJK font install banner for Linux#139

Merged
Nic-dorman merged 1 commit into
mainfrom
i18n/cjk-font-banner
May 21, 2026
Merged

feat(i18n): add CJK font install banner for Linux#139
Nic-dorman merged 1 commit into
mainfrom
i18n/cjk-font-banner

Conversation

@Nic-dorman
Copy link
Copy Markdown
Contributor

Summary

  • Adds a persistent, dismissible banner shown when running on Linux with a CJK locale active (today: ja)
  • Tells the user the Noto CJK font is missing and provides per-distro install commands (Arch / Debian / Fedora) with per-row Copy buttons
  • Locale-keyed dismissal via localStorage — one click, gone forever for that locale
  • Designed for trivial zh / ko extension: add to CJK_LOCALES set + add a script_label translation key per locale, no component changes

Why now

The base Linux font stack doesn't include CJK glyphs, and we deliberately don't bundle the ~80 MB Noto CJK font in the AppImage / .deb. Users who switch the app to Japanese (or auto-detect from OS locale) on a clean Linux install currently see tofu boxes with no in-app guidance. This was promised in the i18n phase 1 plan but didn't make the cut.

Design notes

  • No canvas glyph probe. We deliberately don't try to detect whether the font is actually missing. Canvas-width font detection is brittle, and a false positive (banner shown to a user who already has noto-cjk) costs them one dismiss click — much cheaper than the probe missing a real font gap.
  • Persistent banner, not a toast. User needs time to read the commands, identify their distro, and act. Banner sits in the layout banner stack alongside the storage-dir warning, styled blue (info, not error).
  • English-only message body with a bilingual 日本語 / prefix. If the font is present, the prefix renders correctly and confirms the message is about Japanese. If the font is absent, the prefix tofus and the English half still carries the meaning.
  • Linux-only. Windows and macOS ship CJK fonts by default.
  • Bulgarian / future Cyrillic locales — no banner. Cyrillic is part of the base Linux font fallback chain. bg was deliberately added as a Cyrillic stress test in v0.8.0-rc.1 and shipped working without any extra package.

Test plan

  • Needs Linux tester — verify on a clean Arch (no noto-cjk) with locale switched to JA: banner appears, English half + install commands readable, Copy buttons work
  • Same Arch after pacman -S noto-fonts-cjk and restart: banner still appears (we don't probe), Dismiss click hides it permanently for ja
  • Ubuntu / Fedora spot-checks with their respective install commands
  • macOS / Windows in JA: banner never shows (verified by Linux-only platform check)
  • Linux + BG locale: banner never shows (verified by CJK_LOCALES set membership)
  • Switching JA → EN mid-session hides the banner; switching back shows it again (unless dismissed)
  • vue-tsc --noEmit clean
  • npm run build clean

🤖 Generated with Claude Code

Persistent dismissible banner shown when running on Linux with a CJK
locale active (today: ja). Tells the user the Noto CJK font is missing
and provides distro-specific install commands (Arch / Debian / Fedora)
with per-row Copy buttons.

The banner is locale-keyed for dismissal via localStorage, so adding
zh / ko later is mechanical: extend CJK_LOCALES + add the native
script_label to the locale JSON.

No canvas glyph probe — the Linux + CJK-locale heuristic is good
enough, and a false positive costs the user one dismiss click.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman merged commit 15a8b46 into main May 21, 2026
4 checks passed
@Nic-dorman Nic-dorman deleted the i18n/cjk-font-banner branch May 21, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant