Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ripe-wombats-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Add chinese locale support
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
case "pt_BR": {
return (await import("./br.js")).default;
}
case "zh_CN": {
return (await import("./zh.js")).default;
}

Check warning on line 35 in packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts#L34-L35

Added lines #L34 - L35 were not covered by tests
default: {
return (await import("./en.js")).default;
}
Expand Down
121 changes: 121 additions & 0 deletions packages/thirdweb/src/react/web/ui/ConnectWallet/locale/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import type { ConnectLocale } from "./types.js";

const connectLocaleZh: ConnectLocale = {
agreement: {
and: "和",
prefix: "连接即表示您同意",
privacyPolicy: "隐私政策",
termsOfService: "服务条款",
},
backupWallet: "备份钱包",
buy: "购买",
confirmInWallet: "在钱包中确认",
connectAWallet: "连接钱包",
connectedToSmartWallet: "智能钱包",
connecting: "连接中",
continueAsGuest: "以访客身份继续",
copyAddress: "复制地址",
currentNetwork: "当前网络",
defaultButtonTitle: "连接",
defaultModalTitle: "登录",
disconnectWallet: "断开钱包连接",
getStarted: "开始使用",
goBackButton: "返回",
guest: "访客",
guestWalletWarning:
"这是一个临时访客钱包。如果您不想失去访问权限,请备份钱包",
id: "zh_CN",
installed: "已安装",
manageWallet: {
connectAnApp: "连接应用",
exportPrivateKey: "导出私钥",
linkedProfiles: "已关联配置文件",
linkProfile: "关联配置文件",
title: "管理钱包",
},
networkSelector: {
addCustomNetwork: "添加自定义网络",
allNetworks: "全部",
categoryLabel: {
others: "所有网络",
popular: "热门",
recentlyUsed: "最近使用",
},
failedToSwitch: "网络切换失败",
inputPlaceholder: "搜索网络或链 ID",
loading: "加载中",
mainnets: "主网",
testnets: "测试网",
title: "选择网络",
},
newToWallets: "刚接触钱包?",
or: "或",
passkeys: {
linkPasskey: "添加通行密钥",
title: "通行密钥",
},
payTransactions: "法币交易",
personalWallet: "个人钱包",
receive: "接收",
receiveFundsScreen: {
instruction: "复制地址以向此钱包发送资金",
title: "接收资金",
},
recommended: "推荐",
requestTestnetFunds: "申请测试网资金",
send: "发送",
sendFundsScreen: {
amount: "金额",
insufficientFunds: "余额不足",
invalidAddress: "地址无效",
noTokensFound: "未找到代币",
searchToken: "搜索或粘贴代币地址",
selectTokenTitle: "选择代币",
sending: "发送中",
sendTo: "发送到",
submitButton: "发送",
successMessage: "交易成功",
title: "发送资金",
token: "代币",
transactionFailed: "交易失败",
transactionRejected: "交易被拒绝",
},
signatureScreen: {
instructionScreen: {
disconnectWallet: "断开钱包连接",
instruction: "请在您的钱包中签署消息请求以继续",
signInButton: "登录",
title: "登录",
},
signingScreen: {
approveTransactionInSafe: "在 Safe 中批准交易",
failedToSignIn: "登录失败",
inProgress: "等待确认",
prompt: "在您的钱包中签署签名请求",
promptForSafe: "在您的钱包中签署签名请求并在 Safe 中批准交易",
title: "登录中",
tryAgain: "重试",
},
},
signIn: "登录",
smartWallet: "智能钱包",
switchAccount: "切换账户",
switchingNetwork: "网络切换中",
switchNetwork: "切换网络",
switchTo: "切换到",
transactions: "交易",
viewAllTransactions: "查看所有交易",
viewFunds: {
title: "查看资产",
viewAssets: "查看资产",
viewNFTs: "查看NFT资产",
viewTokens: "查看代币",
},
walletTransactions: "钱包交易",
welcomeScreen: {
defaultSubtitle: "连接钱包以开始使用",
defaultTitle: "您通往去中心化世界的门户",
},
};

export default connectLocaleZh;
3 changes: 2 additions & 1 deletion packages/thirdweb/src/react/web/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export type LocaleId =
| "de_DE"
| "fr_FR"
| "ru_RU"
| "pt_BR";
| "pt_BR"
| "zh_CN";
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
case "pt_BR": {
return (await import("./br.js")).default;
}
case "zh_CN":
return (await import("./zh.js")).default;

Check warning on line 31 in packages/thirdweb/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts#L31

Added line #L31 was not covered by tests
default:
return (await import("./en.js")).default;
}
Expand Down
27 changes: 27 additions & 0 deletions packages/thirdweb/src/react/web/wallets/injected/locale/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { InjectedWalletLocale } from "./types.js";

/**
* @internal
*/
const injectedWalletLocaleZh = (wallet: string): InjectedWalletLocale => ({
connectionScreen: {
failed: "连接失败",
inProgress: "等待确认",
instruction: `请在 ${wallet} 中接受连接请求`,
retry: "重试",
},
download: {
android: "在 Google Play 下载",
chrome: "下载 Chrome 扩展",
iOS: "在 App Store 下载",
},
getStartedLink: `没有 ${wallet}?`,
getStartedScreen: {
instruction: `扫描二维码下载 ${wallet} 应用`,
},
scanScreen: {
instruction: `使用 ${wallet} 应用扫描二维码以连接`,
},
});

export default injectedWalletLocaleZh;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
case "pt_BR": {
return (await import("./br.js")).default;
}
case "zh_CN":
return (await import("./zh.js")).default;

Check warning on line 31 in packages/thirdweb/src/react/web/wallets/shared/locale/getConnectLocale.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/wallets/shared/locale/getConnectLocale.ts#L30-L31

Added lines #L30 - L31 were not covered by tests
default:
return (await import("./en.js")).default;
}
Expand Down
61 changes: 61 additions & 0 deletions packages/thirdweb/src/react/web/wallets/shared/locale/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type { InAppWalletLocale } from "./types.js";

export default {
createPassword: {
confirmation: "我已保存密码",
failedToSetPassword: "设置密码失败",
inputPlaceholder: "输入您的密码",
instruction:
"为您的账户设置密码。从新设备连接时需要此密码。",
saveInstruction: "请务必保存密码",
submitButton: "设置密码",
title: "创建密码",
},
emailLoginScreen: {
enterCodeSendTo: "输入发送至以下地址的验证码",
enterRecoveryCode:
"输入您首次注册时发送至邮箱的恢复码",
failedToSendCode: "发送验证码失败",
invalidCode: "验证码无效",
invalidCodeOrRecoveryCode: "验证码或恢复码无效",
newDeviceDetected: "检测到新设备",
resendCode: "重新发送验证码",
sendingCode: "正在发送验证码",
title: "登录",
verify: "验证",
},
emailPlaceholder: "邮箱地址",
emailRequired: "邮箱地址为必填项",
enterPassword: {
inputPlaceholder: "输入您的密码",
instruction: "输入您账户的密码",
submitButton: "验证",
title: "输入密码",
wrongPassword: "密码错误",
},
invalidEmail: "邮箱地址无效",
invalidPhone: "手机号码无效",
linkWallet: "关联钱包",
loginAsGuest: "以访客身份继续",
maxAccountsExceeded:
"账户数量已达上限。请联系应用开发者。",
or: "或",
passkey: "通行密钥",
phonePlaceholder: "手机号码",
phoneRequired: "手机号码为必填项",
signIn: "登录",
signInWithApple: "Apple",
signInWithDiscord: "Discord",
signInWithEmail: "使用邮箱登录",
signInWithFacebook: "Facebook",
signInWithGoogle: "Google",
signInWithPhone: "使用手机号登录",
signInWithWallet: "使用钱包登录",
socialLoginScreen: {
failed: "登录失败",
instruction: "在弹出窗口中登录您的账户",
retry: "重试",
title: "登录",
},
submitEmail: "继续",
} satisfies InAppWalletLocale;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
case "pt_BR": {
return (await import("./br.js")).default;
}
case "zh_CN":
return (await import("./zh.js")).default;

Check warning on line 31 in packages/thirdweb/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts#L31

Added line #L31 was not covered by tests
default:
return (await import("./en.js")).default;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

connecting: "正在连接智能账户",
failedToConnect: "连接智能账户失败",
wrongNetworkScreen: {
failedToSwitch: "网络切换失败",
subtitle: "您的钱包未连接到所需的网络",
title: "网络错误",
},
};

export default smartWalletLocalZh;
Loading