Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Refactor: shared locale data module for all locale-aware components

Ouverte
#23 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
40/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
react, tailwindcss, typescript

Piste de recherche

Start by comparing the locale tables in src/registry/components/language-switcher.tsx and src/registry/components/navbar.tsx to see where their coverage and lookup rules differ. Then check src/registry/registry.ts to see how a new registry entry is declared. The work is done when the new src/registry/components/locale-data.ts exports the helpers, both components use it instead of their own tables, and the locale-data unit tests and existing component tests pass.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

enhancement infrastructure priority: medium

Refactor: shared locale data module

LanguageSwitcher and NavBar each carry their own copy of locale display data:

  • language-switcher.tsx — LANG_TO_FLAG, LANG_NAMES, RTL_LOCALES (~90 languages)
  • navbar.tsx — LOCALE_MAP (~35 languages, label + flag only, no RTL)

The two have drifted (different coverage, different lookup rules), and every new locale-aware component (pill switcher, locale picker, RTL wrapper) will need the same data.

Proposal
  • Add src/registry/components/locale-data.ts exporting getLocaleLabel(code, mode), getLocaleFlag(code), isRtlLocale(code) and a resolveLocale(locale: Locale) helper that applies label / flag / rtl overrides.
  • Fall back to Intl.DisplayNames for languages not in the built-in table instead of returning the raw code.
  • Register it in src/registry/registry.ts (e.g. locale-data) so shadcn installs pull it in as a registryDependency.
  • Migrate LanguageSwitcher and NavBar to it; delete the duplicate tables.
Acceptance
  • No locale table left inside individual components
  • Unit tests for locale-data.ts (overrides, region subtags, unknown codes, RTL)
  • Existing component tests still pass

See ARCHITECTURE.md.

Langage dominant
TypeScript
Étoiles
39
Forks
16
Merge moyen
2 j 12 h
PR mergées (30 j)
10

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de babelize/babelize-elements

Toutes les issues de babelize/babelize-elements

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.