Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
onboarding: Internationalize the introductory messages in streams.
Hemant Umred27a50852ee5
diff --git a/zerver/lib/onboarding.py b/zerver/lib/onboarding.pyindex a5d6ded3761..96c6bfa75eb 100644--- a/zerver/lib/onboarding.py+++ b/zerver/lib/onboarding.py@@ -265,52 +265,53 @@ def send_initial_realm_messages(realm: Realm) -> None:# Make sure each stream created in the realm creation process has at least one message below# Order corresponds to the ordering of the streams on the left sidebar, to make the initial Home# view slightly less overwhelming- content_of_private_streams_topic = (- _("This is a private stream, as indicated by the lock icon next to the stream name.")- + " "- + _("Private streams are only visible to stream members.")- + "\n"- "\n"- + _(- "To manage this stream, go to [Stream settings]({stream_settings_url}) "- "and click on `{initial_private_stream_name}`."+ with override_language(realm.default_language):+ content_of_private_streams_topic = (+ _("This is a private stream, as indicated by the lock icon next to the stream name.")+ + " "+ + _("Private streams are only visible to stream members.")+ + "\n"+ "\n"+ + _(+ "To manage this stream, go to [Stream settings]({stream_settings_url}) "+ "and click on `{initial_private_stream_name}`."+ )+ ).format(+ stream_settings_url="#streams/subscribed",+ initial_private_stream_name=Realm.INITIAL_PRIVATE_STREAM_NAME,)- ).format(- stream_settings_url="#streams/subscribed",- initial_private_stream_name=Realm.INITIAL_PRIVATE_STREAM_NAME,- )- content1_of_topic_demonstration_topic = (- _(- "This is a message on stream #**{default_notification_stream_name}** with the "- "topic `topic demonstration`."- )- ).format(default_notification_stream_name=Realm.DEFAULT_NOTIFICATION_STREAM_NAME)+ content1_of_topic_demonstration_topic = (+ _(+ "This is a message on stream #**{default_notification_stream_name}** with the "+ "topic `topic demonstration`."+ )+ ).format(default_notification_stream_name=Realm.DEFAULT_NOTIFICATION_STREAM_NAME)- content2_of_topic_demonstration_topic = (- _("Topics are a lightweight tool to keep conversations organized.")- + " "- + _("You can learn more about topics at [Streams and topics]({about_topics_help_url}).")- ).format(about_topics_help_url="/help/streams-and-topics")+ content2_of_topic_demonstration_topic = (+ _("Topics are a lightweight tool to keep conversations organized.")+ + " "+ + _("You can learn more about topics at [Streams and topics]({about_topics_help_url}).")+ ).format(about_topics_help_url="/help/streams-and-topics")- content_of_swimming_turtles_topic = (- _(- "This is a message on stream #**{default_notification_stream_name}** with the "- "topic `swimming turtles`."+ content_of_swimming_turtles_topic = (+ _(+ "This is a message on stream #**{default_notification_stream_name}** with the "+ "topic `swimming turtles`."+ )+ + "\n"+ "\n"+ "[](/static/images/cute/turtle.png)"+ "\n"+ "\n"+ + _(+ "[Start a new topic]({start_topic_help_url}) any time you're not replying to a \+ previous message."+ )+ ).format(+ default_notification_stream_name=Realm.DEFAULT_NOTIFICATION_STREAM_NAME,+ start_topic_help_url="/help/starting-a-new-topic",)- + "\n"- "\n"- "[](/static/images/cute/turtle.png)"- "\n"- "\n"- + _(- "[Start a new topic]({start_topic_help_url}) any time you're not replying to a \- previous message."- )- ).format(- default_notification_stream_name=Realm.DEFAULT_NOTIFICATION_STREAM_NAME,- start_topic_help_url="/help/starting-a-new-topic",- )welcome_messages: List[Dict[str, str]] = [{diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex 5ab534e4f41..26ea864a36f 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1740,6 +1740,22 @@ class RealmCreationTest(ZulipTestCase):self.assertEqual(realm.string_id, string_id)self.assertEqual(realm.default_language, realm_language)+ # Check welcome messages+ with_the_topic_in_italian = "con l'argomento"+ private_stream_in_italian = "canale privato"++ for stream_name, text, message_count in [+ (Realm.DEFAULT_NOTIFICATION_STREAM_NAME, with_the_topic_in_italian, 3),+ (Realm.INITIAL_PRIVATE_STREAM_NAME, private_stream_in_italian, 1),+ ]:+ stream = get_stream(stream_name, realm)+ recipient = stream.recipient+ messages = Message.objects.filter(realm_id=realm.id, recipient=recipient).order_by(+ "date_sent"+ )+ self.assert_length(messages, message_count)+ self.assertIn(text, messages[0].content)+@override_settings(OPEN_REALM_CREATION=True, FREE_TRIAL_DAYS=30)def test_create_realm_during_free_trial(self) -> None:password = "test"