Skip to content

feat: add Chinese i18n, code syntax highlighting, and site localization#4

Merged
markbang merged 5 commits into
mainfrom
copilot/optimize-site-add-code-highlighting
Mar 7, 2026
Merged

feat: add Chinese i18n, code syntax highlighting, and site localization#4
markbang merged 5 commits into
mainfrom
copilot/optimize-site-add-code-highlighting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

Adds Chinese (zh) locale support, integrates highlight.js for code block syntax highlighting in embeds, and localizes all hardcoded site UI text through Paraglide JS message functions.

i18n

  • Added zh locale to Paraglide config and created messages/zh.json with full Chinese translations
  • Extended en.json and de.json with ~65 new message keys covering nav, hero, features, integration cards, CTA, footer
  • Replaced all hardcoded English strings in Header, Footer, __root, and index.tsx with m.*() calls
  • Simplified LocaleSwitcher — shows display names (EN / DE / 中文), dropped verbose "Current locale" prefix

Code highlighting

  • Added highlight.js with tree-shaken language imports (JS, TS, Python, Go, CSS, HTML, JSON, YAML, SQL, Shell, Markdown)
  • src/lib/highlight.ts exports highlightCodeBlocks() which runs hljs on pre[data-language] code elements
  • Integrated into embed route — highlights after innerHTML injection
  • GitHub light theme via CSS import; dark mode colors scoped under .dark; .hljs { background: transparent } defers to embed theme's --me-code-bg

Build optimization

  • Added hljs-vendor manual chunk in Vite config

Test updates

  • Paraglide messages mock upgraded to Proxy-based — auto-returns key name for any undefined message, no need to manually add stubs
  • Smoke test assertions updated to match message-key-based rendering
// Before
<h1>Share your thoughts <span>anywhere</span></h1>

// After
<h1>{m.hero_title_main()} <span>{m.hero_title_highlight()}</span></h1>

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js dev --port 3000 ighlighting o-authored-by: markbang &lt;119404476&#43;markbang@users.noreply.github.com&gt; (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js build grep -l PluginImportError nlang/paraglide-js/dist/compiler/runtime/strategy.test.js grep (dns block)
  • eu.posthog.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js dev --port 3000 ighlighting o-authored-by: markbang &lt;119404476&#43;markbang@users.noreply.github.com&gt; (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/memos-embed/memos-embed/apps/site/node_modules/.bin/../vite/bin/vite.js dev --port 3000 --local pull.rebase it (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.


Summary by cubic

Add full i18n with a new Chinese (zh) locale and language switching across header, footer, and home. Add theme-aware code syntax highlighting in embed previews.

  • New Features

    • Localized nav, theme names, aria labels, “skip to content,” and footer; added zh messages, updated en/de, adjusted inlang settings, and updated tests/mocks.
    • Integrated highlight.js to auto-highlight code blocks in the embed route, imported GitHub styles with dark overrides, and split highlighting into a vendor chunk (hljs-vendor).
  • Bug Fixes

    • Renamed LinkButton prop from labelKey to label to match usage and prevent type errors.

Written for commit b048e39. Summary will update on new commits.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
memos-embed-site Ready Ready Preview, Comment Mar 7, 2026 9:13am

Co-authored-by: markbang <119404476+markbang@users.noreply.github.com>
… support

Co-authored-by: markbang <119404476+markbang@users.noreply.github.com>
Co-authored-by: markbang <119404476+markbang@users.noreply.github.com>
Co-authored-by: markbang <119404476+markbang@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize site and add code highlighting with i18n support feat: add Chinese i18n, code syntax highlighting, and site localization Mar 7, 2026
@markbang markbang marked this pull request as ready for review March 7, 2026 09:52
@markbang markbang merged commit ff1ba43 into main Mar 7, 2026
4 checks passed
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 17 files

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.

2 participants