Persisting the preferred language in the documenation

Improving user experience when navigating through the documentation.
current behavior: default to javascript
Persisting the selected language in the documentation instead of reselecting the language every time a page refreshes.

The selected language is already persisted for navigating through the documentation. I can set it to Scala or Go, for example, on one page, and then all subsequent navigation specifies that language.

Can you share what browser you are using?

image

2 Likes

I had checked the cookies before I posted, and couldn’t find the key! but it is in the localStorage. I still have an issue though, I changed it from javascript to shell it seems to be set back to javascript, every time I refresh the page. is it from my side?

Hmmm that is pretty strange. I’m sorry it’s not working for you, but it sounds like it could be something on your side. What browser are you using? Do you have some aggressive privacy settings that are clearing local storage?

In addition to the browser and version, can you list the extensions/plugins that you are running? Are you potentially using an incognito/private browser window?

JavaScript is, indeed, the default language. If the language preference cannot be read from localStorage, which is the case for the first visit to the documentation, then JavaScript examples are displayed.

I am using Sidekick (chromium-based) | version 96.15.0.15333.
I tried with an incognito window, I changed the language from the doc, while the DevTools is open, the selected-language key has changed, but when navigating to another page, it reset back to the default language (js).
@ewan Do you still need the extensions list even if it not working in incognito mode?

I’ve just tried Sidekick, Version 96.15.1.15887.

In a regular window, the selected language persists across page loads.

When I open an incognito window, I see this:

Screen Shot 2022-02-14 at 3.36.36 PM

Which, to me, says that you should not expect cookies and site data to be saved.

Still, when I choose a language, in this case Python, navigating to other pages in the documentation did persist the language selection.

Do you perhaps have a lot of tabs open? I don’t know how Sidekick deals with memory pressure, so that might be one way that the chosen language might not be remembered.

Since I can’t repro the problem with just Sidekick installed, the issue must be due to an installed extension/plugin, available memory on your system, or some other environment condition.

If you can list the extensions/plugins that you have installed, I can try installing those locally to attempt to repro the problem.

It might also be good for you to determine whether the problem exists for you in other browsers.

I do not want to bother you with all the extensions I have, so I disabled all the extensions list and tried in a regular window. I tried also other browsers like Chrome Canary and Firefox. but did not work!

The key in the localStorage is not removed it exists. but it resets back to default when a page refreshes as I mentioned before and setting back the selected-language key to default is probably not due to an extension!
Do you need the extensions list anyway?

I tried also other browsers like Chrome Canary and Firefox. but did not work!

That is odd. Are there any errors listed in your browser’s development console?

Do you need the extensions list anyway?

No. But if it turns out that you have an extension installed that is interfering with the reading/writing of localStorage, I can’t help you.