Refactor: shared locale data module for all locale-aware components
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 39
- 派生
- 16
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
babelize/babelize-elements 的其他 Issue
-
bug website
难度 2/5 1-3 小时 新手友好度 78/100
babelize/babelize-elements#46 ·
维护者通常 1 天内回复
-
bug language-switcher priority: medium
难度 2/5 1-3 小时 新手友好度 72/100
babelize/babelize-elements#26 ·
维护者通常 1 天内回复
-
component enhancement help wanted
难度 5/5 一周以上 新手友好度 35/100
babelize/babelize-elements#47 ·
维护者通常 1 天内回复
-
bug component rtl-layout
难度 3/5 1-2 天 新手友好度 68/100
babelize/babelize-elements#45 ·
维护者通常 1 天内回复
-
Website: revamp and improve the landing page可能已有人在做 @anjalinayak01 于 4 天前认领。 未关闭enhancement help wanted priority: medium website
难度 4/5 一周以上 新手友好度 30/100
babelize/babelize-elements#37 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 babelize/babelize-elements 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
apollographql/apollo-client#13493 ·
维护者通常 1 天内回复
-
Custom hosts written as trailing-dot FQDNs (`host.local.`) aren't detected as local backends可能已有人在做 @roboomp 今天认领。 未关闭bug prio:p2 providers triaged
难度 2/5 1-3 小时 新手友好度 82/100
can1357/oh-my-pi#15798 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
code-yeongyu/oh-my-openagent#10172 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
PDFCraftTool/pdfcraft#189 ·
-
Add the Yahoo chart API duplicate last-day row (yfinance#573) to incidents.md (about 1 hour)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭data docs good first issue
难度 1/5 1 小时以内 新手友好度 80/100
pacocartones/market-data-sanity-checker#160 ·
维护者通常 1 天内回复