Don't retranslate if the language didn't change

This commit is contained in:
Cameron Gutman
2021-01-31 15:28:00 -06:00
parent 6a66b462ce
commit 149575e0c4
+7 -3
View File
@@ -769,9 +769,13 @@ Flickable {
} }
// ::onActivated must be used, as it only listens for when the index is changed by a human // ::onActivated must be used, as it only listens for when the index is changed by a human
onActivated : { onActivated : {
StreamingPreferences.language = languageListModel.get(currentIndex).val // Retranslating is expensive, so only do it if the language actually changed
if (!StreamingPreferences.retranslate()) { var new_language = languageListModel.get(currentIndex).val
ToolTip.show(qsTr("You must restart Moonlight for this change to take effect"), 5000) if (StreamingPreferences.language !== new_language) {
StreamingPreferences.language = languageListModel.get(currentIndex).val
if (!StreamingPreferences.retranslate()) {
ToolTip.show(qsTr("You must restart Moonlight for this change to take effect"), 5000)
}
} }
} }
} }