best-unit 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,12 +8,14 @@ export declare function initFundUnit(params: {
8
8
  biz_type: string;
9
9
  user_id: string;
10
10
  theme?: string;
11
+ locale?: "zh" | "en";
11
12
  }): {
12
13
  token: string;
13
14
  merchantId: string;
14
15
  bizType: string;
15
16
  theme?: string;
16
17
  userId: string;
18
+ locale: "zh" | "en";
17
19
  };
18
20
 
19
21
  // Vite 代理配置类型
@@ -26,12 +28,6 @@ export declare const viteProxy: {
26
28
  };
27
29
  };
28
30
 
29
- // Next.js 代理配置类型
30
- export declare const nextProxy: {
31
- source: string;
32
- destination: string;
33
- };
34
-
35
31
  declare global {
36
32
  interface Window {
37
33
  bestUnit: {
@@ -39,6 +35,7 @@ declare global {
39
35
  token: string;
40
36
  merchant_id: string;
41
37
  biz_type: string;
38
+ locale?: "zh" | "en";
42
39
  }) => void;
43
40
  };
44
41
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "0.0.32",
4
+ "version": "0.0.34",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
package/src/api/proxy.ts CHANGED
@@ -7,10 +7,5 @@ const viteProxy = {
7
7
  secure: false,
8
8
  },
9
9
  };
10
- // next.js 配置用的代理对象
11
- const nextProxy = {
12
- source: "/api/:path*",
13
- destination: "https://fund.bestfulfill.tech/api/sdk/:path*",
14
- };
15
10
 
16
- export { viteProxy, nextProxy };
11
+ export { viteProxy };
@@ -2,6 +2,7 @@ import type { FunctionalComponent } from "preact";
2
2
  import { Upload } from "../../../common/Upload";
3
3
  import { createOfflineRecharge } from "../../../../api";
4
4
  import { message } from "../../../common/Message";
5
+ import { t } from "../../../../local";
5
6
 
6
7
  interface OfflineTransferFormProps {
7
8
  formState: {
@@ -243,21 +244,21 @@ export const OfflineTransferForm: FunctionalComponent<
243
244
  if (!formState.platform) {
244
245
  setFormState((state: any) => ({
245
246
  ...state,
246
- platformError: "请选择支付平台",
247
+ platformError: t("请选择支付平台"),
247
248
  }));
248
249
  valid = false;
249
250
  }
250
251
  if (!formState.transactionId.trim()) {
251
252
  setFormState((state: any) => ({
252
253
  ...state,
253
- transactionIdError: "请输入转账交易ID",
254
+ transactionIdError: t("请输入转账交易ID"),
254
255
  }));
255
256
  valid = false;
256
257
  }
257
258
  if (!formState.files || formState.files.length === 0) {
258
259
  setFormState((state: any) => ({
259
260
  ...state,
260
- filesError: "请上传转账凭证",
261
+ filesError: t("请上传转账凭证"),
261
262
  }));
262
263
  valid = false;
263
264
  }
@@ -268,14 +269,14 @@ export const OfflineTransferForm: FunctionalComponent<
268
269
  voucherUrls: formState.files,
269
270
  });
270
271
  onClose();
271
- message.success("离线充值创建成功");
272
+ message.success(t("离线充值创建成功"));
272
273
  };
273
274
 
274
275
  return (
275
276
  <form onSubmit={handleSubmit}>
276
277
  <div style={{ marginBottom: 18 }}>
277
278
  <div style={theme.label}>
278
- <span style={{ color: "#F53F3F" }}>*</span> 第三方支付平台
279
+ <span style={{ color: "#F53F3F" }}>*</span> {t("第三方支付平台")}
279
280
  </div>
280
281
  <select
281
282
  style={{
@@ -293,7 +294,7 @@ export const OfflineTransferForm: FunctionalComponent<
293
294
  }}
294
295
  >
295
296
  <option value="" disabled hidden>
296
- 请选择支付平台
297
+ {t("请选择支付平台")}
297
298
  </option>
298
299
  {channelDict?.map((item: any) => (
299
300
  <option value={item.value}>{item.label}</option>
@@ -305,11 +306,11 @@ export const OfflineTransferForm: FunctionalComponent<
305
306
  </div>
306
307
  <div style={{ marginBottom: 18 }}>
307
308
  <div style={theme.label}>
308
- <span style={{ color: "#F53F3F" }}>*</span> 交易ID
309
+ <span style={{ color: "#F53F3F" }}>*</span> {t("交易ID")}
309
310
  </div>
310
311
  <input
311
312
  type="text"
312
- placeholder="请输入转账交易ID"
313
+ placeholder={t("请输入转账交易ID")}
313
314
  value={formState.transactionId}
314
315
  onInput={(e) => {
315
316
  const value = (e.target as HTMLInputElement).value;
@@ -330,7 +331,7 @@ export const OfflineTransferForm: FunctionalComponent<
330
331
  </div>
331
332
  <div style={{ marginBottom: 24 }}>
332
333
  <div style={theme.label}>
333
- <span style={{ color: "#F53F3F" }}>*</span> 上传文件
334
+ <span style={{ color: "#F53F3F" }}>*</span> {t("上传文件")}
334
335
  </div>
335
336
  <Upload
336
337
  value={formState.files}
@@ -352,10 +353,10 @@ export const OfflineTransferForm: FunctionalComponent<
352
353
  {/* 按钮区 */}
353
354
  <div style={{ display: "flex", justifyContent: "flex-end", gap: 12 }}>
354
355
  <button type="button" onClick={onClose} style={theme.buttonCancel}>
355
- 取消
356
+ {t("取消")}
356
357
  </button>
357
358
  <button type="submit" disabled={loading} style={theme.buttonSubmit}>
358
- 去支付
359
+ {t("去支付")}
359
360
  </button>
360
361
  </div>
361
362
  </form>
@@ -1,4 +1,5 @@
1
1
  import type { FunctionalComponent } from "preact";
2
+ import { t } from "../../../../local";
2
3
 
3
4
  interface OnlineRechargeFormProps {
4
5
  formState: {
@@ -226,7 +227,7 @@ export const OnlineRechargeForm: FunctionalComponent<
226
227
  <>
227
228
  <div style={{ marginBottom: 18 }}>
228
229
  <div style={theme.label}>
229
- <span style={{ color: "#F53F3F" }}>*</span> 充值币种
230
+ <span style={{ color: "#F53F3F" }}>*</span> {t("充值币种")}
230
231
  </div>
231
232
  <select
232
233
  style={{
@@ -243,7 +244,7 @@ export const OnlineRechargeForm: FunctionalComponent<
243
244
  }}
244
245
  >
245
246
  <option value="" disabled hidden>
246
- 请选择充值币种
247
+ {t("请选择充值币种")}
247
248
  </option>
248
249
  {currencyDict?.map((item: any) => (
249
250
  <option value={item.value}>{item.label}</option>
@@ -252,11 +253,11 @@ export const OnlineRechargeForm: FunctionalComponent<
252
253
  </div>
253
254
  <div style={{ marginBottom: 18 }}>
254
255
  <div style={theme.label}>
255
- <span style={{ color: "#F53F3F" }}>*</span> 充值金额
256
+ <span style={{ color: "#F53F3F" }}>*</span> {t("充值金额")}
256
257
  </div>
257
258
  <input
258
259
  type="text"
259
- placeholder="请输入充值金额"
260
+ placeholder={t("请输入充值金额")}
260
261
  value={formState.amount}
261
262
  onInput={(e) => {
262
263
  const value = (e.target as HTMLInputElement).value;
@@ -277,7 +278,7 @@ export const OnlineRechargeForm: FunctionalComponent<
277
278
  </div>
278
279
  <div style={{ marginBottom: 24 }}>
279
280
  <div style={theme.label}>
280
- <span style={{ color: "#F53F3F" }}>*</span> 支付平台
281
+ <span style={{ color: "#F53F3F" }}>*</span> {t("支付平台")}
281
282
  </div>
282
283
  <select
283
284
  style={{
@@ -295,7 +296,7 @@ export const OnlineRechargeForm: FunctionalComponent<
295
296
  }}
296
297
  >
297
298
  <option value="" disabled hidden>
298
- 请选择支付平台
299
+ {t("请选择支付平台")}
299
300
  </option>
300
301
  {channelDict?.map((item: any) => (
301
302
  <option value={item.value}>{item.label}</option>
@@ -312,10 +313,10 @@ export const OnlineRechargeForm: FunctionalComponent<
312
313
  )}
313
314
  <div style={{ display: "flex", justifyContent: "flex-end", gap: 12 }}>
314
315
  <button type="button" onClick={onClose} style={buttonCancelStyle}>
315
- 取消
316
+ {t("取消")}
316
317
  </button>
317
318
  <button type="submit" disabled={loading} style={buttonSubmitStyle}>
318
- {loading ? "提交中..." : "去支付"}
319
+ {loading ? t("提交中...") : t("去支付")}
319
320
  </button>
320
321
  </div>
321
322
  </>
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect } from "preact/hooks";
2
2
  import { OnlineRechargeForm } from "./OnlineRechargeForm";
3
3
  import { OfflineTransferForm } from "./OfflineTransferForm";
4
+ import { t } from "../../../../local";
4
5
 
5
6
  interface ModalFormProps {
6
7
  visible: boolean;
@@ -81,13 +82,13 @@ export function Recharge({
81
82
  rechargeChannelError: "",
82
83
  }));
83
84
  if (!formState.amount.trim()) {
84
- setFormState((state) => ({ ...state, amountError: "请输入充值金额" }));
85
+ setFormState((state) => ({ ...state, amountError: t("请输入充值金额") }));
85
86
  valid = false;
86
87
  }
87
88
  if (!formState.rechargeChannel) {
88
89
  setFormState((state) => ({
89
90
  ...state,
90
- rechargeChannelError: "请选择支付平台",
91
+ rechargeChannelError: t("请选择支付平台"),
91
92
  }));
92
93
  valid = false;
93
94
  }
@@ -101,7 +102,7 @@ export function Recharge({
101
102
  });
102
103
  onClose();
103
104
  } catch {
104
- setFormState((state) => ({ ...state, error: "提交失败,请重试" }));
105
+ setFormState((state) => ({ ...state, error: t("提交失败,请重试") }));
105
106
  } finally {
106
107
  setFormState((state) => ({ ...state, loading: false }));
107
108
  }
@@ -231,11 +232,11 @@ export function Recharge({
231
232
  type="button"
232
233
  onClick={onClose}
233
234
  style={theme.closeBtn}
234
- aria-label="关闭"
235
+ aria-label={t("关闭")}
235
236
  >
236
237
  ×
237
238
  </button>
238
- <div style={theme.title}>充值 / 转账</div>
239
+ <div style={theme.title}>{t("充值 / 转账")}</div>
239
240
  {/* tab 按钮区域 */}
240
241
  <div style={{ display: "flex", marginBottom: 28 }}>
241
242
  <button
@@ -243,14 +244,14 @@ export function Recharge({
243
244
  onClick={() => setActiveTab("online")}
244
245
  style={theme.tabBtn(activeTab === "online", true)}
245
246
  >
246
- 在线充值
247
+ {t("在线充值")}
247
248
  </button>
248
249
  <button
249
250
  type="button"
250
251
  onClick={() => setActiveTab("offline")}
251
252
  style={theme.tabBtn(activeTab === "offline", false)}
252
253
  >
253
- 线下转账
254
+ {t("线下转账")}
254
255
  </button>
255
256
  </div>
256
257
  {/* tab 内容区域 */}
@@ -2,13 +2,14 @@ import { useState } from "preact/hooks";
2
2
  import { ThemedButton } from "./components/Button";
3
3
  import { Recharge } from "./components/Recharge";
4
4
  import register from "preact-custom-element";
5
- import { createOnlineRecharge, getAllDicts } from "../../../api";
6
- getAllDicts();
5
+ import { createOnlineRecharge } from "../../../api";
6
+ import { t } from "../../../local";
7
7
 
8
8
  export function BestUnit(props: any) {
9
9
  const [visible, setVisible] = useState(false);
10
10
  const [whiteTheme, setWhiteTheme] = useState(true);
11
11
  const color = props.theme?.primaryColor;
12
+
12
13
  const handleSubmit = async (form: {
13
14
  amount: string;
14
15
  rechargeChannel: string;
@@ -25,7 +26,7 @@ export function BestUnit(props: any) {
25
26
  return (
26
27
  <div>
27
28
  <ThemedButton color={color} onClick={() => setVisible(true)}>
28
- 打开表单
29
+ {t("充值/转账")}
29
30
  </ThemedButton>
30
31
  <button
31
32
  style={{
@@ -37,7 +38,7 @@ export function BestUnit(props: any) {
37
38
  }}
38
39
  onClick={() => setWhiteTheme((v) => !v)}
39
40
  >
40
- {whiteTheme ? "切换为暗黑主题" : "切换为白色主题"}
41
+ {whiteTheme ? t("切换为暗黑主题") : t("切换为白色主题")}
41
42
  </button>
42
43
  <Recharge
43
44
  visible={visible}
@@ -1,20 +1,9 @@
1
1
  import { useState, useEffect } from "preact/hooks";
2
2
  import HoverPopover, { type PopoverPosition } from "../../common/HoverPopover";
3
3
  import { getBalance } from "../../../api";
4
+ import { t } from "../../../local";
4
5
  import register from "preact-custom-element";
5
6
 
6
- // 默认数据,用于加载时显示
7
- const defaultBalanceData = {
8
- available: 0,
9
- currency: "USD",
10
- symbol: "$",
11
- details: [
12
- { label: "真实金额", value: 0, color: "#15b36b", dot: "#15b36b" },
13
- { label: "冻结金额", value: 0, color: "#f59e0b", dot: "#f59e0b" },
14
- { label: "总可用", value: 0, color: "#155EEF", dot: "#15b36b" },
15
- ],
16
- };
17
-
18
7
  function formatNumber(num: number) {
19
8
  return num.toLocaleString("en-US", {
20
9
  minimumFractionDigits: 2,
@@ -23,7 +12,16 @@ function formatNumber(num: number) {
23
12
  }
24
13
 
25
14
  function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
26
- const [balanceData, setBalanceData] = useState(defaultBalanceData);
15
+ const [balanceData, setBalanceData] = useState({
16
+ available: 0,
17
+ currency: "USD",
18
+ symbol: "$",
19
+ details: [
20
+ { label: "", value: 0, color: "#15b36b", dot: "#15b36b" },
21
+ { label: "", value: 0, color: "#f59e0b", dot: "#f59e0b" },
22
+ { label: "", value: 0, color: "#155EEF", dot: "#15b36b" },
23
+ ],
24
+ });
27
25
 
28
26
  useEffect(() => {
29
27
  const fetchBalance = async () => {
@@ -37,19 +35,19 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
37
35
  symbol: "$",
38
36
  details: [
39
37
  {
40
- label: "真实金额",
38
+ label: t("真实金额"),
41
39
  value: balance.totalAmount,
42
40
  color: "#15b36b",
43
41
  dot: "#15b36b",
44
42
  },
45
43
  {
46
- label: "冻结金额",
44
+ label: t("冻结金额"),
47
45
  value: balance.frozenAmount,
48
46
  color: "#f59e0b",
49
47
  dot: "#f59e0b",
50
48
  },
51
49
  {
52
- label: "总可用",
50
+ label: t("总可用"),
53
51
  value: balance.availableAmount,
54
52
  color: "#155EEF",
55
53
  dot: "#15b36b",
@@ -80,7 +78,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
80
78
  textAlign: "center",
81
79
  }}
82
80
  >
83
- 余额详情
81
+ {t("余额详情")}
84
82
  </div>
85
83
  {balanceData.details.map((item) => (
86
84
  <div
@@ -56,7 +56,7 @@ const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
56
56
  // 弹层定位样式
57
57
  let popoverStyle: any = {
58
58
  position: "absolute",
59
- zIndex: 10,
59
+ zIndex: 999,
60
60
  background: "#fff",
61
61
  color: "#222",
62
62
  borderRadius: 6,
@@ -1,6 +1,7 @@
1
1
  import type { FunctionalComponent } from "preact";
2
2
  import { useRef, useState } from "preact/hooks";
3
3
  import { uploadFile } from "../../api";
4
+ import { t } from "../../local";
4
5
 
5
6
  interface UploadProps {
6
7
  value?: string[];
@@ -78,11 +79,11 @@ export const Upload: FunctionalComponent<UploadProps> = ({
78
79
  >
79
80
  <div style={{ fontSize: 48, marginBottom: 12 }}>📁</div>
80
81
  <div style={{ color: "#222", fontSize: 15, marginBottom: 4 }}>
81
- 点击或拖拽文件到此处上传
82
+ {t("点击或拖拽文件到此处上传")}
82
83
  </div>
83
84
  <div style={{ color: "#999", fontSize: 13 }}>
84
- 支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传 {maxCount}{" "}
85
- 个文件
85
+ {t("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")}{" "}
86
+ {maxCount} {t("个文件")}
86
87
  </div>
87
88
  <input
88
89
  ref={fileInputRef}
@@ -95,7 +96,7 @@ export const Upload: FunctionalComponent<UploadProps> = ({
95
96
  />
96
97
  {uploading && (
97
98
  <div style={{ marginTop: 12, color: "#1677ff" }}>
98
- 正在上传... {progress}%
99
+ {t("正在上传...")} {progress}%
99
100
  </div>
100
101
  )}
101
102
  </div>
@@ -121,7 +122,7 @@ export const Upload: FunctionalComponent<UploadProps> = ({
121
122
  {url.split("/").pop()}
122
123
  </span>
123
124
  <span style={{ color: "#8C8F93", fontSize: 13, marginLeft: 8 }}>
124
- [已上传]
125
+ [{t("已上传")}]
125
126
  </span>
126
127
  </div>
127
128
  <button
@@ -142,7 +143,7 @@ export const Upload: FunctionalComponent<UploadProps> = ({
142
143
  }}
143
144
  disabled={disabled}
144
145
  >
145
- 移除
146
+ {t("移除")}
146
147
  </button>
147
148
  </div>
148
149
  ))}
package/src/demo/App.tsx CHANGED
@@ -1,21 +1,86 @@
1
+ import { useState } from "preact/hooks";
1
2
  import { npmTest, printCurrentTime } from "../main";
2
3
  import { BestUnit } from "../components/business/recharge-sdk";
3
4
  import { initFundUnit } from "../main";
4
5
  import StatisticalBalance from "../components/business/statistical-balance";
6
+ import { t } from "../local";
5
7
 
6
8
  export default function DemoApp() {
7
- initFundUnit({
8
- token:
9
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTM0MTM1MjksIm1lcmNoYW50X2lkIjoxMTI4LCJ0aW1lc3RhbXAiOjE3NTMxNTQzMjl9.UAvzq0P4HCnbJR1Ga3CgF6q3vk2RHiZRvnAFohBTHpw",
10
- merchant_id: "1128",
11
- biz_type: "ad",
12
- user_id: "123",
13
- });
9
+ const [currentLocale, setCurrentLocale] = useState<"zh" | "en">("zh");
10
+
11
+ const initApp = (locale: "zh" | "en") => {
12
+ initFundUnit({
13
+ token:
14
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTM0MTM1MjksIm1lcmNoYW50X2lkIjoxMTI4LCJ0aW1lc3RhbXAiOjE3NTMxNTQzMjl9.UAvzq0P4HCnbJR1Ga3CgF6q3vk2RHiZRvnAFohBTHpw",
15
+ merchant_id: "1128",
16
+ biz_type: "ad",
17
+ user_id: "123",
18
+ locale: locale,
19
+ });
20
+ };
21
+
22
+ // 初始化应用
23
+ initApp(currentLocale);
24
+
25
+ const handleLocaleChange = (locale: "zh" | "en") => {
26
+ setCurrentLocale(locale);
27
+ // 重新初始化以更新语言设置
28
+ initApp(locale);
29
+ };
14
30
 
15
31
  return (
16
32
  <div>
17
33
  <h2>组件库可视化测试</h2>
18
34
 
35
+ {/* 国际化切换区域 */}
36
+ <div
37
+ style={{
38
+ marginBottom: 20,
39
+ padding: 16,
40
+ border: "1px solid #e5e7eb",
41
+ borderRadius: 8,
42
+ backgroundColor: "#f9fafb",
43
+ }}
44
+ >
45
+ <h3 style={{ marginTop: 0, marginBottom: 12 }}>国际化测试:</h3>
46
+ <div style={{ display: "flex", gap: 12, alignItems: "center" }}>
47
+ <span>当前语言:</span>
48
+ <button
49
+ onClick={() => handleLocaleChange("zh")}
50
+ style={{
51
+ padding: "8px 16px",
52
+ backgroundColor: currentLocale === "zh" ? "#155EEF" : "#fff",
53
+ color: currentLocale === "zh" ? "#fff" : "#333",
54
+ border: "1px solid #155EEF",
55
+ borderRadius: 6,
56
+ cursor: "pointer",
57
+ fontWeight: currentLocale === "zh" ? "bold" : "normal",
58
+ }}
59
+ >
60
+ 中文
61
+ </button>
62
+ <button
63
+ onClick={() => handleLocaleChange("en")}
64
+ style={{
65
+ padding: "8px 16px",
66
+ backgroundColor: currentLocale === "en" ? "#155EEF" : "#fff",
67
+ color: currentLocale === "en" ? "#fff" : "#333",
68
+ border: "1px solid #155EEF",
69
+ borderRadius: 6,
70
+ cursor: "pointer",
71
+ fontWeight: currentLocale === "en" ? "bold" : "normal",
72
+ }}
73
+ >
74
+ English
75
+ </button>
76
+ <span style={{ marginLeft: 12, fontSize: 14, color: "#666" }}>
77
+ {currentLocale === "zh"
78
+ ? "当前显示中文"
79
+ : "Currently showing English"}
80
+ </span>
81
+ </div>
82
+ </div>
83
+
19
84
  <div>
20
85
  <h3>BestUnit 组件演示:</h3>
21
86
  <BestUnit
@@ -36,6 +101,60 @@ export default function DemoApp() {
36
101
  <h3>余额卡片组件演示:</h3>
37
102
  <StatisticalBalance />
38
103
  </div>
104
+
105
+ {/* 国际化文本测试区域 */}
106
+ <div
107
+ style={{
108
+ marginTop: 20,
109
+ padding: 16,
110
+ border: "1px solid #e5e7eb",
111
+ borderRadius: 8,
112
+ backgroundColor: "#f9fafb",
113
+ }}
114
+ >
115
+ <h3 style={{ marginTop: 0, marginBottom: 12 }}>国际化文本测试:</h3>
116
+ <div
117
+ style={{
118
+ display: "grid",
119
+ gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
120
+ gap: 12,
121
+ }}
122
+ >
123
+ <div style={{ padding: 8, backgroundColor: "#fff", borderRadius: 4 }}>
124
+ <strong>余额相关:</strong>
125
+ <br />
126
+ {t("余额详情")}
127
+ <br />
128
+ {t("真实金额")}
129
+ <br />
130
+ {t("冻结金额")}
131
+ <br />
132
+ {t("总可用")}
133
+ </div>
134
+ <div style={{ padding: 8, backgroundColor: "#fff", borderRadius: 4 }}>
135
+ <strong>充值相关:</strong>
136
+ <br />
137
+ {t("充值 / 转账")}
138
+ <br />
139
+ {t("在线充值")}
140
+ <br />
141
+ {t("线下转账")}
142
+ <br />
143
+ {t("去支付")}
144
+ </div>
145
+ <div style={{ padding: 8, backgroundColor: "#fff", borderRadius: 4 }}>
146
+ <strong>按钮文本:</strong>
147
+ <br />
148
+ {t("充值/转账")}
149
+ <br />
150
+ {t("取消")}
151
+ <br />
152
+ {t("提交中...")}
153
+ <br />
154
+ {t("关闭")}
155
+ </div>
156
+ </div>
157
+ </div>
39
158
  </div>
40
159
  );
41
160
  }
@@ -0,0 +1,57 @@
1
+ // 英文语言包
2
+ export const en: Record<string, string> = {
3
+ // 余额相关
4
+ 余额详情: "Balance Details",
5
+ 真实金额: "Real Amount",
6
+ 冻结金额: "Frozen Amount",
7
+ 总可用: "Total Available",
8
+
9
+ // 充值相关
10
+ "充值 / 转账": "Recharge / Transfer",
11
+ 在线充值: "Online Recharge",
12
+ 线下转账: "Offline Transfer",
13
+ 充值币种: "Recharge Currency",
14
+ 充值金额: "Recharge Amount",
15
+ 支付平台: "Payment Platform",
16
+ 请选择充值币种: "Please select recharge currency",
17
+ 请输入充值金额: "Please enter recharge amount",
18
+ 请选择支付平台: "Please select payment platform",
19
+ "提交失败,请重试": "Submit failed, please try again",
20
+ "提交中...": "Submitting...",
21
+ 去支付: "Go to Pay",
22
+ 取消: "Cancel",
23
+ 关闭: "Close",
24
+
25
+ // 离线转账相关
26
+ 第三方支付平台: "Third-party Payment Platform",
27
+ 交易ID: "Transaction ID",
28
+ 请输入转账交易ID: "Please enter transfer transaction ID",
29
+ 上传文件: "Upload Files",
30
+ 请上传转账凭证: "Please upload transfer voucher",
31
+ 离线充值创建成功: "Offline recharge created successfully",
32
+
33
+ // 通用
34
+ "加载中...": "Loading...",
35
+ 错误: "Error",
36
+ 成功: "Success",
37
+ 必填: "Required",
38
+
39
+ // 按钮文本
40
+ "充值/转账": "Recharge/Transfer",
41
+ 切换为暗黑主题: "Switch to Dark Theme",
42
+ 切换为白色主题: "Switch to Light Theme",
43
+
44
+ // 上传组件相关
45
+ 点击或拖拽文件到此处上传: "Click or drag files here to upload",
46
+ "支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":
47
+ "Supports JPG, PNG, PDF formats, single file not exceeding 20MB, maximum",
48
+ 个文件: "files can be uploaded",
49
+ "正在上传...": "Uploading...",
50
+ 已上传: "Uploaded",
51
+ 移除: "Remove",
52
+ };
53
+
54
+ // 根据中文key获取英文文本的函数
55
+ export function getEnText(zhKey: string): string {
56
+ return en[zhKey] || zhKey; // 如果找不到英文,返回中文key
57
+ }