diff --git a/lisp/default.json b/lisp/default.json index 40e30f937..40e7e0407 100644 --- a/lisp/default.json +++ b/lisp/default.json @@ -10,7 +10,7 @@ "theme": "Dark", "icons": "numix" }, - "language": "en", + "locale": "", "session": { "minSave": true }, diff --git a/lisp/main.py b/lisp/main.py index ea086c503..ff8fe12d6 100644 --- a/lisp/main.py +++ b/lisp/main.py @@ -117,8 +117,9 @@ def main(): if locale: QLocale().setDefault(QLocale(locale)) else: - locale = app_conf["language"] - QLocale().setDefault(QLocale(locale)) + locale = app_conf["locale"] + if locale != "": + QLocale().setDefault(QLocale(locale)) logging.info( 'Using "{}" locale -> {}'.format( diff --git a/lisp/ui/settings/app_pages/general.py b/lisp/ui/settings/app_pages/general.py index 5efdf68b2..9457c46c4 100644 --- a/lisp/ui/settings/app_pages/general.py +++ b/lisp/ui/settings/app_pages/general.py @@ -30,14 +30,6 @@ from lisp.ui.settings.pages import SettingsPage from lisp.ui.themes import themes_names from lisp.ui.ui_utils import translate -import os -import re - -try: - from os import scandir, getcwd -except ImportError: - from scandir import scandir - class AppGeneral(SettingsPage): Name = QT_TRANSLATE_NOOP("SettingsPageName", "General") @@ -45,10 +37,19 @@ class AppGeneral(SettingsPage): def __init__(self, **kwargs): super().__init__(**kwargs) - languages = [] - for entry in scandir("lisp/i18n/ts/"): - if entry.is_dir(): - languages.append(entry.name[:2]) + self.locales = { + "cs" : "český", + "de" : "Deutsche", + "fr" : "Français", + "es" : "Español", + "en" : "English", + "it" : "Italiano", + "nl" : "Nederlands (Belgique)", + } + + self.languagesItem = [] + for loc in self.locales: + self.languagesItem.append(self.locales[loc]) self.setLayout(QVBoxLayout()) self.layout().setAlignment(Qt.AlignTop) @@ -84,7 +85,7 @@ def __init__(self, **kwargs): self.languagesLabel = QLabel(self.themeGroup) self.themeGroup.layout().addWidget(self.languagesLabel, 2, 0) self.languagesCombo = QComboBox(self.themeGroup) - self.languagesCombo.addItems(languages) + self.languagesCombo.addItems(self.languagesItem) self.themeGroup.layout().addWidget(self.languagesCombo, 2 ,1) self.iconsLabel = QLabel(self.themeGroup) @@ -117,7 +118,7 @@ def getSettings(self): "theme": self.themeCombo.currentText(), "icons": self.iconsCombo.currentText(), }, - "language": self.languagesCombo.currentText(), + "locale": list(self.locales.keys())[list(self.locales.values()).index(self.languagesCombo.currentText())], "layout": {}, } @@ -139,4 +140,4 @@ def loadSettings(self, settings): self.themeCombo.setCurrentText(settings["theme"]["theme"]) self.iconsCombo.setCurrentText(settings["theme"]["icons"]) - self.languagesCombo.setCurrentText(settings["language"]) + self.languagesCombo.setCurrentText(self.locales[settings["locale"]])