# Is there a way to SET default Language based on Browser Settings?

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032>\
**Category:** Product Support\
**Created:** [May 11, 2020, 10:48am UTC](https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032 "2020-05-11T10:48:58Z")\
**Posts on this page:** 4\
**Page:** 1

## AI-generated summary

The discussion revolves around setting a default language for Discourse sites based on the user’s browser settings, applicable to both registered and non-registered users. [hhlp](/t/-/151032/1) inquires whether this is possible, noting their browser (Firefox or Chrome) is set to Spanish while the site defaults to English. [osioke](/t/-/151032/2) explains that Discourse can automatically set the locale for anonymous and newly registered users based on the browser’s Accept-Language header — but only if the site setting “set locale from accept language header” is enabled. However, this feature may cause incorrect locale display for non-logged-in users if “login required” is disabled, due to caching for performance. Users can always manually change their language in preferences. [riking](/t/-/151032/4) adds that the “set locale from accept language header” setting is no longer experimental and has been stabilized via [GitHub PR #10289](https://github.com/discourse/discourse/pull/10289).

<div class="post-metadata">

**Author:** ![hhlp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hhlp/32/124988_2.png) [@hhlp](https://meta.discourse.org/u/hhlp)\
**Post date:** [May 11, 2020, 10:48am UTC](https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032/1 "2020-05-11T10:48:58Z")

</div>

Is there a way to SET default Language based on Browser Settings? for register and non-register Users

is the default settings of the SITE is English and I’m in FF or Chrome with Spanish…

> [@Is there any way to let language selector display 'English' instead of 'en'?](https://meta.discourse.org/t/is-there-any-way-to-let-language-selector-display-english-instead-of-en/14518/6):
>
> This is now complete in the admin section. Per: If admins enables user locales then we don’t get it cry However user locale selection is kind of rare, #pr-welcome to make the user selector consistent with admin.

> [@Changing language for non registered user](https://meta.discourse.org/t/changing-language-for-non-registered-user/113240):
>
> 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

Is that Possible?

Regards.,

---

<div class="post-metadata">

**Author:** ![osioke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osioke/32/238946_2.png) [@osioke](https://meta.discourse.org/u/osioke)\
**Post date:** [May 11, 2020, 3:39pm UTC](https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032/2 "2020-05-11T15:39:05Z")

</div>

Discourse uses the browser’s locale to set the user’s locale if the `set locale from accept language header` site setting is enabled. The locale will be set for anonymous users (and also for new users who register on the site) from their browser’s language header.

It will only work correctly if the site setting `login required` is enabled. For sites that do not have the `login required` setting enabled, the `set locale from accept language header` setting can cause the site to be displayed in the wrong locale for non-logged-in users. The reason for this issue is that we cache the content that is displayed to non-logged-in users to speed up the site’s load times.

Note that all your users will be able to change their language from their user preferences.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [June 10, 2020, 3:44pm UTC](https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032/3 "2020-06-10T15:44:36Z")

</div>

Closed on June 10, 2020, 3:44pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [July 23, 2020, 12:31am UTC](https://meta.discourse.org/t/is-there-a-way-to-set-default-language-based-on-browser-settings/151032/4 "2020-07-23T00:31:27Z")

</div>

The `set locale from accept language header` has had its issues ironed out and is no longer “experimental”.

[https://github.com/discourse/discourse/pull/10289](https://github.com/discourse/discourse/pull/10289)
