Browse Source

move get_default_language to gui.qt.util

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

2
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, get_default_language
from electrum.i18n import _, set_language
from electrum.plugin import run_hook
from electrum.storage import WalletStorage
from electrum.base_wizard import GoBack

7
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
@ -812,6 +812,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"))

7
electrum/i18n.py

@ -26,8 +26,6 @@ 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)
@ -43,11 +41,6 @@ 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