Skip to content

Commit

Permalink
Fix mozilla#10780: Add back Markup to gettext no-op
Browse files Browse the repository at this point in the history
  • Loading branch information
robhudson committed Nov 17, 2021
1 parent f5c98cf commit 4d1e873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/l10n_utils/dotlang.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
cache = caches["l10n"]


def translate(text, files):
def translate(text, files=None):
"""
An almost no-op to avoid triggering the old l10n machinery.
"""
Expand All @@ -30,6 +30,9 @@ def gettext(text, *args, **kwargs):
"""
An almost no-op to avoid triggering the old l10n machinery.
"""
text = translate(text)
if args:
text = text % args
return text


Expand Down
3 changes: 2 additions & 1 deletion lib/l10n_utils/templatetags/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from babel.numbers import format_number
from django_jinja import library

from lib.l10n_utils.dotlang import translate
from lib.l10n_utils.translation import get_language

babel_format_locale_map = {
Expand All @@ -25,7 +26,7 @@ def gettext(ctx, text):
Once we remove all uses of `_(...)` in templates this can be removed.
"""
return text
return translate(text)


# backward compatible for imports
Expand Down

0 comments on commit 4d1e873

Please sign in to comment.