mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
use system language by default
This commit is contained in:
parent
adc91eb75e
commit
d840804818
2 changed files with 9 additions and 2 deletions
|
@ -38,7 +38,7 @@ from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
import PyQt5.QtCore as QtCore
|
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.plugin import run_hook
|
||||||
from electrum.storage import WalletStorage
|
from electrum.storage import WalletStorage
|
||||||
from electrum.base_wizard import GoBack
|
from electrum.base_wizard import GoBack
|
||||||
|
@ -89,7 +89,7 @@ class QNetworkUpdatedSignalObject(QObject):
|
||||||
class ElectrumGui(PrintError):
|
class ElectrumGui(PrintError):
|
||||||
|
|
||||||
def __init__(self, config, daemon, plugins):
|
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
|
# Uncomment this call to verify objects are being properly
|
||||||
# GC-ed when windows are closed
|
# GC-ed when windows are closed
|
||||||
#network.add_jobs([DebugMem([Abstract_Wallet, SPV, Synchronizer,
|
#network.add_jobs([DebugMem([Abstract_Wallet, SPV, Synchronizer,
|
||||||
|
|
|
@ -26,6 +26,8 @@ import os
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
|
from PyQt5.QtCore import QLocale
|
||||||
|
|
||||||
LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale')
|
LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale')
|
||||||
language = gettext.translation('electrum', LOCALE_DIR, fallback=True)
|
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])
|
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 = {
|
languages = {
|
||||||
'': _('Default'),
|
'': _('Default'),
|
||||||
'ar_SA': _('Arabic'),
|
'ar_SA': _('Arabic'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue