From 8b70c6a3e98f39fde345eca4fd8dc01075eabc41 Mon Sep 17 00:00:00 2001 From: Seven Date: Wed, 14 Jan 2026 04:24:44 +0700 Subject: [PATCH] feat: internationalize various components and views with i18n translations --- src/views/deposit/fiat.vue | 2 +- src/views/onchain-address/index.vue | 27 ++++---- src/views/pwa/download.vue | 61 ++++++++++--------- .../revenue/monthly/components/overview.vue | 10 +-- .../revenue/monthly/components/recent.vue | 6 +- .../monthly/components/revenue-source.vue | 6 +- .../revenue/monthly/components/trend.vue | 4 +- src/views/revenue/pending/index.vue | 18 +++--- src/views/revenue/records/index.vue | 4 +- .../revenue/total/components/overview.vue | 10 +-- src/views/revenue/total/components/recent.vue | 6 +- .../total/components/revenue-source.vue | 6 +- src/views/revenue/total/components/trend.vue | 4 +- src/views/scan-qr/index.vue | 5 +- .../trade-settings/bank-management/add.vue | 2 +- .../trade-settings/bank-management/index.vue | 8 +-- .../my-issues/components/about.vue | 4 +- .../my-issues/components/base.vue | 4 +- src/views/trade-settings/my-issues/detail.vue | 5 +- .../components/my-subscribe-list.vue | 8 +-- .../trade-settings/my-subscribe/detail.vue | 26 ++++---- .../trade-settings/my-subscribe/index.vue | 6 +- .../trade-tokenized/components/about.vue | 4 +- src/views/trade-tokenized/components/base.vue | 24 ++++---- .../trade-tokenized/components/market.vue | 10 +-- .../trade-tokenized/components/order-book.vue | 9 +-- src/views/trade-tokenized/index.vue | 8 +-- src/views/user-settings/email.vue | 2 +- src/views/user-settings/index.vue | 19 +++--- src/views/user-settings/nickname.vue | 13 ++-- src/views/user-settings/username.vue | 13 ++-- src/views/wallet/asset-record.vue | 11 ++-- src/views/wallet/bill.vue | 7 ++- src/views/wallet/components/deposit.vue | 17 +++--- src/views/wallet/components/withdraw.vue | 19 +++--- src/views/wallet/funding.vue | 11 ++-- src/views/wallet/trading.vue | 11 ++-- src/views/wallet/transfer-to-user.vue | 35 +++++------ src/views/wallet/transfer.vue | 4 +- .../components/select-bank-account.vue | 4 +- .../withdraw/components/select-currency.vue | 4 +- src/views/withdraw/index.vue | 4 +- 42 files changed, 251 insertions(+), 210 deletions(-) diff --git a/src/views/deposit/fiat.vue b/src/views/deposit/fiat.vue index 4e40701..7ed95c4 100644 --- a/src/views/deposit/fiat.vue +++ b/src/views/deposit/fiat.vue @@ -33,7 +33,7 @@ function validate(value: string) { async function onSubmit() { const loading = await loadingController.create({ - message: "提交中...", + message: t("recharge.fiat.submitting"), }); await loading.present(); await safeClient(client.api.deposit.fiat.post(form.value)).finally(async () => { diff --git a/src/views/onchain-address/index.vue b/src/views/onchain-address/index.vue index 3dad5eb..906d28d 100644 --- a/src/views/onchain-address/index.vue +++ b/src/views/onchain-address/index.vue @@ -7,6 +7,7 @@ import html2canvas from "html2canvas"; import MaterialSymbolsDownload from "~icons/material-symbols/download"; import MaterialSymbolsUpload from "~icons/material-symbols/upload"; +const { t } = useI18n(); const userStore = useUserStore(); const { userProfile } = storeToRefs(userStore); const url = computed(() => { @@ -63,7 +64,7 @@ async function captureQRCode(): Promise { async function handleShare() { const loading = await loadingController.create({ - message: "准备分享...", + message: t("onchainAddress.preparing"), }); await loading.present(); @@ -78,8 +79,8 @@ async function handleShare() { const file = new File([blob], "qrcode.png", { type: "image/png" }); await share({ - title: "我的转账二维码", - text: `我的 ID: ${userProfile.value?.uid}`, + title: t("onchainAddress.shareTitle"), + text: `${t("onchainAddress.myId")}: ${userProfile.value?.uid}`, files: [file], }); } @@ -87,7 +88,7 @@ async function handleShare() { // 不支持则提示复制链接 await navigator.clipboard.writeText(url.value); const toast = await toastController.create({ - message: "链接已复制到剪贴板", + message: t("onchainAddress.linkCopied"), duration: 2000, color: "success", }); @@ -107,17 +108,17 @@ async function handleShare() { }); await Share.share({ - title: "我的转账二维码", - text: `我的 ID: ${userProfile.value?.uid}`, + title: t("onchainAddress.shareTitle"), + text: `${t("onchainAddress.myId")}: ${userProfile.value?.uid}`, url: result.uri, - dialogTitle: "分享二维码", + dialogTitle: t("onchainAddress.shareDialogTitle"), }); } } catch (error) { console.error("Share error:", error); const toast = await toastController.create({ - message: "分享失败", + message: t("onchainAddress.shareFailed"), duration: 2000, color: "danger", }); @@ -133,7 +134,7 @@ async function handleShare() { */ async function handleDownload() { const loading = await loadingController.create({ - message: "正在保存...", + message: t("onchainAddress.saving"), }); await loading.present(); @@ -159,7 +160,7 @@ async function handleDownload() { }); const toast = await toastController.create({ - message: "二维码已保存到文件", + message: t("onchainAddress.saveSuccess"), duration: 2000, color: "success", }); @@ -169,7 +170,7 @@ async function handleDownload() { catch (error) { console.error("Download error:", error); const toast = await toastController.create({ - message: "保存失败", + message: t("onchainAddress.saveFailed"), duration: 2000, color: "danger", }); @@ -188,7 +189,7 @@ async function handleDownload() { - 转账二维码 + {{ t("onchainAddress.title") }} @@ -210,7 +211,7 @@ async function handleDownload() {
- 我的 ID + {{ t("onchainAddress.myId") }}
diff --git a/src/views/pwa/download.vue b/src/views/pwa/download.vue index cb77733..aa80149 100644 --- a/src/views/pwa/download.vue +++ b/src/views/pwa/download.vue @@ -6,6 +6,7 @@ import IconParkOutlineDownload from "~icons/icon-park-outline/download"; import IconParkOutlinePhone from "~icons/icon-park-outline/phone"; import IconParkOutlineShare from "~icons/icon-park-outline/share"; +const { t } = useI18n(); const { canInstall, isInstalled, install, isIOS, isIOSSafari } = usePWAInstall(); const platform = usePlatform(); @@ -39,9 +40,9 @@ const shouldShowDownloadButton = computed(() => { async function handleInstall() { if (isIOSSafari) { const alert = await alertController.create({ - header: "iOS 安装指引", - message: "请点击浏览器底部的分享按钮,然后选择\"添加到主屏幕\"", - buttons: ["知道了"], + header: t("pwa.download.iosInstallHeader"), + message: t("pwa.download.iosInstallMessage"), + buttons: [t("pwa.download.iosInstallButton")], }); await alert.present(); return; @@ -55,17 +56,17 @@ async function handleInstall() { localStorage.setItem("pwa-was-installed", "true"); const alert = await alertController.create({ - header: "安装成功", - message: "应用已成功安装到您的设备", - buttons: ["确定"], + header: t("pwa.download.installSuccessHeader"), + message: t("pwa.download.installSuccessMessage"), + buttons: [t("pwa.download.installSuccessButton")], }); await alert.present(); } else if (result.outcome === "ios-instruction") { const alert = await alertController.create({ - header: "iOS 安装指引", - message: "请点击浏览器底部的分享按钮,然后选择\"添加到主屏幕\"", - buttons: ["知道了"], + header: t("pwa.download.iosInstallHeader"), + message: t("pwa.download.iosInstallMessage"), + buttons: [t("pwa.download.iosInstallButton")], }); await alert.present(); } @@ -90,7 +91,7 @@ watch(isInstalled, (installed) => { - 下载应用 + {{ t("pwa.download.title") }} @@ -103,7 +104,7 @@ watch(isInstalled, (installed) => { {{ appName }}

- 随时随地,管理您的数字资产 + {{ t("pwa.download.subtitle") }}

@@ -112,10 +113,10 @@ watch(isInstalled, (installed) => {

- 应用已安装 + {{ t("pwa.download.installed") }}

- 您可以在主屏幕找到应用图标 + {{ t("pwa.download.installedDesc") }}

@@ -126,7 +127,7 @@ watch(isInstalled, (installed) => {

- iOS 安装步骤 + {{ t("pwa.download.iosInstallTitle") }}

@@ -138,9 +139,9 @@ watch(isInstalled, (installed) => {

- 点击 Safari 底部的 + {{ t("pwa.download.iosStep1") }} - 分享 按钮 + {{ t("pwa.download.iosStep1Button") }} 按钮

@@ -152,8 +153,8 @@ watch(isInstalled, (installed) => {

- 在弹出的菜单中,向下滚动找到 - "添加到主屏幕" + {{ t("pwa.download.iosStep2") }} + "{{ t("pwa.download.iosStep2Option") }}"

@@ -165,7 +166,7 @@ watch(isInstalled, (installed) => {

- 点击 "添加" 完成安装 + {{ t("pwa.download.iosStep3") }} "{{ t("pwa.download.iosStep3Button") }}" {{ t("pwa.download.iosStep3Complete") }}

@@ -176,7 +177,7 @@ watch(isInstalled, (installed) => {

💡 - 请使用 Safari 浏览器进行安装 + {{ t("pwa.download.iosTip") }}

@@ -186,10 +187,10 @@ watch(isInstalled, (installed) => {

- {{ wasUninstalled ? '重新安装应用' : '安装到设备' }} + {{ wasUninstalled ? t("pwa.download.reinstallButton") : t("pwa.download.installButton") }}

- {{ wasUninstalled ? '快速重新安装应用到您的设备' : '一键安装,无需下载,即刻使用' }} + {{ wasUninstalled ? t("pwa.download.reinstallDesc") : t("pwa.download.installDesc") }}

{ > - {{ isLoading ? '安装中...' : wasUninstalled ? '重新安装' : '立即安装' }} + {{ isLoading ? t("pwa.download.installing") : wasUninstalled ? t("pwa.download.reinstall") : t("pwa.download.install") }}
@@ -211,19 +212,19 @@ watch(isInstalled, (installed) => {
- 无需应用商店,快速安装 + {{ t("pwa.download.advantage1") }}
- 占用空间小,运行流畅 + {{ t("pwa.download.advantage2") }}
- 自动更新,始终最新版本 + {{ t("pwa.download.advantage3") }}
@@ -233,10 +234,10 @@ watch(isInstalled, (installed) => {

- 您正在使用原生应用 + {{ t("pwa.download.nativeAppTitle") }}

- 已经是最新版本,无需下载 + {{ t("pwa.download.nativeAppDesc") }}

@@ -245,10 +246,10 @@ watch(isInstalled, (installed) => {

- 当前浏览器暂不支持应用安装 + {{ t("pwa.download.notSupportedTitle") }}

- 建议使用 Chrome、Safari 或 Edge 浏览器 + {{ t("pwa.download.notSupportedDesc") }}

diff --git a/src/views/revenue/monthly/components/overview.vue b/src/views/revenue/monthly/components/overview.vue index db16d51..621bd2c 100644 --- a/src/views/revenue/monthly/components/overview.vue +++ b/src/views/revenue/monthly/components/overview.vue @@ -4,19 +4,21 @@ import type { EaringsSummaryData } from "@/api/types"; defineProps<{ data: EaringsSummaryData | null; }>(); + +const { t } = useI18n();