Refactor: shared locale data module for all locale-aware components
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 40/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, tailwindcss, typescript
- Lĩnh vực
- frontend, internationalization
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.tsexportinggetLocaleLabel(code, mode),getLocaleFlag(code),isRtlLocale(code)and aresolveLocale(locale: Locale)helper that applieslabel/flag/rtloverrides. - Fall back to
Intl.DisplayNamesfor 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 aregistryDependency. - Migrate
LanguageSwitcherandNavBarto 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.
- Ngôn ngữ chính
- TypeScript
- Star
- 39
- Fork
- 16
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của babelize/babelize-elements
-
bug website
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
babelize/babelize-elements#46 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug language-switcher priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
babelize/babelize-elements#26 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
component enhancement help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
babelize/babelize-elements#47 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug component rtl-layout
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
babelize/babelize-elements#45 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Website: revamp and improve the landing pageCó thể đã có người làm @anjalinayak01 đã nhận 4 ngày trước. Đang mởenhancement help wanted priority: medium website
Độ khó 4/5 Hơn một tuần Mức phù hợp với người mới 30/100
babelize/babelize-elements#37 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của babelize/babelize-elements
Issue tương tự
-
Bump anybuf version to ^1.0.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wormhole-foundation/wormhole#5062 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
internal os specific
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
frostney/GocciaScript#1688 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
integration:hermes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vectorize-io/hindsight#5592 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vercel/streamdown#673 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/rocketmq-dashboard#6712 ·
Maintainer thường phản hồi trong vòng 3 ngày