The discussion introduces a new feature allowing Docker installations to set the default language at bootstrap time via the DISCOURSE_DEFAULT_LOCALE environment variable in app.yml, resolving long-standing issues with incorrect language settings for FAQ, ToS, and Privacy Policy pages. riking explains that this setting affects initial database seeding and is intended to be permanent — changing it later won’t update existing seeded content like the Lounge or FAQ topics. codinghorror questions whether the locale can ever be changed afterward, to which riking clarifies that while technically possible via rebuilding the container, it’s not recommended and won’t retroactively update seeded content. fantasticfears notes that locale is handled as a global setting (not site setting) and only applied during the first database seed; subsequent seeds won’t overwrite existing topics. riking confirms this behavior, emphasizing that the locale setting is effectively locked after initial setup unless the container is rebuilt from scratch. The feature aims to improve localization accuracy for new non-English installations without requiring manual post-installation fixes.
In a sentence: New Docker installs will now have the option to set the language at bootstrap time.
This has been a pain point for a while: the FAQ, Terms of Service, and Privacy policy would get set up with the wrong language. See this topic from July of last year:
You can do this by setting the DISCOURSE_DEFAULT_LOCALE environment variable in app.yml. Note that this will make it impossible to change the locale from the web UI.
Here’s an example of an app.yml with language settings set.
params:
db_default_text_search_config: "pg_catalog.french"
## Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres
## on 1GB install set to 128MB on a 4GB instance you may raise to 1GB
#db_shared_buffers: "256MB"
#
## Which Git revision should this container use? (default: tests-passed)
# version: tests-passed
env:
LANG: fr_FR.UTF-8
DISCOURSE_DEFAULT_LOCALE: fr
This will be available in latest right now, beta v1.2.0.beta7, stable v1.2.0.
So once language is set this way, it can never be changed, ever? Not without destroying the whole site? Even recreating from backup would recreate the old language topics yes?
We prefer global setting to site setting in app/model/global_setting.rb. Am I right here? @riking
We seed the db based on locale only at the first time. The next seed won’t create or update seed topics. But if you recreate from backup, the topic won’t change because it’s already seeded.
Default categories name doesn’t respect the locale setting. db:migrate migrates the db before invoking the block so I18n.t takes no effect when creating the categories. @neil