[Bug] Error message in console due to rewritten language selection
URL https://jamulus.io
Describe the bug https://github.com/jamulussoftware/jamuluswebsite/blob/2c40eecf03baab55a8cf4a6bbd09a73acf68db6e/_includes/footer.html#L27-L41 does not find suglang as the respective code has been removed (if we use the "new" language selector)
We should have a way to still mark suggested languages somehow.
@ignotus666
@ann0see Ok, I'll look into it. Should it display a message (to the left of the langselect dropdown maybe)?
Best case would be a thing which can be clicked that sets the correct language
I think I recall that language suggestion message as being very annoying visually, which is why I proposed removing it here - and as no one was opposed, that's what I did, replacing it with auto-detection of browser language, which was later rejected. If we do bring back the message, it should be possible to dismiss it, or if clicked on, the preference is saved for future visits (instead of having to click on it every time) but this entails saving data to the user's PC and I'm not sure we want that.
but this entails saving data to the user's PC and I'm not sure we want that.
I think if we use something like local storage it is acceptable - as long as it can't be used for tracking.
The user should have an easy way to select the detected language but not be forced to use this language.
Ok cool, I'll see what I can do.
Here's a suggestion:
It just stores a langSuggestionHandled flag. Clicking on either button makes the message go away.
This would need translating, mind - the message is in /wiki/en/misc/general.yml.
but this entails saving data to the user's PC and I'm not sure we want that.
I think if we use something like local storage it is acceptable - as long as it can't be used for tracking.
A simple permanent cookie is better than local storage. More people will have local storage disabled, who're worried about such things. (Cookies are more compatible, too.)
Local storage is more modern and easier to handle. But it doesn't matter - as long as we clearly state it in the privacy policy
Ok, well, I'll use whatever you guys agree is best. Any thoughts about the styling, colours, wording, position, etc? E.g. I think "Apply" would be better than "Activate", and maybe just a button with an "X" instead of dismiss, to keep it short.
When a user chooses to apply a suggested language or clicks on dismiss, a local storage flag or cookie is stored that tells the site not to show the suggestion message again on future visits. Say they choose to display it in Italian. The next time they visit, I assume we want to display the site in Italian automatically, don't we? If so, the language preference also has to be stored. Maybe that was a given but it just dawned on me... and I want to make sure. Because otherwise, on future visits, the flag/cookie will prevent the message from being displayed even if the site is in English, thus defeating its purpose.
The flag is "I've arrived, I have no set language". Separately, there's the site language. At this point, it should be undefined until it sees no language is chosen and selects the site default language (presumably we define that somewhere). Nothing gets stored in the browser at this point.
Because the "I've arrived, I have no set language" flag is active, the indicator highlighting the ability to choose an language is activated.
Now, nothing's stored. We're running off the defaults. If the user leaves without changing anything, next time they visit, the experience should be identical because we're not stored any state in their browser.
(Cookies are good because some browsers sync cookies between devices. Local storage is explicitly not intended to be synced, so each device would need to go through this, which detracts from the user experience.)
Next time they visit, they decide that Polish would be more comfortable for long term use, so they select Polish.
At this point, we know what their language choice is, so we can put that in a cookie/whatever. We can also remove the highlight indicator.
But we now have the stored language. We know that we didn't fail to get a stored language next time they turn up, so don't need to use the default. We also know we don't need to highlight the language choice.
In fact, we knew that without needing an additional indicator -- simply storing an actively set language choice, rather than failing to find one, means there's no need to highlight the language choice.
So go back to the top and replace "I've arrived, I have no set language" with "the look up of the user language choice failed" and use that as the flag to activate the language choice highlight.
Does that make sense?
Does that make sense?
I think so - by just storing a language preference we're telling the site to use that language and not to display the suglang message, so no need for the separate "I've made my choice" flag. But what about if they dismiss the message because they don't want to see it in future and prefer the default (English)? This could easily be a common choice when the translation is incomplete in their language.
But what about if they dismiss the message because they don't want to see it in future and prefer the default (English)?
Make the "Dismiss" say "Use (<site default>)"?