Cambiamento della lingua per utenti non registrati

Hi,

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 ?

Thanks

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.

Hi Simon,

We aren’t using a CDN, indeed :slight_smile: I didn’t saw that switch. Its an experimental feature… is it still solid ?

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.

Nota che ora puoi anche consentire agli ospiti di impostare la propria lingua utilizzando il “Selettore lingua ospiti” in Multilingual Plugin 🌐.

Menu o piè di pagina

oppure

Hai esaminato eventuali problemi di caching in merito? Il problema riguarderebbe solo i siti che utilizzano una CDN.

Sì, ho analizzato il caching abbastanza a fondo. Non credo di averlo risolto al 100% ancora, ma penso sia possibile farlo.

Sì, oppure se l’ospite desidera utilizzare una lingua diversa da quella del browser. Ad esempio, sta usando un computer in una biblioteca, a scuola o in un altro computer condiviso, oppure è multilingue.

L’impostazione imposta lingua dall'intestazione Accept-Language funziona ancora di default con lo selettore di lingua abilitato. Se l’utente non ha fatto clic esplicitamente su un’altra lingua nel selettore, utilizzerà di default la lingua del browser tramite tale impostazione (se possibile).

Posso utilizzare solo l’interruttore delle lingue senza l’intero plugin? Forse esiste un’alternativa a questo plugin?