Skip to content

Commit

Permalink
[Issue-973]: Support multi-language for WalletConnect feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Aug 24, 2023
1 parent 9e33ddb commit 21687a6
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const ConnectWalletConnectConfirmation = ({ request }: Props) => {
const { isDeepLinkConnect } = useSelector((state: RootState) => state.settings);
const nameSpaceNameMap = useMemo(
(): Record<string, string> => ({
[WALLET_CONNECT_EIP155_NAMESPACE]: 'EVM networks',
[WALLET_CONNECT_POLKADOT_NAMESPACE]: 'Substrate networks',
[WALLET_CONNECT_EIP155_NAMESPACE]: i18n.common.evmNetworks,
[WALLET_CONNECT_POLKADOT_NAMESPACE]: i18n.common.substrateNetworks,
}),
[],
);
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings/WalletConnect/ConnectionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const ConnectionDetail = ({
setLoading(true);
disconnectWalletConnectConnection(topic)
.catch(() => {
toast.show('Fail to disconnect', { type: 'danger' });
toast.show(i18n.message.failToDisconnect, { type: 'danger' });
})
.finally(() => {
setLoading(false);
Expand Down
6 changes: 3 additions & 3 deletions src/screens/Transaction/SendFundV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ export const SendFund = ({
render={({ field: { value, ref, onChange, onBlur } }) => (
<InputAddress
ref={ref}
label={'Send to'}
label={i18n.inputLabel.sendTo}
value={value}
onChangeText={onChange}
onBlur={onBlur}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export const SendFund = ({
}
});
}}>
Next
{i18n.buttonTitles.next}
</Button>
)}
{viewStep === 2 && (
Expand Down Expand Up @@ -1042,7 +1042,7 @@ export const SendFund = ({
}
}}
style={stylesheet.max}>
{<Typography.Text style={stylesheet.maxText}>Max</Typography.Text>}
{<Typography.Text style={stylesheet.maxText}>{i18n.common.max}</Typography.Text>}
</TouchableOpacity>
)}
</View>
Expand Down
3 changes: 2 additions & 1 deletion src/utils/i18n/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ export const en = {
connectWalletConnectMessage: 'By clicking "Connect", you allow this dapp to view your public address',
connectSuccessfully: 'Connect successfully',
supportedNetworks: 'Supported networks',
networkSupported: (networkNumber: number) => `${networkNumber} networks support`,
networkSupported: (networkNumber: number) => `${networkNumber} networks supported`,
failToDisconnect: 'Fail to disconnect',
},
filterOptions: {
polkadotParachain: 'Polkadot parachain',
Expand Down
39 changes: 20 additions & 19 deletions src/utils/i18n/vi_VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ export const vi = {
provider: 'Provider',
pools: 'Pool',
nominate: 'Nominate',
evmNetworks: 'EVM networks',
substrateNetworks: 'Substrate networks',
networks: 'Networks',
evmNetworks: 'Mạng EVM',
substrateNetworks: 'Mạng Substrate',
networks: 'Mạng',
},
title: {
exportAccount: 'Xuất tài khoản ',
Expand Down Expand Up @@ -381,10 +381,10 @@ export const vi = {
unbond: 'Unstake',
addContact: 'Thêm liên hệ',
enableNetwork: 'Bật mạng',
newConnection: 'New connection',
newConnection: 'Kết nối mới',
disconnect: 'Disconnect',
applyAccounts: (account: number) => `Apply ${account} accounts`,
createOne: 'Create one',
applyAccounts: (account: number) => `Kết nối ${account} tài khoản`,
createOne: 'Tạo tài khoản',
},
inputLabel: {
selectAcc: 'Chọn tài khoản',
Expand Down Expand Up @@ -593,14 +593,15 @@ export const vi = {
cannotGetBalance: 'Không thể lấy số dư',
enableTokenOnChain: (tokenNames: string, chainName: string) => `Vui lòng bật ${tokenNames} trên ${chainName}`,
disconnectModalMessage:
'Once you disconnect, you will no longer see this connection on SubWallet and on your DApp.',
connectedNetworks: (chainLength: number) => `${chainLength} network(s)`,
connectedNetworkConnected: (chainLength: number) => `${chainLength} networks connected`,
connectedAccounts: (accountItemsLength: number) => `${accountItemsLength} account connected`,
connectWalletConnectMessage: 'By clicking "Connect", you allow this dapp to view your public address',
'Khi ngắt kết nối, bạn sẽ không tìm thấy dApp trên SubWallet và dApp không còn kết nối với SubWallet',
connectedNetworks: (chainLength: number) => `${chainLength} mạng`,
connectedNetworkConnected: (chainLength: number) => `Đã kết nối ${chainLength} mạng`,
connectedAccounts: (accountItemsLength: number) => `${accountItemsLength} tài khoản đã kết nối`,
connectWalletConnectMessage: 'Bằng việc nhấp vào "Kết nối", bạn cho phép dapp xem địa chỉ public của tài khoản',
connectSuccessfully: 'Connect successfully',
supportedNetworks: 'Supported networks',
networkSupported: (networkNumber: number) => `${networkNumber} networks support`,
supportedNetworks: 'Các mạng đã hỗ trợ',
networkSupported: (networkNumber: number) => `${networkNumber} mạng đã hỗ trợ`,
failToDisconnect: 'Ngắt kết nối thất bại',
},
filterOptions: {
polkadotParachain: 'Polkadot Parachain',
Expand Down Expand Up @@ -971,8 +972,8 @@ export const vi = {
error: 'Lỗi',
clearHistory: 'Xóa lịch sử',
updateNetwork: 'Cập nhật mạng',
expiredConnectionTitle: 'Connection expired',
unsupportedNetworkTitle: 'Unsupported network',
expiredConnectionTitle: 'Kết nối đã quá hạn.',
unsupportedNetworkTitle: 'Mạng không được hỗ trợ',
},
warningMessage: {
passwordTooShort: 'Mật khẩu quá ngắn',
Expand Down Expand Up @@ -1008,8 +1009,8 @@ export const vi = {
tokenExists: 'Token đã tồn tại',
enableNetworkMessage:
'Mạng bạn đã chọn chưa được kích hoạt. Vui lòng nhấp vào nút này để bật mạng hoặc chọn mạng khác',
expiredConnectionMessage: 'Connection expired. Please create a new connection from dApp',
unsupportedNetworkMessage: 'There is at least 1 chosen network unavailable',
expiredConnectionMessage: 'Kết nối đã quá hạn. Vui lòng kết nối lại với dApp',
unsupportedNetworkMessage: 'Có ít nhất 1 mạng đã chọn không khả dụng',
},
errorMessage: {
invalidPinCode: 'Mã PIN không hợp lệ',
Expand Down Expand Up @@ -1065,8 +1066,8 @@ export const vi = {
contactNameIsRequired: 'Tên liên hệ là bắt buộc',
contactNameMustBeUnique: 'Tên liên hệ phải là duy nhất',
invalidPassword: 'Mật khẩu không hợp lệ',
connectionAlreadyExist: 'Connection already exists',
failToAddConnection: 'Fail to add connection',
connectionAlreadyExist: 'Kết nối đã tồn tại',
failToAddConnection: 'Thêm kết nối thất bại',
unreadableQrCode: 'Unreadable QR code. Please scan another one.',
},
notificationMessage: {
Expand Down
40 changes: 20 additions & 20 deletions src/utils/i18n/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ export const zh = {
provider: '提供商',
pools: '矿池',
nominate: '提名',
evmNetworks: 'EVM networks',
substrateNetworks: 'Substrate networks',
networks: 'Networks',
evmNetworks: 'EVM网络',
substrateNetworks: 'Substrate网络',
networks: '网络',
},
title: {
exportAccount: '导出账户',
Expand Down Expand Up @@ -377,10 +377,10 @@ export const zh = {
unbond: '解除捆定',
addContact: '添加联系人',
enableNetwork: '启用网络',
newConnection: 'New connection',
newConnection: '新连接',
disconnect: 'Disconnect',
applyAccounts: (account: number) => `Apply ${account} accounts`,
createOne: 'Create one',
applyAccounts: (account: number) => `应用${account}账户`,
createOne: '创建',
},
inputLabel: {
selectAcc: '选择账户',
Expand Down Expand Up @@ -586,15 +586,15 @@ export const zh = {
forgotPasswordMessage: '我们不保存你的密码。若你无法解锁账户,你将需要使用助记词以重置你的钱包。',
cannotGetBalance: '无法获取余额',
enableTokenOnChain: (tokenNames: string, chainName: string) => `请在 ${chainName}上启用 ${tokenNames}`,
disconnectModalMessage:
'Once you disconnect, you will no longer see this connection on SubWallet and on your DApp.',
connectedNetworks: (chainLength: number) => `${chainLength} network(s)`,
connectedNetworkConnected: (chainLength: number) => `${chainLength} networks connected`,
connectedAccounts: (accountItemsLength: number) => `${accountItemsLength} account connected`,
connectWalletConnectMessage: 'By clicking "Connect", you allow this dapp to view your public address',
disconnectModalMessage: '一旦断开,你将不再在SubWallet及DApp看到该连接。',
connectedNetworks: (chainLength: number) => `${chainLength}网络`,
connectedNetworkConnected: (chainLength: number) => `已连接${chainLength}网络`,
connectedAccounts: (accountItemsLength: number) => `已连接${accountItemsLength}账户`,
connectWalletConnectMessage: '点击“连接”即表示你允许此dapp查看你的公共地址',
connectSuccessfully: 'Connect successfully',
supportedNetworks: 'Supported networks',
networkSupported: (networkNumber: number) => `${networkNumber} networks support`,
supportedNetworks: '已支持的网络',
networkSupported: (networkNumber: number) => `${networkNumber} 网络支持`,
failToDisconnect: '断开失败',
},
filterOptions: {
polkadotParachain: 'Polkadot平行链',
Expand Down Expand Up @@ -962,8 +962,8 @@ export const zh = {
error: '出错!',
clearHistory: '清档记录',
updateNetwork: '更新网络',
expiredConnectionTitle: 'Connection expired',
unsupportedNetworkTitle: 'Unsupported network',
expiredConnectionTitle: '连接已过期',
unsupportedNetworkTitle: '未支持的网络',
},
warningMessage: {
passwordTooShort: '密码过短',
Expand Down Expand Up @@ -994,8 +994,8 @@ export const zh = {
featureIsNotAvailable: '此功能不适用于所选的账户',
tokenExists: '此通证已存在',
enableNetworkMessage: '你选择的网络尚未启用。 请点击此按钮启用或选择其他网络',
expiredConnectionMessage: 'Connection expired. Please create a new connection from dApp',
unsupportedNetworkMessage: 'There is at least 1 chosen network unavailable',
expiredConnectionMessage: '连接已过期。请从dApp创建新连接',
unsupportedNetworkMessage: '至少有1项已选的网络不可用',
},
errorMessage: {
invalidPinCode: 'PIN码无效',
Expand Down Expand Up @@ -1049,8 +1049,8 @@ export const zh = {
contactNameIsRequired: '联系名字为必填项',
contactNameMustBeUnique: '联系名字必须是唯一的',
invalidPassword: '密码无效',
connectionAlreadyExist: 'Connection already exists',
failToAddConnection: 'Fail to add connection',
connectionAlreadyExist: '连接已存在',
failToAddConnection: '添加连接失败',
unreadableQrCode: 'Unreadable QR code. Please scan another one.',
},
notificationMessage: {
Expand Down

0 comments on commit 21687a6

Please sign in to comment.