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 optional translations and translationsLabel props
  • Modified: app/src/pages/index.astro β€” reads translations from 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

Sign up or log in to comment