Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#23 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
40/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, tailwindcss, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
39
フォーク
16
平均マージ
2日 12時間
マージ済み PR(30日)
10

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

babelize/babelize-elements のほかの issue

babelize/babelize-elements の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。