mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
i18n: Simplify logic for translation data in page_params.
This refactors the get_translation_data function to return an empty dict when 'en' language is passed, to avoid repetition of code in stats and home.
This commit is contained in:
committed by
Tim Abbott
parent
4e6c0989db
commit
d9d51e32c1
@@ -210,10 +210,6 @@ def build_page_params_for_home_page_load(
|
|||||||
page_params["max_message_id"] = max_message_id
|
page_params["max_message_id"] = max_message_id
|
||||||
page_params["enable_desktop_notifications"] = False
|
page_params["enable_desktop_notifications"] = False
|
||||||
|
|
||||||
page_params["translation_data"] = {}
|
page_params["translation_data"] = get_language_translation_data(request_language)
|
||||||
if request_language != "en":
|
|
||||||
page_params["translation_data"] = get_language_translation_data(
|
|
||||||
request_language
|
|
||||||
)
|
|
||||||
|
|
||||||
return register_ret["queue_id"], page_params
|
return register_ret["queue_id"], page_params
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ def get_available_language_codes() -> List[str]:
|
|||||||
return codes
|
return codes
|
||||||
|
|
||||||
def get_language_translation_data(language: str) -> Dict[str, str]:
|
def get_language_translation_data(language: str) -> Dict[str, str]:
|
||||||
if language == 'zh-hans':
|
if language == 'en':
|
||||||
|
return {}
|
||||||
|
elif language == 'zh-hans':
|
||||||
language = 'zh_Hans'
|
language = 'zh_Hans'
|
||||||
elif language == 'zh-hant':
|
elif language == 'zh-hant':
|
||||||
language = 'zh_Hant'
|
language = 'zh_Hant'
|
||||||
|
|||||||
Reference in New Issue
Block a user