Skip to content

Commit

Permalink
Switch language upon clicking on language menu item
Browse files Browse the repository at this point in the history
I don't think the current system for storing the preferred language is a good one, but otherwise we'd have to implement putting drop-down preferences in Markdown, which is quite a hassle.
  • Loading branch information
Ghostkeeper committed Mar 16, 2020
1 parent 7a66cfb commit 700d32f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CuraSettingsGuide.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,13 @@ def language_list(self, article_key: str) -> List[str]:
"""
if article_key not in self.article_locations:
return [] # We have no articles about this setting at all.
return list(self.article_locations[article_key].keys())
return list(self.article_locations[article_key].keys())

@pyqtSlot(str)
def set_language(self, language_code: str) -> None:
"""
Changes the viewing language.
:param language_code: The new language code.
"""
self._selected_language = language_code
self.selectedArticleChanged.emit()
1 change: 1 addition & 0 deletions resources/qml/TranslationButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MouseArea {

MenuItem {
text: code_to_language(modelData.toString())
onTriggered: manager.set_language(modelData.toString())
}
onObjectAdded: languagesMenu.insertItem(index, object)
onObjectRemoved: languagesMenu.removeItem(object)
Expand Down

0 comments on commit 700d32f

Please sign in to comment.