Track strings even when failing to translate them

This commit is contained in:
Valentin Lorentz 2024-12-06 12:04:46 +01:00
parent de854f4e4f
commit e0ea443e89

View File

@ -264,14 +264,16 @@ class _PluginInternationalization:
This is the function which is called when a plugin runs _()""" This is the function which is called when a plugin runs _()"""
if untranslated.__class__ is InternationalizedString: if untranslated.__class__ is InternationalizedString:
untranslated = untranslated._original originalUntranslated = untranslated._original
else:
originalUntranslated = untranslated
normalizedUntranslated = normalize(untranslated, True) normalizedUntranslated = normalize(originalUntranslated, True)
try: try:
string = self._translate(normalizedUntranslated) string = self._translate(normalizedUntranslated)
return self._addTracker(string, untranslated)
except KeyError: except KeyError:
return untranslated string = untranslated
return self._addTracker(string, untranslated)
def _translate(self, string): def _translate(self, string):
"""Translate the string. """Translate the string.