From 22bb52d5df00165b92d108e16ebd41083b045fc0 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 15 Sep 2021 19:45:06 +0200 Subject: [PATCH] kivy: locale: also translate strings in core lib --- electrum/gui/kivy/i18n.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/electrum/gui/kivy/i18n.py b/electrum/gui/kivy/i18n.py index 733249d3e..74925ef0d 100644 --- a/electrum/gui/kivy/i18n.py +++ b/electrum/gui/kivy/i18n.py @@ -35,8 +35,8 @@ class _(str): @staticmethod def switch_lang(lang): - # get the right locales directory, and instanciate a gettext - from electrum.i18n import LOCALE_DIR + # get the right locales directory, and instantiate a gettext + from electrum.i18n import LOCALE_DIR, set_language locales = gettext.translation('electrum', LOCALE_DIR, languages=[lang], fallback=True) _.lang = locales.gettext for label in _.observers: @@ -44,3 +44,7 @@ class _(str): label.text = _(label.text.source_text) except: pass + # Note that all invocations of _() inside the core electrum library + # use electrum.i18n instead of electrum.gui.kivy.i18n, so we should update the + # language there as well: + set_language(lang)