Skip to content

i18n: hardcoded English UI strings can't be translated #30

Closed

Description

@sapatmohit

i18n: hardcoded English UI strings can't be translated

For a localization library, the components ship non-translatable English text:

Component Strings
LanguageSwitcher Search..., Search languages, No results, Select language, Current language: …
PhoneInput Select country, Search countries..., Search countries, country names (English only)
NavBar Select language, Current language: …, Toggle menu, GitHub

Proposal

Add an optional labels prop per component with typed keys and English defaults, e.g.:

<LanguageSwitcher
  locales={locales}
  labels={{
    search: "Rechercher…",
    noResults: "Aucun résultat",
    listbox: "Choisir la langue",
    current: (name) => `Langue actuelle : ${name}`,
  }}
/>

For PhoneInput country names, consider Intl.DisplayNames with a displayLocale prop.

Acceptance

  • Exported *Labels types, TSDoc on each key
  • Docs page section showing a translated example
  • Tests asserting custom labels render

Activity

  1. iNerdStack commented on Oct 19, 2026

    @iNerdStack
    Contributor

    @sapatmohit can I be assigned to this?

    I'll follow the approach in the issue: an optional labels prop with English defaults on LanguageSwitcher, PhoneInput, and NavBar, plus tests and a docs example.

  2. sapatmohit commented on Oct 19, 2026

    @sapatmohit
    MemberAuthor

    Works buddy, assigned to you now

  3. sapatmohit commented on Oct 19, 2026

    @sapatmohit
    MemberAuthor

    Heads-up before you go further: the redesign (#67, #69, #70, #71) rewrote LanguageSwitcher, PhoneInput, NavBar and TranslationWidget, so please branch from the latest main — work based on the old files will conflict.

    It also changed the string inventory:

    • LanguageSwitcher and PhoneInput now accept searchPlaceholder and emptyMessage; fold those into labels or keep them as aliases.
    • New hardcoded strings: "Clear search" (switcher, phone input), "Search languages" / "Select language" / "Current language: …" (switcher, navbar), and in TranslationWidget "Swap languages", "Copy translation", "Clear source text", "Translation copied to clipboard" and the character-count text.
    • LocaleNumber and RelativeTime were removed (feat!: remove formatters and rebuild docs preview and demos #72), so they're out of scope.

    Thanks for picking this up.

  4. added a commit that references this issue on Oct 21, 2026
    11a6485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions