Actually fix the context translation issue

This commit is contained in:
Frisk 2021-05-22 21:42:09 +02:00
parent 224ca73fef
commit 6e985be8be
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -22,7 +22,10 @@ logger = logging.getLogger("rcgcdw.i18n")
def python37_pgettext_backward_compatibility(context: str, string: str): def python37_pgettext_backward_compatibility(context: str, string: str):
"""Creates backward compatibility with Python 3.7 as pgettext has been introduced only in Python 3.8""" """Creates backward compatibility with Python 3.7 as pgettext has been introduced only in Python 3.8"""
return formatters_i18n.gettext(string) translation = formatters_i18n.gettext("{}\x04{}".format(context, string))
if "\x04" in translation: # gettext returned same message
return string
return translation
try: try:
if settings["lang"] != "en": if settings["lang"] != "en":