From a2ed95340ce941acb4cc6f9181c78637dcbdc61a Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 1 Apr 2021 04:36:02 +0200 Subject: [PATCH] locale/i18n: set language as early as possible related: #7158 related: #4621 --- run_electrum | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/run_electrum b/run_electrum index 03f56d22a..beef12d2e 100755 --- a/run_electrum +++ b/run_electrum @@ -91,6 +91,7 @@ from electrum.commands import get_parser, known_commands, Commands, config_varia from electrum import daemon from electrum import keystore from electrum.util import create_and_start_event_loop +from electrum.i18n import set_language if TYPE_CHECKING: import threading @@ -349,6 +350,14 @@ def main(): config = SimpleConfig(config_options) + # set language as early as possible + # Note: we are already too late for strings that are declared in the global scope + # of an already imported module. However, the GUI and the plugins at least have + # not been imported yet. + # Note: it is ok to call set_language() again later. E.g. the Qt GUI has additional + # tools to figure out the default language so it will get called again there. + set_language(config.get('language')) + if config.get('testnet'): constants.set_testnet() elif config.get('regtest'):