[+] dedent

This commit is contained in:
Maxim Khomutov 2025-05-13 18:35:31 +03:00
parent 633c92608f
commit 774a1b0ce3

View File

@ -1,4 +1,5 @@
import builtins import builtins
import textwrap
from collections import defaultdict from collections import defaultdict
import json5 import json5
@ -115,7 +116,7 @@ class I18N:
:return: The phrase from the locale file. :return: The phrase from the locale file.
""" """
# key: some.key.here # key: some.key.here
phrase = self._locale.get(key) phrase = textwrap.dedent(self._locale.get(key))
if not phrase: if not phrase:
return f"<{key.upper()}>" return f"<{key.upper()}>"
return phrase.format_map(defaultdict(lambda: '<unknown>', kwargs)) return phrase.format_map(defaultdict(lambda: '<unknown>', kwargs))