Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

fix(i18n): stop the subtitle animation from reusing the transition "None" label

c02062717c4ce455711
diff --git a/test/services/test_webui_i18n.py b/test/services/test_webui_i18n.py
index 53e19e60..268f6f57 100644
--- a/test/services/test_webui_i18n.py
+++ b/test/services/test_webui_i18n.py
@@ -106,6 +106,7 @@ ENGLISH_FALLBACK_KEYS = frozenset(
"Stop Tracking LoomLoom Run Help",
"Unavailable AI Video Model",
"VoxCPM Speed Not Supported",
+ "None (Animation)",
}
)
FORMAT_PLACEHOLDER_PATTERN = re.compile(r"(?<!\{)\{([a-zA-Z_][a-zA-Z0-9_]*)\}(?!\})")
@@ -133,6 +134,22 @@ def _load_translation(locale):
return data.get("Translation", {})
+def _duplicate_translation_keys(path):
+ """返回 locale 原始文本中重复定义的键,JSON 解析只保留最后一个。"""
+ duplicates = []
+
+ def collect(pairs):
+ seen = set()
+ for key, _ in pairs:
+ if key in seen:
+ duplicates.append(key)
+ seen.add(key)
+ return dict(pairs)
+
+ json.loads(path.read_text(encoding="utf-8"), object_pairs_hook=collect)
+ return duplicates
+
+
def _required_translation_keys(translations):
"""返回二级语言必须维护的 key,Provider 长说明统一回退英文。"""
return {
@@ -297,3 +314,14 @@ class TestWebuiI18n(unittest.TestCase):
self.assertIsNotNone(support_locales)
self.assertIn("ru-RU", support_locales)
+
+ def test_locale_files_do_not_redefine_a_translation_key(self):
+ """
+ 同一 JSON 对象里出现重复键时,解析只保留最后一个,前一个被静默丢弃。
+ 视频转场与字幕动画曾共用 "None" 键,中文转场下拉因此显示成「无动画」。
+ 这里直接检查原始 locale 文本,避免同类覆盖再次逃过 tr() 键覆盖测试。
+ """
+
+ for path in sorted(I18N_DIR.glob("*.json")):
+ with self.subTest(locale=path.stem):
+ self.assertEqual(_duplicate_translation_keys(path), [])
diff --git a/webui/Main.py b/webui/Main.py
index ed3774a6..505987b9 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -7169,7 +7169,7 @@ def _render_subtitle_settings(panel, params):
# Subtitle Animation (None vs Pop Spring)
subtitle_animations = [
- (tr("None"), "none"),
+ (tr("None (Animation)"), "none"),
(tr("Pop Up (Spring)"), "pop_spring"),
]
saved_anim = config.ui.get(
diff --git a/webui/i18n/en.json b/webui/i18n/en.json
index 806bd022..9a976562 100644
--- a/webui/i18n/en.json
+++ b/webui/i18n/en.json
@@ -195,7 +195,7 @@
"Single Word (Word by Word)": "Word by word",
"Word-by-word Timing Help": "Word-by-word timing is most accurate with Azure TTS V1 (Edge TTS) or Whisper. Other voice providers may fall back to phrase or sentence timing.",
"Subtitle Animation": "Entrance animation",
- "None": "None",
+ "None (Animation)": "None",
"Pop Up (Spring)": "Spring pop",
"Custom": "Custom",
"Custom Position (% from top)": "Custom Position (% from top)",
diff --git a/webui/i18n/zh.json b/webui/i18n/zh.json
index d3637064..f94c0437 100644
--- a/webui/i18n/zh.json
+++ b/webui/i18n/zh.json
@@ -195,7 +195,7 @@
"Single Word (Word by Word)": "逐词显示",
"Word-by-word Timing Help": "逐词显示在 Azure TTS V1(Edge TTS)或 Whisper 下最准确;其他语音服务缺少逐词时间轴时,可能按短语或整句显示。",
"Subtitle Animation": "字幕入场动画",
- "None": "无动画",
+ "None (Animation)": "无动画",
"Pop Up (Spring)": "弹跳出现",
"Custom": "自定义位置(70,表示离顶部70%的位置)",
"Custom Position (% from top)": "自定义位置(距顶部百分比)",