diff --git a/electrum/i18n.py b/electrum/i18n.py index 15310b614..a98ea1d39 100644 --- a/electrum/i18n.py +++ b/electrum/i18n.py @@ -30,6 +30,11 @@ LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale') language = gettext.translation('electrum', LOCALE_DIR, fallback=True) +# note: do not use old-style (%) formatting inside translations, +# as syntactically incorrectly translated strings would raise exceptions (see #3237). +# e.g. consider _("Connected to %d nodes.") % n +# >>> "Connecté aux noeuds" % n +# TypeError: not all arguments converted during string formatting # note: f-strings cannot be translated! see https://stackoverflow.com/q/49797658 # So this does not work: _(f"My name: {name}") # instead use .format: _("My name: {}").format(name)