From 8b736be67bbf09116dde71aa175655859d330946 Mon Sep 17 00:00:00 2001 From: li Date: Sat, 17 Jan 2026 23:26:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(i18n):=20=E6=B7=BB=E5=8A=A0=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E5=9B=BD=E9=99=85=E5=8C=96=E6=94=AF=E6=8C=81=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=AD=E8=A8=80=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加主页相关翻译键(guest, onlineCount, loading等) - 修改主页使用 $lang 动态显示文本 - 分类名称改为使用 nameKey 映射到语言文件 - 添加 URL 参数语言检测(App.vue onLaunch) - GamePortrait 返回时保留语言参数 支持语言:cn, tw, en, yn, kr, tl, in Co-Authored-By: Claude Sonnet 4.5 --- App.vue | 16 +++++++++++++++- language/cn.js | 10 ++++++++++ language/en.js | 10 ++++++++++ pages/index.vue | 28 ++++++++++++---------------- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/App.vue b/App.vue index bbeed2a..1497d36 100644 --- a/App.vue +++ b/App.vue @@ -17,7 +17,21 @@ export default { Vue.prototype.$toastHide = this.$refs.uToast.hide; }); }, - onLaunch: function () {}, + onLaunch: function () { + // 检查 URL 参数中的语言设置 + // #ifdef H5 + const urlParams = new URLSearchParams(window.location.search); + const language = urlParams.get('language'); + if (language && ['cn', 'tw', 'en', 'yn', 'kr', 'tl', 'in'].includes(language)) { + // 更新语言设置 + this.$store.commit('app/setState', { + state: 'language', + value: language + }); + localStorage.setItem('language', language); + } + // #endif + }, onShow: function () { // this.setLanguage(); }, diff --git a/language/cn.js b/language/cn.js index 8155a24..4df4bfb 100644 --- a/language/cn.js +++ b/language/cn.js @@ -38,6 +38,16 @@ var cn = { buyu: "捕鱼游戏", qipai: "棋牌游戏", + // 主页 + guest: "游客", + onlineCount: "在线人数", + loading: "加载中...", + maxLimit: "上限", + minLimit: "下限", + betting: "下注中", + dealing: "发牌中", + preparing: "准备中", + recharge: "存款", rechargeWithdrawNetwork: "充/提币网络", pleaseChoose: "请选择", diff --git a/language/en.js b/language/en.js index 53be44b..58d0ca9 100644 --- a/language/en.js +++ b/language/en.js @@ -38,6 +38,16 @@ var en = { buyu: "Fishing", qipai: "Slots", + // Home page + guest: "Guest", + onlineCount: "Online", + loading: "Loading...", + maxLimit: "Max", + minLimit: "Min", + betting: "Betting", + dealing: "Dealing", + preparing: "Preparing", + recharge: "Recharge", rechargeWithdrawNetwork: "Recharge / Withdraw Network", pleaseChoose: "Please Choose", diff --git a/pages/index.vue b/pages/index.vue index 3deec0c..47dfeec 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -11,7 +11,7 @@ - {{ userInfo.username || 'Guest' }} + {{ userInfo.username || $lang.guest }} {{ userInfo.money || '0.00' }} @@ -45,13 +45,13 @@ - {{ cat.name }} + {{ $lang[cat.nameKey] }} ({{ getCategoryCount(cat.id) }}) - 在线人数 + {{ $lang.onlineCount }} 2506 @@ -60,7 +60,7 @@ - + {{ item.table_name }} - 上限:50000 下限:20 + {{ $lang.maxLimit }}:50000 {{ $lang.minLimit }}:20 @@ -138,15 +138,10 @@ export default { ], currentCategory: 0, // 0 = All or default category categories: [ - /* - { id: 0, name: '国际厅', uIcon: 'grid', gameIds: [1,2,3,4,5] }, - { id: 1, name: '旗舰厅', uIcon: 'star', gameIds: [1] }, - */ // Mapping based on common IDs: 1=Baccarat, 2=DT, 4=Bull, 5=ThreeCard - { id: 1, name: '百家乐', uIcon: 'chrome-circle-fill', gameIds: [1] }, - { id: 2, name: '龙虎', uIcon: 'heart-fill', gameIds: [2] }, - { id: 4, name: '牛牛', uIcon: 'thumb-up-fill', gameIds: [4] }, - // { id: 5, name: '金花/其他', uIcon: 'plus-circle-fill', gameIds: [5] }, // Grouping others + { id: 1, nameKey: 'baccarat', uIcon: 'chrome-circle-fill', gameIds: [1] }, + { id: 2, nameKey: 'longhu', uIcon: 'heart-fill', gameIds: [2] }, + { id: 4, nameKey: 'niuniu', uIcon: 'thumb-up-fill', gameIds: [4] }, ], allTables: [], loading: false, @@ -161,6 +156,7 @@ export default { ...mapState({ storeUserInfo: (state) => state.app.userInfo, language: (state) => state.app.language, + $lang: (state) => state.app.lang[state.app.language], }), filteredTables() { if (!this.allTables.length) return []; @@ -261,9 +257,9 @@ export default { return 'status-dealing'; }, getStatusText(status) { - if (status === 1) return '下注中'; - if (status === 2) return '发牌中'; - return '准备中'; + if (status === 1) return this.$lang.betting; + if (status === 2) return this.$lang.dealing; + return this.$lang.preparing; }, enterGame(item) { // 跳转到同域名下的 /game 子目录