kivy: change language without restarting the app
This commit is contained in:
@@ -7,7 +7,7 @@ from decimal import Decimal
|
||||
|
||||
import electrum
|
||||
from electrum import WalletStorage, Wallet
|
||||
from electrum.i18n import _
|
||||
from electrum_gui.kivy.i18n import _
|
||||
from electrum.contacts import Contacts
|
||||
from electrum.paymentrequest import InvoiceStore
|
||||
from electrum.util import profiler, InvalidPassword
|
||||
@@ -64,6 +64,12 @@ class ElectrumWindow(App):
|
||||
|
||||
electrum_config = ObjectProperty(None)
|
||||
|
||||
language = StringProperty('en')
|
||||
|
||||
def on_language(self, instance, language):
|
||||
Logger.info('language: {}'.format(language))
|
||||
_.switch_lang(language)
|
||||
|
||||
def on_quotes(self, d):
|
||||
print "main_window: on_quotes"
|
||||
pass
|
||||
@@ -177,6 +183,7 @@ class ElectrumWindow(App):
|
||||
|
||||
title = _('Electrum App')
|
||||
self.electrum_config = config = kwargs.get('config', None)
|
||||
self.language = config.get('language', 'en')
|
||||
self.network = network = kwargs.get('network', None)
|
||||
self.plugins = kwargs.get('plugins', [])
|
||||
|
||||
@@ -447,7 +454,7 @@ class ElectrumWindow(App):
|
||||
else:
|
||||
c, u, x = self.wallet.get_account_balance(self.current_account)
|
||||
text = self.format_amount(c+x+u)
|
||||
self.status = text.strip() + ' ' + self.base_unit
|
||||
self.status = str(text.strip() + ' ' + self.base_unit)
|
||||
else:
|
||||
self.status = _("Not connected")
|
||||
|
||||
@@ -471,8 +478,6 @@ class ElectrumWindow(App):
|
||||
|
||||
@profiler
|
||||
def notify_transactions(self, *dt):
|
||||
'''
|
||||
'''
|
||||
if not self.network or not self.network.is_connected():
|
||||
return
|
||||
# temporarily disabled for merge
|
||||
|
||||
Reference in New Issue
Block a user