Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

docs: Add comment links to i18n documentation.

Tim Abbott9c0d6becc55d
diff --git a/static/js/i18n.js b/static/js/i18n.js
index 5458fb8ccc0..d6be253caf3 100644
--- a/static/js/i18n.js
+++ b/static/js/i18n.js
@@ -1,3 +1,6 @@
+// For documentation on i18n in Zulip, see:
+// https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+
import i18next from "i18next";
i18next.init({
diff --git a/tools/i18n/push-translations b/tools/i18n/push-translations
index 70df40deca6..296a4f75ff5 100755
--- a/tools/i18n/push-translations
+++ b/tools/i18n/push-translations
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
+# See https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+# for background on this subsystem.
+
set -e
set -x
diff --git a/tools/i18n/sync-translations b/tools/i18n/sync-translations
index cae2a9caf02..7b5b2529f4b 100755
--- a/tools/i18n/sync-translations
+++ b/tools/i18n/sync-translations
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
+# See https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+# for background on this subsystem.
+
set -e
set -x
diff --git a/zerver/lib/i18n.py b/zerver/lib/i18n.py
index 8587733915d..9e3aa00e989 100644
--- a/zerver/lib/i18n.py
+++ b/zerver/lib/i18n.py
@@ -1,3 +1,5 @@
+# See https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+
import logging
import operator
import os
diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py
index 76049d95375..22120dec97e 100644
--- a/zerver/lib/send_email.py
+++ b/zerver/lib/send_email.py
@@ -99,6 +99,16 @@ def build_email(template_prefix: str, to_user_ids: Optional[List[int]]=None,
html_message = loader.render_to_string(compiled_template_prefix + '.html', context)
return (html_message, message, email_subject)
+ # The i18n story for emails is a bit complicated. For emails
+ # going to a single user, we want to use the language that user
+ # has configured for their Zulip account. For emails going to
+ # multiple users or to email addresses without a known Zulip
+ # account (E.g. invitations), we want to use the default language
+ # configured for the Zulip organization.
+ #
+ # See our i18n documentation for some high-level details:
+ # https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+
if not language and to_user_ids is not None:
language = to_users[0].default_language
if language:
diff --git a/zerver/management/commands/makemessages.py b/zerver/management/commands/makemessages.py
index 53d345dbfd5..fb0aea8d228 100644
--- a/zerver/management/commands/makemessages.py
+++ b/zerver/management/commands/makemessages.py
@@ -1,4 +1,7 @@
"""
+See https://zulip.readthedocs.io/en/latest/translating/internationalization.html
+for background.
+
The contents of this file are taken from
https://github.com/niwinz/django-jinja/blob/master/django_jinja/management/commands/makemessages.py