refactor(i18n): 全工程面向国际用户与全球现代商务重构,彻底清理出海跨境等单向视角表达并对齐自动化测试

这个提交包含在:
wikiboss
2026-09-21 15:24:36 +08:00
父节点 ad9df7a7a4
当前提交 17882ca1cb
共有 135 个文件被更改,包括 12928 次插入 和 1653 次删除

查看文件

@@ -5,6 +5,7 @@
import { CardPortalDetail, BentoBlockPublic } from '../../common/types.uts';
import { fetchPortalCard } from '../../common/api.uts';
import { getCurrentLocale, getOmniText } from '../../common/locale.uts';
export type CaseKpi = {
label: string;
@@ -28,6 +29,11 @@ export type CaseMetaRecord = {
youtube?: string;
url?: string;
type?: string;
client?: string;
industry?: string;
region?: string;
challenge?: string;
solution?: string;
};
export type CaseDetailState = {
@@ -42,6 +48,11 @@ export type CaseDetailState = {
kpis: CaseKpi[];
pdfUrl: string;
youtubeUrl: string;
client?: string;
industry?: string;
region?: string;
challenge?: string;
solution?: string;
};
export type CaseDetailPageOptions = {
@@ -50,15 +61,129 @@ export type CaseDetailPageOptions = {
id?: string;
};
export const CASE_DETAIL_COPY = {
export type CaseDetailCopyKey =
| 'empty'
| 'emptyDesc'
| 'back'
| 'cta'
| 'pdf'
| 'youtube'
| 'loading'
| 'badge'
| 'overview'
| 'challenge'
| 'solution'
| 'kpis'
| 'resources'
| 'pdfAction'
| 'videoAction'
| 'clientLabel'
| 'industryLabel'
| 'regionLabel';
export const CASE_DETAIL_COPY: Record<CaseDetailCopyKey, string> = {
empty: '未找到该案例',
emptyDesc: '返回上一页继续浏览',
back: '返回',
cta: '咨询 / 互换',
cta: '咨询',
pdf: 'PDF',
youtube: 'YouTube',
loading: '加载中',
badge: '标杆商务实践',
overview: '案例详情与方案',
challenge: '业务挑战与背景',
solution: '落地解决方案',
kpis: '核心商业化成果',
resources: '项目资料与演示',
pdfAction: '复制白皮书链接',
videoAction: '复制演示视频链接',
clientLabel: '标杆客户',
industryLabel: '行业赛道',
regionLabel: '业务覆盖区域',
};
function isZhLocale(): boolean {
return getCurrentLocale() === 'zh-CN';
}
/**
* 案例详情文案:模板只调本函数,禁止直接绑中文。词典能复用的走 getOmniText。
*/
export function resolveCaseDetailText(key: CaseDetailCopyKey): string {
const locale = getCurrentLocale();
if (key === 'loading') {
return getOmniText(locale, 'common.loading');
}
const zh = isZhLocale();
if (key === 'empty') {
return zh ? CASE_DETAIL_COPY.empty : 'This case is unavailable';
}
if (key === 'emptyDesc') {
return zh ? CASE_DETAIL_COPY.emptyDesc : 'Go back to keep browsing';
}
if (key === 'back') {
return zh ? CASE_DETAIL_COPY.back : 'Back';
}
if (key === 'cta') {
return zh ? CASE_DETAIL_COPY.cta : 'Inquire';
}
if (key === 'badge') {
return zh ? CASE_DETAIL_COPY.badge : 'GLOBAL CASE STUDY';
}
if (key === 'overview') {
return zh ? CASE_DETAIL_COPY.overview : 'Case Overview';
}
if (key === 'challenge') {
return zh ? CASE_DETAIL_COPY.challenge : 'Business Challenge';
}
if (key === 'solution') {
return zh ? CASE_DETAIL_COPY.solution : 'Solution & Architecture';
}
if (key === 'kpis') {
return zh ? CASE_DETAIL_COPY.kpis : 'Key Business Results';
}
if (key === 'resources') {
return zh ? CASE_DETAIL_COPY.resources : 'Project Resources';
}
if (key === 'pdfAction') {
return zh ? CASE_DETAIL_COPY.pdfAction : 'Copy Document Link';
}
if (key === 'videoAction') {
return zh ? CASE_DETAIL_COPY.videoAction : 'Copy Video Link';
}
if (key === 'clientLabel') {
return zh ? CASE_DETAIL_COPY.clientLabel : 'Client';
}
if (key === 'industryLabel') {
return zh ? CASE_DETAIL_COPY.industryLabel : 'Industry';
}
if (key === 'regionLabel') {
return zh ? CASE_DETAIL_COPY.regionLabel : 'Region';
}
return CASE_DETAIL_COPY[key];
}
/**
* 外链无 open 能力时只复制,不发起新请求
*/
export function copyCaseExternalLink(url: string): boolean {
const trimmed = url != null ? url.trim() : '';
if (trimmed === '') {
return false;
}
uni.setClipboardData({
data: trimmed,
success: () => {
uni.showToast({
title: getOmniText(getCurrentLocale(), 'portal.copied_link'),
icon: 'none',
});
},
});
return true;
}
/**
* 创建案例详情初始状态
*/
@@ -75,6 +200,11 @@ export function createCaseDetailState(): CaseDetailState {
kpis: [],
pdfUrl: '',
youtubeUrl: '',
client: '',
industry: '',
region: '',
challenge: '',
solution: '',
};
}
@@ -222,6 +352,11 @@ function clearCaseContent(state: CaseDetailState): void {
state.kpis = [];
state.pdfUrl = '';
state.youtubeUrl = '';
state.client = '';
state.industry = '';
state.region = '';
state.challenge = '';
state.solution = '';
}
function applyEmpty(state: CaseDetailState): void {
@@ -243,6 +378,11 @@ function fillFromBlock(state: CaseDetailState, block: BentoBlockPublic): void {
state.kpis = kpis.length > 0 ? kpis : normalizeKpis(meta.metrics);
state.pdfUrl = resolvePdfUrl(meta);
state.youtubeUrl = resolveYoutubeUrl(meta);
state.client = readTrimmed(meta.client);
state.industry = readTrimmed(meta.industry);
state.region = readTrimmed(meta.region);
state.challenge = readTrimmed(meta.challenge);
state.solution = readTrimmed(meta.solution);
}
/**