apertium / apertium-html-tools

Web application providing a fully localised interface for text/website/document translation, analysis and generation powered by Apertium.
http://wiki.apertium.org/wiki/Apertium-html-tools
GNU General Public License v3.0
41 stars 89 forks source link

Duplicate source languages in selector #461

Closed unhammer closed 1 year ago

unhammer commented 1 year ago

I think I broke it: bilde Not sure how.

Then I clicked ctrl+shift+R: bilde

and if I select nynorsk there:

bilde

sushain97 commented 1 year ago

Might be useful to publish your local storage for purposes of debugging.

unhammer commented 1 year ago
{
  "tgtLang": "\"nno\"",
  "generatorText": "\"\"",
  "instantTranslation": "true",
  "markUnknown": "true",
  "recentTgtLangs": "[\"nno\",\"dan\",\"eng\"]",
  "analyzerText": "\"\"",
  "translationChaining": "false",
  "srcLang": "\"nob\"",
  "translationPrefs": "{\"nob-nno\":{\"ggj_gg\":true,\"medan_mens\":true,\"kløyvd_inf\":false,\"infa_infe\":true,\"løk_lauk\":true,\"røyndom_røynd\":false,\"røyndom_verkelegheit\":true,\"de_dokker\":true}}",
  "srcText": "\"Se. \\nVindu. \\nFestet.\\nSamtaler.\\n\\n\"",
  "recentSrcLangs": "[\"nob\",\"nno\",\"nno\"]",
  "locale": "\"nno\"",
  "generatorLang": "\"ady\"",
  "analyzerLang": "\"oci_gascon\""
}
sushain97 commented 1 year ago

Huh, I see why the UI would behave this way with the given local storage. I'm not sure how you ended up with that config, though...

unhammer commented 1 year ago

would the state be cleaned by a uniq on the recentSrcLangs list?

sushain97 commented 1 year ago

https://github.com/apertium/apertium-html-tools/commit/3470f11fc7c15ee273981cb445495324d9c9b673 should fix it.

Although, I'm still confused as to how this happened since this should prevent it: https://github.com/apertium/apertium-html-tools/blob/3470f11fc7c15ee273981cb445495324d9c9b673/src/components/translator/Translator.tsx#L118

unhammer commented 1 year ago

Thanks! Yeah I have no idea :-/