#7796·recharts

Translate chart example names for the zh-CN locale

Author: CupOfBreadCreated Sep 11, 2026Updated Sep 11, 2026

Is your feature request related to a problem? Please describe. The website supports a zh-CN locale (locale switcher, translated nav and guides), but chart example names are hardcoded English strings (name fields in www/src/docs/exampleComponents/*/index.ts(x)). Both the examples sidebar navigation and the example page title render these strings directly, bypassing the locale system, so the /zh-CN/ site still shows English names like "Simple Line Chart" while everything else is in Chinese.

Describe the solution you'd like Add Chinese translations for all chart example names to the examples group in www/src/locale/zh-CN.ts, keyed by their registry keys. Make the examples sidebar (www/src/navigation.ts) and the example page title (www/src/views/ExamplesView.tsx) look up localeGet(locale, 'examples', key) first and fall back to the hardcoded name when no translation exists — the same pattern already used for guide and API navigation items. This keeps en-US.ts untouched and lets untranslated examples fall back to English automatically.

Describe alternatives you've considered

  • Hardcoding Chinese names directly into the example registries: rejected because it would change the English site and violate the project rule against hardcoding localized strings.
  • Translating inside en-US.ts: rejected because English is the fallback source of truth; duplicating names there would create two sources of truth.

Additional context I have a working change ready (124 example name entries + two render-path lookups) and will submit a PR referencing this issue. Scope is the website only; the library is unaffected.