未登録ユーザーの言語変更

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.

ゲストが「ゲスト言語切り替え」を使用して言語を設定できるようになったことに注意してください。詳細は Multilingual Plugin 🌐 をご覧ください。

メニューまたはフッター

または

これに関連するキャッシュの問題を確認されましたか?この問題は、CDNを使用しているサイトでのみ影響を及ぼす可能性があります。

はい、キャッシュについてはかなり検討しました。100% 完璧ではないかもしれませんが、実現可能だと考えています。

はい、あるいはゲストがブラウザとは異なるロケールを使用したい場合です。例えば、図書館、学校、その他の共有コンピューターを使用している場合や、本人が多言語対応している場合などが考えられます。

「Accept-Language ヘッダーからロケールを設定する」という設定は、ロケールスイッチャーが有効な場合でもデフォルトで機能します。ユーザーがスイッチャーで明示的に別のロケールを選択していない場合、その設定を通じて(可能であれば)ブラウザのロケールがデフォルトとして適用されます。

フルプラグインを使わずに言語スイッチャーだけを使うことはできますか?このプラグイン以外に方法があるでしょうか?