Skip to content

Commit 2976051

Browse files
committed
added chinese to home page
1 parent 2139b51 commit 2976051

File tree

4 files changed

+120
-37
lines changed

4 files changed

+120
-37
lines changed

apps/box/src/components/Cards/ConnectedDevicesCard.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { EmptyCard } from './EmptyCard';
2020
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
2121
import { TDevice, EDeviceStatus, mockHub } from '../../api/hub';
2222
import { ActivityIndicator, Alert } from 'react-native';
23+
import { useTranslation } from 'react-i18next';
2324
import { fxblox } from '@functionland/react-native-fula';
2425
import { FlashingCircle } from '../../components';
2526

@@ -44,6 +45,7 @@ export const DeviceCard = ({
4445
data;
4546
const { queueToast } = useToast();
4647
const { colors } = useFxTheme();
48+
const { t } = useTranslation();
4749
return (
4850
<FxCard
4951
{...rest}
@@ -68,11 +70,11 @@ export const DeviceCard = ({
6870
))}
6971
</FxBox>
7072
<FxCard.Row>
71-
<FxCard.Row.Title>Capacity</FxCard.Row.Title>
73+
<FxCard.Row.Title>{t('connectedDevicesCard.capacity')}</FxCard.Row.Title>
7274
<FxCard.Row.Data>{convertByteToCapacityUnit(capacity)}</FxCard.Row.Data>
7375
</FxCard.Row>
7476
<FxCard.Row>
75-
<FxCard.Row.Title>Stored Files</FxCard.Row.Title>
77+
<FxCard.Row.Title>{t('connectedDevicesCard.storedFiles')}</FxCard.Row.Title>
7678
<FxCard.Row.Data>
7779
{convertByteToCapacityUnit(parseInt(folderInfo?.fula, 10)) +
7880
' (' +
@@ -81,25 +83,25 @@ export const DeviceCard = ({
8183
</FxCard.Row.Data>
8284
</FxCard.Row>
8385
<FxCard.Row>
84-
<FxCard.Row.Title>Other Data</FxCard.Row.Title>
86+
<FxCard.Row.Title>{t('connectedDevicesCard.otherData')}</FxCard.Row.Title>
8587
<FxCard.Row.Data>
8688
{convertByteToCapacityUnit(parseInt(folderInfo?.chain, 10))}
8789
</FxCard.Row.Data>
8890
</FxCard.Row>
8991
{used != undefined && (
9092
<FxCard.Row>
91-
<FxCard.Row.Title>Used</FxCard.Row.Title>
93+
<FxCard.Row.Title>{t('connectedDevicesCard.used')}</FxCard.Row.Title>
9294
<FxCard.Row.Data>{convertByteToCapacityUnit(used)}</FxCard.Row.Data>
9395
</FxCard.Row>
9496
)}
9597
{free != undefined && (
9698
<FxCard.Row>
97-
<FxCard.Row.Title>Free</FxCard.Row.Title>
99+
<FxCard.Row.Title>{t('connectedDevicesCard.free')}</FxCard.Row.Title>
98100
<FxCard.Row.Data>{convertByteToCapacityUnit(free)}</FxCard.Row.Data>
99101
</FxCard.Row>
100102
)}
101103
<FxCard.Row>
102-
<FxCard.Row.Title>Status</FxCard.Row.Title>
104+
<FxCard.Row.Title>{t('connectedDevicesCard.status')}</FxCard.Row.Title>
103105
<FxBox flexDirection="row" alignItems="center">
104106
<FxCard.Row.Data
105107
color={
@@ -115,11 +117,11 @@ export const DeviceCard = ({
115117
</FxCard.Row>
116118
{showEject && (
117119
<FxButton disabled={status === EDeviceStatus.BackingUp}>
118-
Eject Device
120+
{t('connectedDevicesCard.ejectDevice')}
119121
</FxButton>
120122
)}
121123
{children}
122-
<FxBottomSheetModal ref={bottomSheetRef} title="Device Actions">
124+
<FxBottomSheetModal ref={bottomSheetRef} title={t('connectedDevicesCard.deviceActions')}>
123125
<FxBox
124126
height={200}
125127
justifyContent="center"
@@ -138,32 +140,30 @@ export const DeviceCard = ({
138140
<FlashingCircle offInterval={0} color="green" />
139141
</FxBox>
140142
<FxText>
141-
Your blox turns purple for 2 minutes and then reboots automatically.
142-
Please do not disturb the format process
143+
{t('connectedDevicesCard.formatWarning')}
143144
</FxText>
144145
<FxButton
145146
onPress={() => {
146147
Alert.alert(
147-
'Format All Blox Partitions!',
148-
`Are you sure want to format all connected external blox partitions?`,
148+
t('connectedDevicesCard.formatAllPartitions'),
149+
t('connectedDevicesCard.formatConfirmation'),
149150
[
150151
{
151-
text: 'Yes',
152+
text: t('connectedDevicesCard.yes'),
152153
onPress: () => {
153154
fxblox.partition().then(() => {
154155
console.log('partition sent');
155156
queueToast({
156157
type: 'success',
157-
title: 'Request Sent',
158-
message:
159-
'The partition request is sent and blox LED turns purple. Please wait 5 minutes as your blox restarts after partitioning',
158+
title: t('connectedDevicesCard.requestSent'),
159+
message: t('connectedDevicesCard.partitionRequestMessage'),
160160
});
161161
});
162162
},
163163
style: 'destructive',
164164
},
165165
{
166-
text: 'No',
166+
text: t('connectedDevicesCard.no'),
167167
style: 'cancel',
168168
},
169169
]
@@ -173,7 +173,7 @@ export const DeviceCard = ({
173173
paddingHorizontal="16"
174174
iconLeft={<FxTrashIcon />}
175175
>
176-
Format
176+
{t('connectedDevicesCard.format')}
177177
</FxButton>
178178
</FxBox>
179179
</FxBottomSheetModal>
@@ -190,11 +190,12 @@ export const ConnectedDevicesCard = ({
190190
showCardHeader = true,
191191
data,
192192
}: TConnectedDevicesCard) => {
193+
const { t } = useTranslation();
193194
return (
194195
<>
195-
{showCardHeader && <CardHeader>Connected Devices</CardHeader>}
196+
{showCardHeader && <CardHeader>{t('connectedDevicesCard.title')}</CardHeader>}
196197
{mockHub.length === 0 ? (
197-
<EmptyCard placeholder="No connected devices" />
198+
<EmptyCard placeholder={t('connectedDevicesCard.noConnectedDevices')} />
198199
) : (
199200
<CardCarousel
200201
data={data}

apps/box/src/components/Cards/EarningCard.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
useToast,
1111
} from '@functionland/component-library';
1212
import { ActivityIndicator, StyleSheet } from 'react-native';
13+
import { useTranslation } from 'react-i18next';
1314
import { useFulaBalance, useFormattedFulaBalance } from '../../hooks/useFulaBalance';
1415
import { useClaimableTokens } from '../../hooks/useClaimableTokens';
1516

@@ -26,6 +27,7 @@ export const EarningCard = ({
2627
}: EarningCardProps) => {
2728
const { colors } = useFxTheme();
2829
const { queueToast } = useToast();
30+
const { t } = useTranslation();
2931

3032
// Use the formatted balance hook to get balance data
3133
const balanceData = useFormattedFulaBalance();
@@ -67,14 +69,14 @@ export const EarningCard = ({
6769
await sdk?.connect();
6870
queueToast({
6971
type: 'success',
70-
title: 'Wallet Connected',
71-
message: 'MetaMask wallet connected successfully',
72+
title: t('earningCard.walletConnected'),
73+
message: t('earningCard.walletConnectedMessage'),
7274
});
7375
} catch (e: any) {
7476
queueToast({
7577
type: 'error',
76-
title: 'Wallet Connection Failed',
77-
message: typeof e === 'object' && 'message' in e ? e.message : 'Failed to connect wallet',
78+
title: t('earningCard.walletConnectionFailed'),
79+
message: typeof e === 'object' && 'message' in e ? e.message : t('earningCard.walletConnectionFailedMessage'),
7880
});
7981
return;
8082
}
@@ -90,24 +92,24 @@ export const EarningCard = ({
9092
await claimTokens();
9193
queueToast({
9294
type: 'success',
93-
title: 'Rewards Claimed',
94-
message: `Successfully claimed ${formattedTotalUnclaimed} tokens`,
95+
title: t('earningCard.rewardsClaimed'),
96+
message: t('earningCard.rewardsClaimedMessage', { amount: formattedTotalUnclaimed }),
9597
});
9698
// Refresh balance after claiming
9799
refreshBalance();
98100
} catch (error: any) {
99101
queueToast({
100102
type: 'error',
101-
title: 'Claim Failed',
102-
message: typeof error === 'object' && 'message' in error ? error.message : 'Failed to claim tokens',
103+
title: t('earningCard.claimFailed'),
104+
message: typeof error === 'object' && 'message' in error ? error.message : t('earningCard.claimFailedMessage'),
103105
});
104106
}
105107
};
106108

107109
return (
108110
<FxCard {...rest}>
109111
<FxBox flexDirection="row" justifyContent="space-between">
110-
<FxCard.Title marginBottom="8">Rewards</FxCard.Title>
112+
<FxCard.Title marginBottom="8">{t('earningCard.title')}</FxCard.Title>
111113
{(loading || balanceLoading) ? (
112114
<ActivityIndicator />
113115
) : (
@@ -119,11 +121,11 @@ export const EarningCard = ({
119121
)}
120122
</FxBox>
121123
<FxCard.Row>
122-
<FxCard.Row.Title>Total {tokenSymbol}</FxCard.Row.Title>
124+
<FxCard.Row.Title>{t('earningCard.totalInWallet', { tokenSymbol })}</FxCard.Row.Title>
123125
<FxCard.Row.Data>
124126
<FxBox style={styles.totalFulaContainer}>
125127
{balanceError ? (
126-
<FxText>Error loading balance</FxText>
128+
<FxText>{t('earningCard.errorLoadingBalance')}</FxText>
127129
) : (
128130
<FxText style={styles.totalFula}>{formattedBalance}</FxText>
129131
)}
@@ -132,11 +134,11 @@ export const EarningCard = ({
132134
</FxCard.Row>
133135

134136
<FxCard.Row>
135-
<FxCard.Row.Title>Claimable Rewards</FxCard.Row.Title>
137+
<FxCard.Row.Title>{t('earningCard.claimableRewards')}</FxCard.Row.Title>
136138
<FxCard.Row.Data>
137139
<FxBox style={styles.totalFulaContainer}>
138140
{claimableError ? (
139-
<FxText>Error loading rewards</FxText>
141+
<FxText>{t('earningCard.errorLoadingRewards')}</FxText>
140142
) : (
141143
<FxText style={styles.totalFula}>
142144
{formattedTotalUnclaimed} {tokenSymbol}
@@ -147,7 +149,7 @@ export const EarningCard = ({
147149
</FxCard.Row>
148150

149151
<FxCard.Row>
150-
<FxCard.Row.Title>Mining Rewards</FxCard.Row.Title>
152+
<FxCard.Row.Title>{t('earningCard.miningRewards')}</FxCard.Row.Title>
151153
<FxCard.Row.Data>
152154
<FxBox style={styles.totalFulaContainer}>
153155
<FxText style={styles.totalFula}>
@@ -158,7 +160,7 @@ export const EarningCard = ({
158160
</FxCard.Row>
159161

160162
<FxCard.Row>
161-
<FxCard.Row.Title>Storage Rewards</FxCard.Row.Title>
163+
<FxCard.Row.Title>{t('earningCard.storageRewards')}</FxCard.Row.Title>
162164
<FxCard.Row.Data>
163165
<FxBox style={styles.totalFulaContainer}>
164166
<FxText style={styles.totalFula}>
@@ -169,7 +171,7 @@ export const EarningCard = ({
169171
</FxCard.Row>
170172

171173
<FxCard.Row>
172-
<FxCard.Row.Title>Last Claimed</FxCard.Row.Title>
174+
<FxCard.Row.Title>{t('earningCard.lastClaimed')}</FxCard.Row.Title>
173175
<FxCard.Row.Data>
174176
<FxBox style={styles.totalFulaContainer}>
175177
<FxText style={styles.totalFula}>
@@ -185,7 +187,7 @@ export const EarningCard = ({
185187
onPress={handleClaimTokens}
186188
disabled={claimableLoading || !canClaim}
187189
>
188-
{claimableLoading ? 'Claiming...' : 'Claim Rewards'}
190+
{claimableLoading ? t('earningCard.claiming') : t('earningCard.claimRewards')}
189191
</FxButton>
190192
</FxBox>
191193
)}

apps/box/src/i18n/locales/en/translation.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,46 @@
142142
"connectingWith": "Connecting with {{ssid}}...",
143143
"allDone": "All done\nYour device is connected with success!"
144144
},
145+
"earningCard": {
146+
"title": "Rewards",
147+
"totalInWallet": "Total {{tokenSymbol}} in Wallet",
148+
"claimableRewards": "Claimable Rewards",
149+
"miningRewards": "Mining Rewards",
150+
"storageRewards": "Storage Rewards",
151+
"lastClaimed": "Last Claimed",
152+
"claimRewards": "Claim Rewards",
153+
"claiming": "Claiming...",
154+
"errorLoadingBalance": "Error loading balance",
155+
"errorLoadingRewards": "Error loading rewards",
156+
"walletConnected": "Wallet Connected",
157+
"walletConnectedMessage": "MetaMask wallet connected successfully",
158+
"walletConnectionFailed": "Wallet Connection Failed",
159+
"walletConnectionFailedMessage": "Failed to connect wallet",
160+
"rewardsClaimed": "Rewards Claimed",
161+
"rewardsClaimedMessage": "Successfully claimed {{amount}} tokens",
162+
"claimFailed": "Claim Failed",
163+
"claimFailedMessage": "Failed to claim tokens"
164+
},
165+
"connectedDevicesCard": {
166+
"title": "Connected Devices",
167+
"capacity": "Capacity",
168+
"storedFiles": "Stored Files",
169+
"otherData": "Other Data",
170+
"used": "Used",
171+
"free": "Free",
172+
"status": "Status",
173+
"ejectDevice": "Eject Device",
174+
"noConnectedDevices": "No connected devices",
175+
"deviceActions": "Device Actions",
176+
"formatWarning": "Your blox turns purple for 2 minutes and then reboots automatically. Please do not disturb the format process",
177+
"format": "Format",
178+
"formatAllPartitions": "Format All Blox Partitions!",
179+
"formatConfirmation": "Are you sure want to format all connected external blox partitions?",
180+
"yes": "Yes",
181+
"no": "No",
182+
"requestSent": "Request Sent",
183+
"partitionRequestMessage": "The partition request is sent and blox LED turns purple. Please wait 5 minutes as your blox restarts after partitioning"
184+
},
145185
"pools": {
146186
"contractNotReady": "Contract Not Ready",
147187
"connectWalletMessage": "Please connect your wallet and wait for contract initialization",

apps/box/src/i18n/locales/zh/translation.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,46 @@
142142
"connectingWith": "正在连接 {{ssid}}...",
143143
"allDone": "全部完成\n您的设备已成功连接!"
144144
},
145+
"earningCard": {
146+
"title": "奖励",
147+
"totalInWallet": "钱包中总计 {{tokenSymbol}}",
148+
"claimableRewards": "可领取奖励",
149+
"miningRewards": "挖矿奖励",
150+
"storageRewards": "存储奖励",
151+
"lastClaimed": "上次领取",
152+
"claimRewards": "领取奖励",
153+
"claiming": "正在领取...",
154+
"errorLoadingBalance": "加载余额时出错",
155+
"errorLoadingRewards": "加载奖励时出错",
156+
"walletConnected": "钱包已连接",
157+
"walletConnectedMessage": "MetaMask 钱包连接成功",
158+
"walletConnectionFailed": "钱包连接失败",
159+
"walletConnectionFailedMessage": "连接钱包失败",
160+
"rewardsClaimed": "奖励已领取",
161+
"rewardsClaimedMessage": "成功领取 {{amount}} 代币",
162+
"claimFailed": "领取失败",
163+
"claimFailedMessage": "领取代币失败"
164+
},
165+
"connectedDevicesCard": {
166+
"title": "已连接设备",
167+
"capacity": "容量",
168+
"storedFiles": "存储文件",
169+
"otherData": "其他数据",
170+
"used": "已使用",
171+
"free": "可用",
172+
"status": "状态",
173+
"ejectDevice": "弹出设备",
174+
"noConnectedDevices": "无已连接设备",
175+
"deviceActions": "设备操作",
176+
"formatWarning": "您的 blox 会变为紫色 2 分钟,然后自动重启。请不要打扰格式化过程",
177+
"format": "格式化",
178+
"formatAllPartitions": "格式化所有 Blox 分区!",
179+
"formatConfirmation": "您确定要格式化所有连接的外部 blox 分区吗?",
180+
"yes": "",
181+
"no": "",
182+
"requestSent": "请求已发送",
183+
"partitionRequestMessage": "分区请求已发送,blox LED 变为紫色。请等待 5 分钟,因为您的 blox 在分区后会重启"
184+
},
145185
"pools": {
146186
"contractNotReady": "合约未就绪",
147187
"connectWalletMessage": "请连接您的钱包并等待合约初始化",

0 commit comments

Comments
 (0)