Repository: biolab/orange3

Issue:
Data Sets doesn't remember non-English selection
According to @BlazZupan, if one chooses a Slovenian dataset (in English version of Orange?) and saves the workflow, this data set is not selected after reloading the workflow.

I suspect the problem occurs because the language combo is not a setting and is always reset to English for English Orange (and to Slovenian for Slovenian), and thus the data set is not chosen because it is not shown.

The easiest solution would be to save the language as a schema-only setting.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owdatasets.py b/Orange/widgets/data/owdatasets.py
--- a/Orange/widgets/data/owdatasets.py
+++ b/Orange/widgets/data/owdatasets.py
@@ -204,6 +204,7 @@ class Outputs:
 
     #: Selected dataset id
     selected_id = settings.Setting(None)   # type: Optional[str]
+    language = settings.Setting(DEFAULT_LANG)
 
     #: main area splitter state
     splitter_state = settings.Setting(b'')  # type: bytes
@@ -236,7 +237,11 @@ def __init__(self):
         layout.addSpacing(20)
         layout.addWidget(QLabel("Show data sets in "))
         lang_combo = self.language_combo = QComboBox()
-        lang_combo.addItems([self.DEFAULT_LANG, self.ALL_LANGUAGES])
+        languages = [self.DEFAULT_LANG, self.ALL_LANGUAGES]
+        if self.language is not None and self.language not in languages:
+            languages.insert(1, self.language)
+        lang_combo.addItems(languages)
+        lang_combo.setCurrentText(self.language)
         lang_combo.activated.connect(self._on_language_changed)
         layout.addWidget(lang_combo)
         self.mainArea.layout().addLayout(layout)
@@ -353,7 +358,10 @@ def update_language_combo(self):
         combo = self.language_combo
         current_language = combo.currentText()
         allkeys = set(self.allinfo_local) | set(self.allinfo_remote)
-        languages = sorted({self._parse_info(key).language for key in allkeys})
+        languages = {self._parse_info(key).language for key in allkeys}
+        if self.language is not None:
+            languages.add(self.language)
+        languages = sorted(languages)
         combo.clear()
         if self.DEFAULT_LANG not in languages:
             combo.addItem(self.DEFAULT_LANG)
@@ -408,10 +416,10 @@ def update_model(self):
     def _on_language_changed(self):
         combo = self.language_combo
         if combo.currentIndex() == combo.count() - 1:
-            language = None
+            self.language = None
         else:
-            language = combo.currentText()
-        self.view.model().setLanguage(language)
+            self.language = combo.currentText()
+        self.view.model().setLanguage(self.language)
 
     @Slot(object)
     def __set_index(self, f):


Test patch:
diff --git a/Orange/widgets/data/tests/test_owdatasets.py b/Orange/widgets/data/tests/test_owdatasets.py
--- a/Orange/widgets/data/tests/test_owdatasets.py
+++ b/Orange/widgets/data/tests/test_owdatasets.py
@@ -62,6 +62,27 @@ def test_filtering(self):
         model.setLanguage(None)
         self.assertEqual(model.rowCount(), 2)
 
+    @patch("Orange.widgets.data.owdatasets.list_remote",
+           Mock(return_value={('core', 'foo.tab'): {"language": "English"},
+                              ('core', 'bar.tab'): {"language": "Slovenščina"}}))
+    @patch("Orange.widgets.data.owdatasets.list_local",
+           Mock(return_value={}))
+    def test_remember_language(self):
+        w = self.create_widget(OWDataSets)  # type: OWDataSets
+        self.wait_until_stop_blocking(w)
+        w.language_combo.setCurrentText("Slovenščina")
+        w.language_combo.activated.emit(w.language_combo.currentIndex())
+        settings = w.settingsHandler.pack_data(w)
+
+        w2 = self.create_widget(OWDataSets, stored_settings=settings)
+        self.wait_until_stop_blocking(w2)
+        self.assertEqual(w2.language_combo.currentText(), "Slovenščina")
+
+        settings["language"] = "Klingon"
+        w2 = self.create_widget(OWDataSets, stored_settings=settings)
+        self.wait_until_stop_blocking(w2)
+        self.assertEqual(w2.language_combo.currentText(), "Klingon")
+
     @patch("Orange.widgets.data.owdatasets.list_remote",
            Mock(return_value={('core', 'iris.tab'): {}}))
     @patch("Orange.widgets.data.owdatasets.list_local",