Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
feat: add LanguageSwitcher β community Chinese translation link
#14
by xilanhua12138 - opened
Summary
Adds a reusable LanguageSwitcher.astro component that displays available language versions in the article metadata section (alongside Authors, Affiliations, Published, PDF).
Changes
- New:
app/src/components/LanguageSwitcher.astroβ accessible, theme-aware nav component - Modified:
app/src/components/Hero.astroβ accepts optionaltranslationsandtranslationsLabelprops - Modified:
app/src/pages/index.astroβ readstranslationsfrom article frontmatter - Modified:
app/src/content/article.mdxβ links to a community Chinese translation
Usage (frontmatter-driven)
translationsLabel: "Available in"
translations:
- lang: en
label: English
url: https://huggingfacetb-smol-training-playbook.hf.space
flag: "πΊπΈ"
current: true
- lang: zh
label: δΈζ
url: https://xilanhua12138.github.io/smol-training-playbook-cn/
flag: "π¨π³"
The component renders as a compact inline switcher in the article header:
πΊπΈ English / π¨π³ δΈζ
Articles without a translations key are completely unaffected (opt-in).
Community Chinese Translation
This PR links to a complete community Chinese translation of The Smol Training Playbook:
π¨π³ https://xilanhua12138.github.io/smol-training-playbook-cn/
Code Preview
Full changes available at: https://huggingface.co/spaces/xilanhua12138/smol-training-playbook-pr/tree/main/app/src