1
0

locale/i18n: get default language and set it as early as possible

TODO elaborate xxxxx
This commit is contained in:
SomberNight
2023-05-05 17:00:18 +00:00
parent 9c47144418
commit a0c43573ab
7 changed files with 63 additions and 41 deletions

View File

@@ -65,7 +65,7 @@ from electrum.logging import Logger
from electrum.gui import BaseElectrumGui
from .installwizard import InstallWizard, WalletAlreadyOpenInMemory
from .util import get_default_language, read_QIcon, ColorScheme, custom_message_box, MessageBoxMixin
from .util import read_QIcon, ColorScheme, custom_message_box, MessageBoxMixin
from .main_window import ElectrumWindow
from .network_dialog import NetworkDialog
from .stylesheet_patcher import patch_qt_stylesheet
@@ -111,7 +111,6 @@ class ElectrumGui(BaseElectrumGui, Logger):
@profiler
def __init__(self, *, config: 'SimpleConfig', daemon: 'Daemon', plugins: 'Plugins'):
set_language(config.get('language', get_default_language()))
BaseElectrumGui.__init__(self, config=config, daemon=daemon, plugins=plugins)
Logger.__init__(self)
self.logger.info(f"Qt GUI starting up... Qt={QtCore.QT_VERSION_STR}, PyQt={QtCore.PYQT_VERSION_STR}")

View File

@@ -1117,10 +1117,6 @@ class IconLabel(QWidget):
self.icon.setPixmap(icon.pixmap(self.icon_size))
self.icon.repaint() # macOS hack for #6269
def get_default_language():
name = QLocale.system().name()
return name if name in languages else 'en_UK'
def char_width_in_lineedit() -> int:
char_width = QFontMetrics(QLineEdit().font()).averageCharWidth()