feat: i18n多语言支持(zh/en/jp/ko)+i18n_getmsgs端点

This commit is contained in:
yumoqing 2026-07-24 13:49:55 +08:00
parent 25cfa19a48
commit 03645f1128
6 changed files with 62 additions and 0 deletions

View File

@ -11,6 +11,7 @@ PATHS_ANY = [
f"/{MOD}/cron/etl_sync.dspy",
f"/{MOD}/cron/etl_aggregate.dspy",
f"/{MOD}/cron/etl_provider_cost.dspy",
f"/{MOD}/i18n_getmsgs",
]
PATHS_LOGINED = [

12
wwwroot/i18n/en/i18n.json Normal file
View File

@ -0,0 +1,12 @@
{
"API Key排行": "API Key Ranking",
"供应商性价比": "Provider Cost-Performance",
"供应商性价比对比": "Provider ROI Comparison",
"供应商排行": "Provider Ranking",
"币种分布": "Currency Distribution",
"我的模型(按金额Top5)": "My Models (Top 5 by Amount)",
"模型性能排行": "Model Performance Ranking",
"热门模型": "Popular Models",
"用户排行": "User Ranking",
"财务概览": "Financial Overview"
}

12
wwwroot/i18n/jp/i18n.json Normal file
View File

@ -0,0 +1,12 @@
{
"API Key排行": "APIキーランキング",
"供应商性价比": "プロバイダーコストパフォーマンス",
"供应商性价比对比": "プロバイダーROI比較",
"供应商排行": "プロバイダーランキング",
"币种分布": "通貨分布",
"我的模型(按金额Top5)": "マイモデル金額Top5",
"模型性能排行": "モデルパフォーマンスランキング",
"热门模型": "人気モデル",
"用户排行": "ユーザーランキング",
"财务概览": "財務概要"
}

12
wwwroot/i18n/ko/i18n.json Normal file
View File

@ -0,0 +1,12 @@
{
"API Key排行": "API 키 랭킹",
"供应商性价比": "공급업체 가성비",
"供应商性价比对比": "공급업체 ROI 비교",
"供应商排行": "공급업체 랭킹",
"币种分布": "통화 분포",
"我的模型(按金额Top5)": "내 모델 (금액 Top5)",
"模型性能排行": "모델 성능 랭킹",
"热门模型": "인기 모델",
"用户排行": "사용자 랭킹",
"财务概览": "재무 개요"
}

12
wwwroot/i18n/zh/i18n.json Normal file
View File

@ -0,0 +1,12 @@
{
"API Key排行": "API Key排行",
"供应商性价比": "供应商性价比",
"供应商性价比对比": "供应商性价比对比",
"供应商排行": "供应商排行",
"币种分布": "币种分布",
"我的模型(按金额Top5)": "我的模型(按金额Top5)",
"模型性能排行": "模型性能排行",
"热门模型": "热门模型",
"用户排行": "用户排行",
"财务概览": "财务概览"
}

13
wwwroot/i18n_getmsgs.dspy Normal file
View File

@ -0,0 +1,13 @@
import json, os
lang = params.get('lang', 'zh')
i18n_dir = os.path.join(os.path.dirname(__file__), 'i18n', lang)
i18n_file = os.path.join(i18n_dir, 'i18n.json')
if os.path.exists(i18n_file):
with open(i18n_file, 'r', encoding='utf-8') as f:
msgs = json.load(f)
else:
msgs = {}
return json.dumps(msgs, ensure_ascii=False)