Some of our customers want to be able to visit our discourse in their language (we are in Switzerland, we have to play with french, german, italian and english). Thse customers are not / don’t want to register. How could we add a way for them to change language of Discourse?
I could see a dropdown menu listing some languages in the header. Is there already a plugin, of some code I could use ?
If your site is not using a CDN to deliver assets, you could try enabling the set locale from accept language header SIte Setting. When enabled, this setting will set the locale for non-logged-in users from the language preferences they have set on their web browser. For the setting to work, you also need to enable the allow user locale Site Setting.
Yes. As long as you are not using a CDN, it should reliably set the locale for anonymous users to their web browser’s locale. How well it works for your users will depend on whether or not they have configured their web browsers to use their preferred language. You could try enabling the setting and then asking users about how well it’s working for them.
Yes, I’ve looked at the caching a fair bit. I don’t think I’ve got it 100% right yet, but I do think it’s possible (to get it right).
Yes, or if the guest wants to use a locale different from their browser. For example they’re using a computer at a library, or school, or some other shared computer, or they themselves are multilingual.
The set locale from accept language header setting still works by default with the locale switcher enabled. If the user hasn’t explicitly clicked on another locale in the switcher, it will default to their browser locale via that setting (if possible).