feat: add LanguageSwitcher component with community Chinese translation
Summary
Adds a reusable LanguageSwitcher.astro component that displays available translations in the article metadata section (alongside Authors, Affiliations, Published, PDF).
Changes
- New:
app/src/components/LanguageSwitcher.astroβ a small, accessible 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β adds community Chinese translation link
How it works
Add a translations array to any article's frontmatter:
translationsLabel: "Available in"
translations:
- lang: en
label: English
url: https://openevals-evaluation-guidebook.hf.space
flag: "πΊπΈ"
current: true
- lang: zh
label: δΈζ
url: https://xilanhua12138.github.io/evaluation-guidebook-cn/
flag: "π¨π³"
The component renders a compact inline language switcher. Articles without a translations key are unaffected.
Community Chinese translation
This PR also links to a community Chinese translation of the Evaluation Guidebook:
- π¨π³ δΈζη: https://xilanhua12138.github.io/evaluation-guidebook-cn/
The translation covers the complete article content and is deployed on GitHub Pages.
Preview
The language switcher appears as:
πΊπΈ English / π¨π³ δΈζ
in the article header metadata section.
Thank you for reviewing this contribution!
The actual code changes are available at my fork: https://huggingface.co/spaces/xilanhua12138/evaluation-guidebook-pr
Files changed:
app/src/components/LanguageSwitcher.astro(new) β reusable language switcher componentapp/src/components/Hero.astro(modified) β adds optionaltranslationspropapp/src/pages/index.astro(modified) β readstranslationsfrom frontmatterapp/src/content/article.mdx(modified) β adds link to Chinese community translation
The LanguageSwitcher renders as:
πΊπΈ English / π¨π³ δΈζ
View the full diff and changes at: https://huggingface.co/spaces/xilanhua12138/evaluation-guidebook-pr/tree/main/app/src