fix(i18n): 补齐九语翻译并修复国际化检查
补齐历史缺译并统一整句插值。九语覆盖 100%,静态检查及 713 项单测通过。
This commit is contained in:
+25
-19
@@ -1019,11 +1019,11 @@ function renderPriceSimpleCore({
|
||||
|
||||
const parts = [];
|
||||
// base: model ratio
|
||||
parts.push(i18next.t('模型: {{ratio}}'));
|
||||
parts.push(i18next.t('模型: {{ratio}}', { ratio: modelRatio }));
|
||||
|
||||
// cache part (label differs when with image)
|
||||
if (shouldShowCache) {
|
||||
parts.push(i18next.t('缓存: {{cacheRatio}}'));
|
||||
parts.push(i18next.t('缓存: {{cacheRatio}}', { cacheRatio }));
|
||||
}
|
||||
|
||||
if (hasSplitCacheCreation) {
|
||||
@@ -1031,37 +1031,43 @@ function renderPriceSimpleCore({
|
||||
parts.push(
|
||||
i18next.t(
|
||||
'缓存创建: 5m {{cacheCreationRatio5m}} / 1h {{cacheCreationRatio1h}}',
|
||||
{ cacheCreationRatio5m, cacheCreationRatio1h },
|
||||
),
|
||||
);
|
||||
} else if (shouldShowCacheCreation5m) {
|
||||
parts.push(i18next.t('缓存创建: 5m {{cacheCreationRatio5m}}'));
|
||||
parts.push(
|
||||
i18next.t('缓存创建: 5m {{cacheCreationRatio5m}}', {
|
||||
cacheCreationRatio5m,
|
||||
}),
|
||||
);
|
||||
} else if (shouldShowCacheCreation1h) {
|
||||
parts.push(i18next.t('缓存创建: 1h {{cacheCreationRatio1h}}'));
|
||||
parts.push(
|
||||
i18next.t('缓存创建: 1h {{cacheCreationRatio1h}}', {
|
||||
cacheCreationRatio1h,
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else if (shouldShowLegacyCacheCreation) {
|
||||
parts.push(i18next.t('缓存创建: {{cacheCreationRatio}}'));
|
||||
parts.push(
|
||||
i18next.t('缓存创建: {{cacheCreationRatio}}', { cacheCreationRatio }),
|
||||
);
|
||||
}
|
||||
|
||||
// image part
|
||||
if (image) {
|
||||
parts.push(i18next.t('图片输入: {{imageRatio}}'));
|
||||
parts.push(i18next.t('图片输入: {{imageRatio}}', { imageRatio }));
|
||||
}
|
||||
|
||||
parts.push(`{{ratioType}}: {{groupRatio}}`);
|
||||
|
||||
let result = i18next.t(parts.join(' * '), {
|
||||
ratio: modelRatio,
|
||||
ratioType: ratioLabel,
|
||||
groupRatio: finalGroupRatio,
|
||||
cacheRatio: cacheRatio,
|
||||
cacheCreationRatio: cacheCreationRatio,
|
||||
cacheCreationRatio5m: cacheCreationRatio5m,
|
||||
cacheCreationRatio1h: cacheCreationRatio1h,
|
||||
imageRatio: imageRatio,
|
||||
});
|
||||
parts.push(
|
||||
i18next.t('{{ratioType}}: {{groupRatio}}', {
|
||||
ratioType: ratioLabel,
|
||||
groupRatio: finalGroupRatio,
|
||||
}),
|
||||
);
|
||||
let result = parts.join(' * ');
|
||||
|
||||
if (isSystemPromptOverride) {
|
||||
result += '\n\r' + i18next.t('系统提示覆盖');
|
||||
result += `\n\r${i18next.t('系统提示覆盖')}`;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
+7
-13
@@ -581,20 +581,14 @@ export const stripHistoryAttachments = (messages) => {
|
||||
counts.get(n) > 1 ? `${n}×${counts.get(n)}` : n,
|
||||
);
|
||||
if (grouped.length <= 5) {
|
||||
return (
|
||||
'\n\n' +
|
||||
i18next.t('[已发送附件: {{names}}]', {
|
||||
names: grouped.join(', '),
|
||||
})
|
||||
);
|
||||
return `\n\n${i18next.t('[已发送附件: {{names}}]', {
|
||||
names: grouped.join(', '),
|
||||
})}`;
|
||||
}
|
||||
return (
|
||||
'\n\n' +
|
||||
i18next.t('[已发送附件: {{names}} 等 {{total}} 个]', {
|
||||
names: grouped.slice(0, 5).join(', '),
|
||||
total: names.length,
|
||||
})
|
||||
);
|
||||
return `\n\n${i18next.t('[已发送附件: {{names}} 等 {{total}} 个]', {
|
||||
names: grouped.slice(0, 5).join(', '),
|
||||
total: names.length,
|
||||
})}`;
|
||||
};
|
||||
|
||||
// 白名单识别"要剥离的附件 part",其余 part(text / 未来可能的 audio / video 等)一律保留,
|
||||
|
||||
Reference in New Issue
Block a user