i18n: Pass language name with every response.

With a comment added by tabbott on live-update considerations.

See https://chat.zulip.org/#narrow/stream/9-issues/topic/FormatJS.20error.20in.20standalone.20pages/near/1168413 for context.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-04-23 16:32:32 -07:00
committed by Tim Abbott
parent 1229945add
commit cef2ecf004
5 changed files with 25 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
from typing import Any
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template.defaultfilters import pluralize, slugify
from django.urls import reverse
@@ -9,16 +8,17 @@ from django.utils.timesince import timesince
from jinja2 import Environment
from two_factor.templatetags.two_factor import device_action
from zerver.context_processors import DEFAULT_PAGE_PARAMS
from zerver.templatetags.app_filters import display_list, render_markdown_path, webpack_entry
def environment(**options: Any) -> Environment:
env = Environment(**options)
env.globals.update(
default_page_params={
"debug_mode": settings.DEBUG,
"webpack_public_path": staticfiles_storage.url(settings.WEBPACK_BUNDLES),
},
# default_page_params is provided here for responses where
# zulip_default_context is not run, including the 404.html and
# 500.html error pages.
default_page_params=DEFAULT_PAGE_PARAMS,
static=staticfiles_storage.url,
url=reverse,
render_markdown_path=render_markdown_path,