Skip to content

refactor: convert ne_NP & sr_Cyrl_RS locales to TypeScript - #724

Merged
zombieJ merged 1 commit into
react-component:masterfrom
yoyo837:refactor/locale-js-to-ts
Oct 8, 2026
Merged

zombieJ merged 1 commit into
react-component:masterfrom
yoyo837:refactor/locale-js-to-ts

Conversation

@yoyo837

@yoyo837 yoyo837 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

🤔 This PR

  • Convert src/locale/ne_NP.js → ne_NP.ts and sr_Cyrl_RS.js → sr_Cyrl_RS.ts — the only two .js files under src/locale (the other 73 locales are all .ts).

💡 Motivation

package.json maps the types of ./locale/* to ./es/locale/*.d.ts, but no declarations are emitted for .js sources. As a result, TypeScript consumers cannot resolve these two entry points at all:

  • @rc-component/pagination/locale/ne_NP
  • @rc-component/pagination/locale/sr_Cyrl_RS

For example, ant-design currently falls back to en_US for its ne_NP locale because the typed import does not resolve (see line 1 of components/locale/ne_NP.ts in ant-design/ant-design).

🔧 Changes

  • Pure .js → .ts conversion: adds PaginationLocale typing and normalizes section comments to match the other locale files. No data changes.

✅ Verification

  • father build now emits es/locale/ne_NP.d.ts and es/locale/sr_Cyrl_RS.d.ts
  • tsc --noEmit, eslint and prettier all pass
  • npm test: 222 tests / 130 snapshots pass

Summary by CodeRabbit

  • 重构
    • 调整尼泊尔语和塞尔维亚语(西里尔字母)分页语言配置的声明方式。
    • 分页文案保持不变,用户看到的内容没有变化。

Copilot AI balanced review requested due to automatic review settings September 30, 2026 10:59
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

@yoyo837 is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c426d89f-fb99-4c9d-bf40-a28b0fe727fc

📥 Commits

Reviewing files that changed from the base of the PR and between 0a607d1 and 79a6c32.

📒 Files selected for processing (2)
  • src/locale/ne_NP.ts
  • src/locale/sr_Cyrl_RS.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

尼泊尔语和塞尔维亚语西里尔文分页语言包现在将词条对象声明为 PaginationLocale 类型的 locale 常量,并默认导出该常量。现有分页文案和值未变。

Changes

分页语言包导出

Layer / File(s) Summary
语言包类型声明与默认导出
src/locale/ne_NP.ts, src/locale/sr_Cyrl_RS.ts
两个语言包均将词条对象声明为 PaginationLocale 类型的 locale 常量,并默认导出该常量。分页文案和值保持不变。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 79a6c

Both locale modules preserve their exported data, and generated declarations target the package’s configured paths. No actionable merge-blocking risk is established.

Architecture Summary

Architecture risk: 🔵 Low · up to 79a6c

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/locale/ne_NP.ts: 分页词条对象改为显式声明为 PaginationLocale 类型;现有词条和值保持不变。
  • observed — Modified behavior in src/locale/ne_NP.ts: 新增默认导出 locale 对象。
  • observed — Modified behavior in src/locale/sr_Cyrl_RS.ts: 新增 PaginationLocale 类型导入,并将分页本地化对象声明为符合该类型的 locale 常量;对象中的文案保持不变。
  • observed — Modified behavior in src/locale/sr_Cyrl_RS.ts: 新增默认导出 locale,替代原先直接默认导出对象的方式。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:将 ne_NP 和 sr_Cyrl_RS 本地化文件转换为 TypeScript。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

兔子捧起语言包,
轻轻添上类型标。
尼泊尔语句仍如旧,
西里尔文也未改。
默认出口已备好,
月下蹦跳把萝卜找。

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The conversions follow existing locale conventions and preserve runtime data.

Review effort: Balanced
Findings: None

What changed in this PR

Converts the remaining JavaScript locales to TypeScript so declarations are emitted for consumers.

Changes:

  • Adds PaginationLocale typing.
  • Preserves locale data while standardizing comments and exports.
File Description
src/​locale/​ne_NP.ts Converts the Nepali locale to TypeScript.
src/​locale/​sr_Cyrl_RS.ts Converts the Serbian Cyrillic locale to TypeScript.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (0a607d1) to head (79a6c32).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #724   +/-   ##
=======================================
  Coverage   99.69%   99.69%           
=======================================
  Files           4        4           
  Lines         332      332           
  Branches      153      153           
=======================================
  Hits          331      331           
  Misses          1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ
zombieJ merged commit 25ac222 into react-component:master Oct 8, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants