diff --git a/src/app_service/service/language/service.nim b/src/app_service/service/language/service.nim index 18e5f86f5e..8413924503 100644 --- a/src/app_service/service/language/service.nim +++ b/src/app_service/service/language/service.nim @@ -28,7 +28,7 @@ proc delete*(self: Service) = proc newService*(events: EventEmitter): Service = result = Service() result.events = events - result.shouldRetranslate = false #not defined(linux) + result.shouldRetranslate = false proc obtainLanguages(dir: string): seq[string] = let localeRe = re".*qml_(.*).qm" diff --git a/ui/app/AppLayouts/Profile/views/LanguageView.qml b/ui/app/AppLayouts/Profile/views/LanguageView.qml index 36a5352e07..a37a86ebf7 100644 --- a/ui/app/AppLayouts/Profile/views/LanguageView.qml +++ b/ui/app/AppLayouts/Profile/views/LanguageView.qml @@ -39,7 +39,7 @@ SettingsContentBase { function changeLanguage(key) { languagePicker.newKey = key - languagePause.start() + Qt.callLater(root.languageStore.changeLanguage, languagePicker.newKey) } ColumnLayout { @@ -105,14 +105,6 @@ SettingsContentBase { return "" } - Timer { - id: languagePause - interval: 100 - onTriggered: { - // changeLanguage function operation blocks a little bit the UI so getting around it with a small pause (timer) in order to get the desired visual behavior - root.languageStore.changeLanguage(languagePicker.newKey) - } - } objectName: "languagePicker" inputList: SortFilterProxyModel { sourceModel: root.languageStore.languageModel @@ -154,18 +146,9 @@ SettingsContentBase { onItemPickerChanged: { if(selected && root.languageStore.currentLanguage !== key) { - // IMPORTANT: Workaround to temporary resolve the crash we have when language is changed (`startupModule` is null and some qml bindings are still calling this dead pointer) so, change language will not retranslate - // and instead, also on mac and win, the app will quit to apply the new language - // TEMPORARY: It should be removed as it is only used in Linux OS but it must be investigated how to change language in execution time, as well, in Linux (will be addressed in another task) - //if (Qt.platform.os === Constants.linux) { - root.changeLanguage(key) - linuxConfirmationDialog.active = true - linuxConfirmationDialog.item.open() - // } - - //else { - // root.changeLanguage(key) - //} + root.changeLanguage(key) + languageConfirmationDialog.active = true + languageConfirmationDialog.item.open() } } } @@ -206,16 +189,15 @@ SettingsContentBase { } } - // TEMPORARY: It should be removed as it is only used in Linux OS but it must be investigated how to change language in execution time, as well, in Linux (will be addressed in another task) Loader { - id: linuxConfirmationDialog + id: languageConfirmationDialog active: false sourceComponent: ConfirmationDialog { header.title: qsTr("Change language") confirmationText: qsTr("Display language has been changed. You must restart the application for changes to take effect.") confirmButtonLabel: qsTr("Close the app now") onConfirmButtonClicked: { - linuxConfirmationDialog.active = false + languageConfirmationDialog.active = false Qt.quit() } } diff --git a/vendor/DOtherSide/lib/src/DOtherSide.cpp b/vendor/DOtherSide/lib/src/DOtherSide.cpp index 5dfd208dbb..a087687798 100644 --- a/vendor/DOtherSide/lib/src/DOtherSide.cpp +++ b/vendor/DOtherSide/lib/src/DOtherSide.cpp @@ -439,7 +439,8 @@ void dos_qguiapplication_load_translation(::DosQQmlApplicationEngine *vptr, cons if (g_translator.load(translationPackage)) { bool success = QGuiApplication::installTranslator(&g_translator); auto engine = static_cast(vptr); - if (shouldRetranslate) engine->retranslate(); + if (engine && success && shouldRetranslate) + engine->retranslate(); } else { printf("Failed to load translation file %s\n", translationPackage); }