feat: showcase i18n with structured JSON + build-time MDX generation#88
Open
xuewenjie123 wants to merge 3 commits intoQwenLM:mainfrom
Open
feat: showcase i18n with structured JSON + build-time MDX generation#88xuewenjie123 wants to merge 3 commits intoQwenLM:mainfrom
xuewenjie123 wants to merge 3 commits intoQwenLM:mainfrom
Conversation
added 3 commits
April 2, 2026 17:12
- Implement JSON-driven i18n for showcase pages (7 languages) - Structured JSON format: overview, steps, callouts (replaces raw body) - Build-time MDX generation from structured JSON data - Add author and date fields with date-based sorting (newest first) - i18n support for ShowcaseDetailCta and all showcase components - Dynamic locale detection via useLocale() hook in all components - Add SHOWCASE_I18N_GUIDE.md documentation Scripts: - generate-showcase-mdx.js: JSON → MDX generation for all locales - generate-showcase-data.js: updated with author/date and reverse sorting - extract-showcase-data.js: MDX → JSON extraction utility - restructure-showcase-json.js: body → structured fields migration Components updated: - showcase-detail-meta.tsx: i18n CTA texts, author prop - video-showcase-index.tsx: dynamic locale links - video-showcase-detail.tsx: dynamic locale links - showcase-detail.tsx: dynamic locale links - showcase-cards.tsx: dynamic locale links 296 files changed across all 7 supported locales.
- Convert step content from raw Markdown string to typed blocks array (text, code, image, callout) for better maintainability - Add watch-showcase.js: watches showcase-i18n/*.json and auto-regenerates MDX files on change, works alongside npm run dev - Backward compatible: supports both blocks (new) and content (legacy) - Clean up noise data from content-to-blocks migration - Update SHOWCASE_I18N_GUIDE.md with blocks format docs and watch usage Scripts added: - restructure-steps-to-blocks.js: one-time migration from content to blocks - watch-showcase.js: file watcher for dev workflow New npm script: watch-showcase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Showcase i18n with structured JSON + build-time MDX generation
This PR implements a complete i18n solution for showcase pages, supporting all 7 languages (zh, en, de, fr, ja, pt-BR, ru). It adopts a structured JSON + build-time generation approach for maximum maintainability.
Changes
🏗️ Architecture: Structured JSON Data Source
bodystring with structured fields (overview,steps,callouts), making showcase content easy to configure without writing MDX markupgenerate-showcase-mdx.jsreads structured JSON and generates MDX files for all 7 locales, with auto-generated section headers, meta components, media blocks, and CTAzh.json; missing translations in other languages automatically fall back to Chinese📝 Data Generation
authoranddatefields to showcase datagenerate-showcase-data.jswith date-based primary sorting (newest first)🌐 i18n Support for Components
authorprop displayvideo-showcase-index,video-showcase-detail,showcase-detail,showcase-cards): Dynamic locale detection viauseLocale()hook, replacing hardcoded/zh/paths🔧 Scripts
generate-showcase-mdx.jsgenerate-showcase-data.jsextract-showcase-data.jsrestructure-showcase-json.js📖 Documentation
SHOWCASE_I18N_GUIDE.mdwith complete guide for adding/translating showcasesFiles Changed
showcase-i18n/{zh,en,de,fr,ja,pt-BR,ru}.jsoncontent/{lang}/showcase/*.mdx(39 showcases × 6 non-zh locales)content/zh/showcase/*.mdxHow to Add a New Showcase
Then run
node scripts/generate-showcase-mdx.jsto generate MDX files.See
SHOWCASE_I18N_GUIDE.mdfor full documentation.Testing