Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#23 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
40/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, tailwindcss, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
39
Forks
16
Merge medio
2 d 12 h
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de babelize/babelize-elements

Todos los issues de babelize/babelize-elements

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.