# What does ‘default locale’ do?

**URL:** https://meta.discourse.org/t/what-does-default-locale-do/366507
**Category:** Support
**Created:** [May 16, 2025, 8:26pm UTC](https://meta.discourse.org/t/what-does-default-locale-do/366507 "2025-05-16T20:26:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [May 16, 2025, 8:26pm UTC](https://meta.discourse.org/t/what-does-default-locale-do/366507/1 "2025-05-16T20:26:53Z")

</div>

Very 101 level question again. In the app.yml, I have `fi` as the default locale. But does it do something more than just set defaults for everything and everyone?

And if yes, will then a user see everything in that default language, now `fi`, until `Allow user locale` is changed?

But what about `Set locale from accept language header`? If someone has `en_US`, then the English version is offered? And does that mean the default locale is just a suggestion and will be overridden if Accept-Language is something else?

And the reason **why** I am asking this is my new site, which is heavily targeted at the US, and it needs a forum. But I don’t think it catches that much attention that there is a point to do all the work that starting a forum requires. So I was considering a solution where I guide those US/global visitors to one purpose-made category.

But my forum is otherwise all Finnish, and if Accept-Language doesn’t change the default locale, that won’t work.

(And partly I’m hoping that the translator thingy will work someday 😏).

I know, this isn’t a genuine support question, but I’m trying to avoid General…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 27, 2025, 6:03pm UTC](https://meta.discourse.org/t/what-does-default-locale-do/366507/3 "2025-05-27T18:03:08Z")

</div>

This is not something I know a huge amount about, but in lieu of any other replies so far…

I think adding the default locale to your app.yml overrides whatever you set for `default locale` in your site settings (and also removes it from the setting page). But that would only be the default, and you can let people choose (or let their browsers choose) a more suitable alternative for them.

Hopefully that’s relevant, if not this can just be a helpful bump to see if we can rustle up a more knowledgeable response. 🙂 🤞

---

<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: [May 27, 2025, 9:56pm UTC](https://meta.discourse.org/t/what-does-default-locale-do/366507/4 "2025-05-27T21:56:51Z")

</div>

There are two branches of logic in `ApplicationController#with_resolved_locale`: logged-in users and logged-out users.

Logged-out users (1) Set locale from the request, then (2) use the ‘default locale’ site setting if none was detected.

> <https://github.com/discourse/discourse/blob/0b65360094c0c91baec1dcaa1b369124e5758d1f/app/controllers/application_controller.rb#L420-L425>

> <https://github.com/discourse/discourse/blob/0b65360094c0c91baec1dcaa1b369124e5758d1f/lib/discourse.rb#L1233-L1239>

Priority is `?lang=` in the URL, then the `locale` cookie, then `Accept-Language` if each respective site setting is enabled.

The logged-in logic is simpler: User preference, then ‘default locale’ if user preference is forbidden.

> <https://github.com/discourse/discourse/blob/0b65360094c0c91baec1dcaa1b369124e5758d1f/app/models/user.rb#L491-L497>

In all cases, if the resolved locale has been unloaded from the Discourse server, `en` is used. (This mostly triggers during unit and integration tests, IIRC.)

```ruby
locale = SiteSettings::DefaultsProvider::DEFAULT_LOCALE if !I18n.locale_available?(locale)

```

So, in summary, what it does:

- It’s the language for anonymous requests with no `Accept-Language` header.
  - Including, in particular, the account registration process.

- It’s the language that will always be used if you have not allowed users to choose their own language, or the user has not set a preferred locale.
