diff --git a/changedetectionio/languages.py b/changedetectionio/languages.py index e6552d716..c169de9cf 100644 --- a/changedetectionio/languages.py +++ b/changedetectionio/languages.py @@ -29,7 +29,7 @@ def get_timeago_locale(flask_locale): """ locale_map = { 'zh': 'zh_CN', # Chinese Simplified - 'zh_Hant_TW': 'zh_TW', # Flask-Babel normalizes zh_TW to zh_Hant_TW + 'zh_TW': 'zh_Hant_TW', # Flask-Babel normalizes zh_TW to zh_Hant_TW 'pt': 'pt_PT', # Portuguese (Portugal) 'sv': 'sv_SE', # Swedish 'no': 'nb_NO', # Norwegian Bokmål @@ -54,7 +54,7 @@ LANGUAGE_DATA = { 'it': {'flag': 'fi fi-it fis', 'name': 'Italiano'}, 'ja': {'flag': 'fi fi-jp fis', 'name': '日本語'}, 'zh': {'flag': 'fi fi-cn fis', 'name': '中文 (简体)'}, - 'zh_TW': {'flag': 'fi fi-tw fis', 'name': '繁體中文'}, + 'zh_Hant_TW': {'flag': 'fi fi-tw fis', 'name': '繁體中文'}, 'ru': {'flag': 'fi fi-ru fis', 'name': 'Русский'}, 'pl': {'flag': 'fi fi-pl fis', 'name': 'Polski'}, 'nl': {'flag': 'fi fi-nl fis', 'name': 'Nederlands'}, diff --git a/changedetectionio/templates/base.html b/changedetectionio/templates/base.html index 35df0b70a..cc29d399d 100644 --- a/changedetectionio/templates/base.html +++ b/changedetectionio/templates/base.html @@ -1,5 +1,5 @@ - +
diff --git a/changedetectionio/tests/test_i18n.py b/changedetectionio/tests/test_i18n.py index 76fa8f3e9..43ca2ff2c 100644 --- a/changedetectionio/tests/test_i18n.py +++ b/changedetectionio/tests/test_i18n.py @@ -3,6 +3,24 @@ from flask import url_for from .util import live_server_setup +def test_zh_TW(client, live_server, measure_memory_usage, datastore_path): + + res = client.get( + url_for("set_language", locale="zh"), # Simplified chinese + follow_redirects=True + ) + assert "选择语言".encode() in res.data + + + res = client.get( + url_for("set_language", locale="zh_Hant_TW"), # Traditional + follow_redirects=True + ) + # HTML follows BCP 47 language tag rules, not underscore-based locale formats. + assert b'