mirror of https://github.com/zulip/zulip.git
i18n: Add translation tags to default external accounts name.
This commit is contained in:
parent
3193afffe8
commit
1a426fa6be
|
@ -20,7 +20,7 @@ from zerver.lib.avatar import avatar_url
|
|||
from zerver.lib.bot_config import load_bot_config_template
|
||||
from zerver.lib.compatibility import is_outdated_server
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.external_accounts import DEFAULT_EXTERNAL_ACCOUNTS
|
||||
from zerver.lib.external_accounts import get_default_external_accounts
|
||||
from zerver.lib.hotspots import get_next_hotspots
|
||||
from zerver.lib.integrations import EMBEDDED_BOTS, WEBHOOK_INTEGRATIONS
|
||||
from 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("/")
|
||||
|
|
|
@ -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 ValidationError
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
from zerver.lib.types import ProfileFieldData
|
||||
from 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)],
|
||||
|
|
Loading…
Reference in New Issue