Browse Source

use system language by default

3.3.3.1
Ilya Shalyapin 6 years ago
parent
commit
d840804818
  1. 4
      electrum/gui/qt/__init__.py
  2. 7
      electrum/i18n.py

4
electrum/gui/qt/__init__.py

@ -38,7 +38,7 @@ from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import PyQt5.QtCore as QtCore
from electrum.i18n import _, set_language
from electrum.i18n import _, set_language, get_default_language
from electrum.plugin import run_hook
from electrum.storage import WalletStorage
from electrum.base_wizard import GoBack
@ -89,7 +89,7 @@ class QNetworkUpdatedSignalObject(QObject):
class ElectrumGui(PrintError):
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,

7
electrum/i18n.py

@ -26,6 +26,8 @@ import os
import gettext
from PyQt5.QtCore import QLocale
LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale')
language = gettext.translation('electrum', LOCALE_DIR, fallback=True)
@ -41,6 +43,11 @@ def set_language(x):
language = gettext.translation('electrum', LOCALE_DIR, fallback=True, languages=[x])
def get_default_language():
system_locale = QLocale.system().name()
return languages.get(system_locale, 'en_UK')
languages = {
'': _('Default'),
'ar_SA': _('Arabic'),

Loading…
Cancel
Save