mirror of https://github.com/zulip/zulip.git
onboarding: Fix topic names not being translated correctly.
In 'send_initial_realm_messages', the topics names were not being translated properly as they were computed outside the with `override_language` block. Now, we use 'send_initial_realm_messages' inside a with 'override_language' block in the caller. This fixes the bug. Note: We are using 'override_language' block in the caller and not within the function as it helps to avoid indenting everything inside the function.
This commit is contained in:
parent
aad66674e7
commit
0cddc8a6a6
|
@ -582,7 +582,8 @@ def do_create_user(
|
||||||
if realm_creation:
|
if realm_creation:
|
||||||
from zerver.lib.onboarding import send_initial_realm_messages
|
from zerver.lib.onboarding import send_initial_realm_messages
|
||||||
|
|
||||||
send_initial_realm_messages(realm)
|
with override_language(realm.default_language):
|
||||||
|
send_initial_realm_messages(realm)
|
||||||
|
|
||||||
return user_profile
|
return user_profile
|
||||||
|
|
||||||
|
|
|
@ -271,28 +271,27 @@ def send_initial_realm_messages(realm: Realm) -> None:
|
||||||
# at least one message.
|
# at least one message.
|
||||||
welcome_bot = get_system_bot(settings.WELCOME_BOT, realm.id)
|
welcome_bot = get_system_bot(settings.WELCOME_BOT, realm.id)
|
||||||
|
|
||||||
with override_language(realm.default_language):
|
# Content is declared here to apply translation properly.
|
||||||
# Content is declared here to apply translation properly.
|
#
|
||||||
#
|
# remove_single_newlines needs to be called on any multiline
|
||||||
# remove_single_newlines needs to be called on any multiline
|
# strings for them to render properly.
|
||||||
# strings for them to render properly.
|
content1_of_moving_messages_topic_name = (
|
||||||
content1_of_moving_messages_topic_name = (
|
_("""
|
||||||
_("""
|
|
||||||
If anything is out of place, it’s easy to [move messages]({move_content_another_topic_help_url}),
|
If anything is out of place, it’s easy to [move messages]({move_content_another_topic_help_url}),
|
||||||
[rename]({rename_topic_help_url}) and [split]({move_content_another_topic_help_url}) topics,
|
[rename]({rename_topic_help_url}) and [split]({move_content_another_topic_help_url}) topics,
|
||||||
or even move a topic [to a different channel]({move_content_another_channel_help_url}).
|
or even move a topic [to a different channel]({move_content_another_channel_help_url}).
|
||||||
""")
|
""")
|
||||||
).format(
|
).format(
|
||||||
move_content_another_topic_help_url="/help/move-content-to-another-topic",
|
move_content_another_topic_help_url="/help/move-content-to-another-topic",
|
||||||
rename_topic_help_url="/help/rename-a-topic",
|
rename_topic_help_url="/help/rename-a-topic",
|
||||||
move_content_another_channel_help_url="/help/move-content-to-another-channel",
|
move_content_another_channel_help_url="/help/move-content-to-another-channel",
|
||||||
)
|
)
|
||||||
|
|
||||||
content2_of_moving_messages_topic_name = _("""
|
content2_of_moving_messages_topic_name = _("""
|
||||||
:point_right: Try moving this message to another topic and back.
|
:point_right: Try moving this message to another topic and back.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content1_of_welcome_to_zulip_topic_name = _("""
|
content1_of_welcome_to_zulip_topic_name = _("""
|
||||||
Zulip is organized to help you communicate more efficiently. Conversations are
|
Zulip is organized to help you communicate more efficiently. Conversations are
|
||||||
labeled with topics, which summarize what the conversation is about.
|
labeled with topics, which summarize what the conversation is about.
|
||||||
|
|
||||||
|
@ -300,41 +299,41 @@ For example, this message is in the “{topic_name}” topic in the
|
||||||
#**{zulip_discussion_channel_name}** channel, as you can see in the left sidebar
|
#**{zulip_discussion_channel_name}** channel, as you can see in the left sidebar
|
||||||
and above.
|
and above.
|
||||||
""").format(
|
""").format(
|
||||||
zulip_discussion_channel_name=str(Realm.ZULIP_DISCUSSION_CHANNEL_NAME),
|
zulip_discussion_channel_name=str(Realm.ZULIP_DISCUSSION_CHANNEL_NAME),
|
||||||
topic_name=_("welcome to Zulip!"),
|
topic_name=_("welcome to Zulip!"),
|
||||||
)
|
)
|
||||||
|
|
||||||
content2_of_welcome_to_zulip_topic_name = _("""
|
content2_of_welcome_to_zulip_topic_name = _("""
|
||||||
You can read Zulip one conversation at a time, seeing each message in context,
|
You can read Zulip one conversation at a time, seeing each message in context,
|
||||||
no matter how many other conversations are going on.
|
no matter how many other conversations are going on.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content3_of_welcome_to_zulip_topic_name = _("""
|
content3_of_welcome_to_zulip_topic_name = _("""
|
||||||
:point_right: When you're ready, check out your [Inbox](/#inbox) for other
|
:point_right: When you're ready, check out your [Inbox](/#inbox) for other
|
||||||
conversations with unread messages.
|
conversations with unread messages.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content1_of_start_conversation_topic_name = _("""
|
content1_of_start_conversation_topic_name = _("""
|
||||||
To kick off a new conversation, click **Start new conversation** below.
|
To kick off a new conversation, click **Start new conversation** below.
|
||||||
The new conversation thread will be labeled with its own topic.
|
The new conversation thread will be labeled with its own topic.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content2_of_start_conversation_topic_name = _("""
|
content2_of_start_conversation_topic_name = _("""
|
||||||
For a good topic name, think about finishing the sentence: “Hey, can we chat about…?”
|
For a good topic name, think about finishing the sentence: “Hey, can we chat about…?”
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content3_of_start_conversation_topic_name = _("""
|
content3_of_start_conversation_topic_name = _("""
|
||||||
:point_right: Try starting a new conversation in this channel.
|
:point_right: Try starting a new conversation in this channel.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content1_of_experiments_topic_name = (
|
content1_of_experiments_topic_name = (
|
||||||
_("""
|
_("""
|
||||||
:point_right: Use this topic to try out [Zulip's messaging features]({format_message_help_url}).
|
:point_right: Use this topic to try out [Zulip's messaging features]({format_message_help_url}).
|
||||||
""")
|
""")
|
||||||
).format(format_message_help_url="/help/format-your-message-using-markdown")
|
).format(format_message_help_url="/help/format-your-message-using-markdown")
|
||||||
|
|
||||||
content2_of_experiments_topic_name = (
|
content2_of_experiments_topic_name = (
|
||||||
_("""
|
_("""
|
||||||
```spoiler Want to see some examples?
|
```spoiler Want to see some examples?
|
||||||
|
|
||||||
````python
|
````python
|
||||||
|
@ -347,21 +346,21 @@ print("code blocks")
|
||||||
Link to a conversation: #**{zulip_discussion_channel_name}>{topic_name}**
|
Link to a conversation: #**{zulip_discussion_channel_name}>{topic_name}**
|
||||||
```
|
```
|
||||||
""")
|
""")
|
||||||
).format(
|
).format(
|
||||||
zulip_discussion_channel_name=str(Realm.ZULIP_DISCUSSION_CHANNEL_NAME),
|
zulip_discussion_channel_name=str(Realm.ZULIP_DISCUSSION_CHANNEL_NAME),
|
||||||
topic_name=_("welcome to Zulip!"),
|
topic_name=_("welcome to Zulip!"),
|
||||||
)
|
)
|
||||||
|
|
||||||
content1_of_greetings_topic_name = _("""
|
content1_of_greetings_topic_name = _("""
|
||||||
This **greetings** topic is a great place to say “hi” :wave: to your teammates.
|
This **greetings** topic is a great place to say “hi” :wave: to your teammates.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content2_of_greetings_topic_name = _("""
|
content2_of_greetings_topic_name = _("""
|
||||||
:point_right: Click on this message to start a new message in the same conversation.
|
:point_right: Click on this message to start a new message in the same conversation.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
content_of_zulip_update_announcements_topic_name = (
|
content_of_zulip_update_announcements_topic_name = (
|
||||||
_("""
|
_("""
|
||||||
Welcome! To help you learn about new features and configuration options,
|
Welcome! To help you learn about new features and configuration options,
|
||||||
this topic will receive messages about important changes in Zulip.
|
this topic will receive messages about important changes in Zulip.
|
||||||
|
|
||||||
|
@ -369,11 +368,11 @@ You can read these update messages whenever it's convenient, or
|
||||||
[mute]({mute_topic_help_url}) this topic if you are not interested.
|
[mute]({mute_topic_help_url}) this topic if you are not interested.
|
||||||
If your organization does not want to receive these announcements,
|
If your organization does not want to receive these announcements,
|
||||||
they can be disabled. [Learn more]({zulip_update_announcements_help_url}).
|
they can be disabled. [Learn more]({zulip_update_announcements_help_url}).
|
||||||
""")
|
""")
|
||||||
).format(
|
).format(
|
||||||
zulip_update_announcements_help_url="/help/configure-automated-notices#zulip-update-announcements",
|
zulip_update_announcements_help_url="/help/configure-automated-notices#zulip-update-announcements",
|
||||||
mute_topic_help_url="/help/mute-a-topic",
|
mute_topic_help_url="/help/mute-a-topic",
|
||||||
)
|
)
|
||||||
|
|
||||||
welcome_messages: List[Dict[str, str]] = []
|
welcome_messages: List[Dict[str, str]] = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue