Language change for user that aren't logged in

Hello everyone,

I built a mutli-language app that is working nicely but I now have a problem. My problem is that user that aren’t logged in can’t change the language because otherwise it can’t be saved what language they chose.

image
CaptureForum2

If anyone have ideas of how to solve my problems or what I am doing wrong I would be grateful for your help !

Thanks!

1 Like

If I understand what you’re asking correctly (i.e. how to save language settings regardless of whether a user has an account or not, and is logged in), then the best bet is going to be using a cookie to store the settings on the user’s browser.

As you’re using an option set for your language options, you can simply store the ‘Display’ attribute of the selected language in a cookie, then retrieve it on pageload by getting all options and filtering it by the Display attribute.

There are several plugins available for setting and reading cookies, or you can use standard JavaScript or a library like js-cookie