kivy: locale: also translate strings in core lib
This commit is contained in:
@@ -35,8 +35,8 @@ class _(str):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def switch_lang(lang):
|
def switch_lang(lang):
|
||||||
# get the right locales directory, and instanciate a gettext
|
# get the right locales directory, and instantiate a gettext
|
||||||
from electrum.i18n import LOCALE_DIR
|
from electrum.i18n import LOCALE_DIR, set_language
|
||||||
locales = gettext.translation('electrum', LOCALE_DIR, languages=[lang], fallback=True)
|
locales = gettext.translation('electrum', LOCALE_DIR, languages=[lang], fallback=True)
|
||||||
_.lang = locales.gettext
|
_.lang = locales.gettext
|
||||||
for label in _.observers:
|
for label in _.observers:
|
||||||
@@ -44,3 +44,7 @@ class _(str):
|
|||||||
label.text = _(label.text.source_text)
|
label.text = _(label.text.source_text)
|
||||||
except:
|
except:
|
||||||
pass
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user