mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-26 19:50:15 +00:00
fix(stage-330): broaden chinese-locale test to accept both \uXXXX and literal CJK forms (PR #2002 source-form refresh)
This commit is contained in:
@@ -79,18 +79,23 @@ def test_chinese_locale_block_exists():
|
||||
|
||||
def test_chinese_locale_includes_representative_translations():
|
||||
src = read(REPO / "static" / "i18n.js")
|
||||
expected = [
|
||||
"settings_title: '\\u8bbe\\u7f6e'",
|
||||
"login_title: '\\u767b\\u5f55'",
|
||||
"approval_heading: '需要审批'",
|
||||
"tab_tasks: '任务'",
|
||||
"tab_profiles: '配置'",
|
||||
"session_time_bucket_today: '今天'",
|
||||
"onboarding_title: '欢迎使用 Hermes Web UI'",
|
||||
"onboarding_complete: '引导完成'",
|
||||
# Each tuple is a list of acceptable source forms for the same translation —
|
||||
# either escape-encoded `\uXXXX` form or literal CJK characters. They produce
|
||||
# the same runtime string; do not pin source encoding.
|
||||
expected_alternatives = [
|
||||
[r"settings_title: '\u8bbe\u7f6e'", "settings_title: '设置'"],
|
||||
[r"login_title: '\u767b\u5f55'", "login_title: '登录'"],
|
||||
["approval_heading: '需要审批'"],
|
||||
["tab_tasks: '任务'"],
|
||||
["tab_profiles: '配置'"],
|
||||
["session_time_bucket_today: '今天'"],
|
||||
["onboarding_title: '欢迎使用 Hermes Web UI'"],
|
||||
["onboarding_complete: '引导完成'"],
|
||||
]
|
||||
for entry in expected:
|
||||
assert entry in src
|
||||
for alts in expected_alternatives:
|
||||
assert any(alt in src for alt in alts), (
|
||||
f"None of the expected forms found in i18n.js: {alts!r}"
|
||||
)
|
||||
|
||||
|
||||
def test_chinese_locale_covers_english_keys():
|
||||
|
||||
Reference in New Issue
Block a user