commit 04571d3b20dbb74309c726478bc56ba310063e70
parent d062548e411b4ed60ea68428684c8cea7a40a759
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 28 Nov 2018 13:05:42 +0100
Merge pull request #4724 from un1t/master
use system language by default
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
@@ -87,7 +87,7 @@ class ElectrumGui(PrintError):
@profiler
def __init__(self, config, daemon, plugins):
- set_language(config.get('language'))
+ set_language(config.get('language', get_default_language()))
# Uncomment this call to verify objects are being properly
# GC-ed when windows are closed
#network.add_jobs([DebugMem([Abstract_Wallet, SPV, Synchronizer,
diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py
@@ -10,7 +10,7 @@ from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
-from electrum.i18n import _
+from electrum.i18n import _, languages
from electrum.util import FileImportFailed, FileExportFailed
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_EXPIRED
@@ -817,6 +817,11 @@ class IconCache:
return self.__cache[file_name]
+def get_default_language():
+ name = QLocale.system().name()
+ return name if name in languages else 'en_UK'
+
+
if __name__ == "__main__":
app = QApplication([])
t = WaitingDialog(None, 'testing ...', lambda: [time.sleep(1)], lambda x: QMessageBox.information(None, 'done', "done"))