compilemessages: Switch to canonical override_language().

This commit is contained in:
Alex Vandiver
2020-09-01 14:16:00 -07:00
committed by Tim Abbott
parent 536bd3188e
commit 812af977d3
2 changed files with 4 additions and 16 deletions

View File

@@ -10,10 +10,10 @@ from django.conf import settings
from django.conf.locale import LANG_INFO
from django.core.management.base import CommandParser
from django.core.management.commands import compilemessages
from django.utils.translation import override as override_language
from django.utils.translation import ugettext as _
from django.utils.translation.trans_real import to_language
from zerver.lib.i18n import with_language
class Command(compilemessages.Command):
@@ -127,7 +127,8 @@ class Command(compilemessages.Command):
# Fallback to getting the name from PO file.
filename = self.get_po_filename(locale_path, locale)
name = self.get_name_from_po_file(filename, locale)
name_local = with_language(name, code)
with override_language(code):
name_local = _(name)
info['name'] = name
info['name_local'] = name_local