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…
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.
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.
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.
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.)
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.