Skip to content

Conversation

@Yash094
Copy link
Member

@Yash094 Yash094 commented Aug 7, 2025

[SDK] Feature: Add Chinese (Simplified) locale for ConnectButton

Notes for the reviewer

  • Adds zh_CN locale support for the ConnectButton component.

How to test

  1. Set the locale prop on the ConnectButton component to "zh_CN".
    import { ConnectButton } from "thirdweb/react";
    
    <ConnectButton client={client} locale="zh_CN" />;

PR-Codex overview

This PR introduces support for the Chinese locale (zh_CN) across multiple components in the thirdweb packages, enhancing the application's accessibility for Chinese-speaking users.

Detailed summary

  • Added zh_CN entry to the locale list in types.ts.
  • Updated LocaleFormControl to include Chinese as an option.
  • Modified locale retrieval functions to handle zh_CN cases in various files.
  • Created Chinese locale files for SmartWallet, InjectedWallet, and InAppWallet.
  • Defined localized strings for user interface and wallet functionalities in Chinese.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added support for Simplified Chinese (zh_CN) localization across wallet connection interfaces, including ConnectWallet, injected wallets, in-app wallets, and smart wallets with translated UI text, instructions, errors, and network messages.
  • Chores

    • Extended locale options to include Simplified Chinese with dynamic locale loading.

@Yash094 Yash094 requested review from a team as code owners August 7, 2025 07:52
@changeset-bot
Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 4f16cb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Aug 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2025 5:08am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Aug 8, 2025 5:08am
nebula ⬜️ Skipped (Inspect) Aug 8, 2025 5:08am
thirdweb-www ⬜️ Skipped (Inspect) Aug 8, 2025 5:08am
wallet-ui ⬜️ Skipped (Inspect) Aug 8, 2025 5:08am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Support for Simplified Chinese ("zh_CN") localization was added across multiple wallet-related UI modules, including ConnectWallet, injected wallets, in-app wallets, and smart wallets. This involved extending locale type definitions, updating locale retrieval functions to support dynamic imports for "zh_CN", and adding comprehensive Simplified Chinese translation files. A changeset documenting the addition was also included.

Changes

Cohort / File(s) Change Summary
Locale Type Update
packages/thirdweb/src/react/web/ui/types.ts
Added "zh_CN" to the LocaleId type union, enabling recognition of the new locale identifier.
ConnectWallet Locale Retrieval
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts
Added a case for "zh_CN" to asynchronously import and return the Simplified Chinese locale module.
ConnectWallet Simplified Chinese Translations
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/zh.ts
Introduced a new file exporting connectLocaleZh, providing full Simplified Chinese translations for ConnectWallet UI components.
Injected Wallet Locale Retrieval
packages/thirdweb/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts
Added "zh_CN" case to dynamically import the Simplified Chinese locale for injected wallets.
Injected Wallet Simplified Chinese Translations
packages/thirdweb/src/react/web/wallets/injected/locale/zh.ts
Added a new module exporting Chinese translations for injected wallet UI elements and instructions.
In-App Wallet Locale Retrieval
packages/thirdweb/src/react/web/wallets/shared/locale/getConnectLocale.ts
Added "zh_CN" case to dynamically import the Simplified Chinese locale for in-app wallets.
In-App Wallet Simplified Chinese Translations
packages/thirdweb/src/react/web/wallets/shared/locale/zh.ts
Added a new localization file providing Chinese translations for in-app wallet authentication and login UI.
Smart Wallet Locale Retrieval
packages/thirdweb/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts
Added "zh_CN" case to dynamically import the Simplified Chinese locale for smart wallets.
Smart Wallet Simplified Chinese Translations
packages/thirdweb/src/react/web/wallets/smartWallet/locale/zh.ts
Added a new file exporting Chinese translations for smart wallet UI states and error messages.
Locale Option Addition
apps/playground-web/src/app/wallets/sign-in/components/LocaleFormControl.tsx
Added "zh_CN" as a selectable locale option named "Chinese (Simplified)" in the locale selection UI.
Changeset Documentation
.changeset/ripe-wombats-warn.md
Added a changeset documenting the addition of Simplified Chinese locale support across wallet UI components.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Wallet UI Component
    participant LocaleGetter as getLocale function
    participant LocaleModule as zh.ts

    UI->>LocaleGetter: getLocale("zh_CN")
    LocaleGetter->>LocaleModule: import zh.ts
    LocaleModule-->>LocaleGetter: locale object
    LocaleGetter-->>UI: locale object
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f16cb6 and 59f6ac9.

📒 Files selected for processing (1)
  • apps/playground-web/src/app/wallets/sign-in/components/LocaleFormControl.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/playground-web/src/app/wallets/sign-in/components/LocaleFormControl.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/add-chinese-locale-to-connect-button-1320

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 7, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Aug 7, 2025
@Yash094 Yash094 added the DO NOT MERGE This pull request is still in progress and is not ready to be merged. label Aug 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.03 KB (0%) 1.3 s (0%) 75 ms (+96.71% 🔺) 1.4 s
thirdweb (cjs) 357.38 KB (0%) 7.2 s (0%) 131 ms (-4.7% 🔽) 7.3 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 59 ms (+1287.37% 🔺) 173 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 19 ms (+968.85% 🔺) 29 ms
thirdweb/react (minimal + tree-shaking) 19.16 KB (0%) 384 ms (0%) 31 ms (+171.87% 🔺) 414 ms

@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.31%. Comparing base (9ae2991) to head (59f6ac9).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...ct/web/ui/ConnectWallet/locale/getConnectLocale.ts 0.00% 3 Missing ⚠️
...wallets/injected/locale/getInjectedWalletLocale.ts 0.00% 2 Missing ⚠️
...eact/web/wallets/shared/locale/getConnectLocale.ts 0.00% 2 Missing ⚠️
...wallets/smartWallet/locale/getSmartWalletLocale.ts 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7807      +/-   ##
==========================================
- Coverage   56.33%   56.31%   -0.02%     
==========================================
  Files         905      905              
  Lines       58806    58830      +24     
  Branches     4145     4150       +5     
==========================================
+ Hits        33130    33132       +2     
- Misses      25571    25592      +21     
- Partials      105      106       +1     
Flag Coverage Δ
packages 56.31% <0.00%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...wallets/injected/locale/getInjectedWalletLocale.ts 93.10% <0.00%> (-6.90%) ⬇️
...eact/web/wallets/shared/locale/getConnectLocale.ts 0.00% <0.00%> (ø)
...wallets/smartWallet/locale/getSmartWalletLocale.ts 93.10% <0.00%> (-6.90%) ⬇️
...ct/web/ui/ConnectWallet/locale/getConnectLocale.ts 18.75% <0.00%> (-1.25%) ⬇️

... and 6 files with indirect coverage changes

🚀 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.

@@ -0,0 +1,13 @@
import type { SmartWalletLocale } from "./types.js";

const smartWalletLocalZh: SmartWalletLocale = {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a typo in the variable name smartWalletLocalZh. It should be smartWalletLocaleZh to maintain consistency with the naming convention used in other locale files.

Suggested change
const smartWalletLocalZh: SmartWalletLocale = {
const smartWalletLocaleZh: SmartWalletLocale = {

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages Playground Changes involving the Playground codebase. SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants