diff --git a/tests/test_chinese_locale.py b/tests/test_chinese_locale.py index cac42178..ac06bd04 100644 --- a/tests/test_chinese_locale.py +++ b/tests/test_chinese_locale.py @@ -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():