- fixed an issue created by the fact that I used the '_' char inside the app to designate unused info and that conflicted with the _() function used by gettext

- made impossible to try to reapply current language that it's already applied (un-necessary)
This commit is contained in:
Marius Stanciu
2019-03-11 00:41:49 +02:00
parent 3c2cc96b62
commit f51c146f71
3 changed files with 22 additions and 15 deletions

View File

@@ -60,11 +60,17 @@ def on_language_apply_click(app, restart=False):
"""
name = app.ui.general_defaults_form.general_app_group.language_cb.currentText()
# do nothing if trying to apply the language that is the current language (already applied).
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("language"):
current_language = settings.value('language', type=str)
if current_language == name:
return
if restart:
msgbox = QtWidgets.QMessageBox()
msgbox.setInformativeText("Are you sure do you want to change the current language to %s?\n\n"
"The application will restart." % name.capitalize())
msgbox.setText("The application will restart.")
msgbox.setInformativeText("Are you sure do you want to change the current language to %s?" % name.capitalize())
msgbox.setWindowTitle("Apply Language ...")
msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
@@ -83,7 +89,6 @@ def on_language_apply_click(app, restart=False):
restart_program(app=app)
def apply_language(domain, lang=None):
lang_code = ''