Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
i18n: Add translation tags to default external accounts name.
Yogesh Sirsat1a426fa6be0f
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 67c977cc840..117db4c7b4b 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -20,7 +20,7 @@ from zerver.lib.avatar import avatar_urlfrom zerver.lib.bot_config import load_bot_config_templatefrom zerver.lib.compatibility import is_outdated_serverfrom zerver.lib.exceptions import JsonableError-from zerver.lib.external_accounts import DEFAULT_EXTERNAL_ACCOUNTS+from zerver.lib.external_accounts import get_default_external_accountsfrom zerver.lib.hotspots import get_next_hotspotsfrom zerver.lib.integrations import EMBEDDED_BOTS, WEBHOOK_INTEGRATIONSfrom zerver.lib.message import (@@ -318,7 +318,7 @@ def fetch_initial_state_data(# TODO: Should these have the realm prefix replaced with server_?state["realm_push_notifications_enabled"] = push_notifications_enabled()- state["realm_default_external_accounts"] = DEFAULT_EXTERNAL_ACCOUNTS+ state["realm_default_external_accounts"] = get_default_external_accounts()if settings.JITSI_SERVER_URL is not None:state["jitsi_server_url"] = settings.JITSI_SERVER_URL.rstrip("/")diff --git a/zerver/lib/external_accounts.py b/zerver/lib/external_accounts.pyindex b0cf75cb2e7..f22c23aa6e9 100644--- a/zerver/lib/external_accounts.py+++ b/zerver/lib/external_accounts.py@@ -1,8 +1,12 @@"""This module stores data for "external account" custom profile field."""+import copy+from typing import Dict+from django.core.exceptions import ValidationErrorfrom django.utils.translation import gettext as _+from django.utils.translation import gettext_lazyfrom zerver.lib.types import ProfileFieldDatafrom zerver.lib.validator import (@@ -23,18 +27,27 @@ DEFAULT_EXTERNAL_ACCOUNTS = {"twitter": {"text": "Twitter","url_pattern": "https://twitter.com/%(username)s",- "name": "Twitter username",+ "name": gettext_lazy("Twitter username"),"hint": "",},"github": {"text": "GitHub","url_pattern": "https://github.com/%(username)s",- "name": "GitHub username",+ "name": gettext_lazy("GitHub username"),"hint": "",},}+def get_default_external_accounts() -> Dict[str, Dict[str, str]]:+ translated_default_external_accounts = copy.deepcopy(DEFAULT_EXTERNAL_ACCOUNTS)++ for external_account in translated_default_external_accounts.values():+ external_account["name"] = str(external_account["name"])++ return translated_default_external_accounts++def validate_external_account_field_data(field_data: ProfileFieldData) -> ProfileFieldData:field_validator = check_dict_only([("subtype", check_required_string)],