feat(i18n): 添加主页国际化支持并优化语言切换

- 添加主页相关翻译键(guest, onlineCount, loading等)
- 修改主页使用 $lang 动态显示文本
- 分类名称改为使用 nameKey 映射到语言文件
- 添加 URL 参数语言检测(App.vue onLaunch)
- GamePortrait 返回时保留语言参数

支持语言:cn, tw, en, yn, kr, tl, in

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
li
2026-01-17 23:26:20 +08:00
co-authored by Claude Sonnet 4.5
parent e1baeca60b
commit 8b736be67b
4 changed files with 47 additions and 17 deletions
+12 -16
View File
@@ -11,7 +11,7 @@
<view class="user-avatar">
<u-icon name="account-fill" color="#fff" size="24"></u-icon>
</view>
<text class="username">{{ userInfo.username || 'Guest' }}</text>
<text class="username">{{ userInfo.username || $lang.guest }}</text>
<view class="balance-pill">
<u-icon name="rmb-circle-fill" color="#f4c46f" size="16"></u-icon>
<text class="balance-text">{{ userInfo.money || '0.00' }}</text>
@@ -45,13 +45,13 @@
<image :src="cat.icon" mode="widthFix" style="width: 24px; height: 24px;" v-if="cat.icon" />
<u-icon :name="cat.uIcon" color="#ccc" size="28" v-else></u-icon>
</view>
<text class="cat-name">{{ cat.name }}</text>
<text class="cat-name">{{ $lang[cat.nameKey] }}</text>
<text class="cat-count">({{ getCategoryCount(cat.id) }})</text>
</view>
<!-- Online Count Bottom -->
<view class="online-count-box">
<text class="label">在线人数</text>
<text class="label">{{ $lang.onlineCount }}</text>
<text class="count">2506</text>
</view>
</scroll-view>
@@ -60,7 +60,7 @@
<scroll-view scroll-y class="content-area">
<view class="table-list">
<view class="loading-state" v-if="loading">
<u-loading-icon color="#f4c46f" vertical text="Loading..."></u-loading-icon>
<u-loading-icon color="#f4c46f" vertical :text="$lang.loading"></u-loading-icon>
</view>
<view
@@ -75,7 +75,7 @@
<text class="table-name">{{ item.table_name }}</text>
</view>
<view class="header-right">
<text class="limit-info">上限:50000 下限:20</text>
<text class="limit-info">{{ $lang.maxLimit }}:50000 {{ $lang.minLimit }}:20</text>
<view class="status-dot" :class="{ 'is-live': item.status===1 }"></view>
</view>
</view>
@@ -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 子目录