FIX: Use resolved locale for localizations, instead of param+site default fallback#39395
Merged
FIX: Use resolved locale for localizations, instead of param+site default fallback#39395
Conversation
nattsw
commented
Apr 21, 2026
| def localize_topic_list_content(list) | ||
| return if list.topics.blank? || !SiteSetting.content_localization_enabled | ||
| crawl_locale = params[Discourse::LOCALE_PARAM].presence || SiteSetting.default_locale | ||
| crawl_locale = I18n.locale |
Contributor
Author
There was a problem hiding this comment.
From PR description:
The fix is to simply use I18n.locale which is already resolved from all sources (
?tl= param, cookie, Accept-Language header, site default).
tgxworld
approved these changes
Apr 21, 2026
Contributor
|
@nattsw test failures are legit though |
Also enable set_locale_from_param in the crawler localization test, since I18n.locale only picks up the ?tl= param when this setting is active.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue:
Our
TopicListResponderdetermined content locale using only the?tl=URL param, falling back toSiteSetting.default_locale. This ignored the locale cookie set by the language switcher or persisted from a previous?tl=visit. The fix is to simply useI18n.localewhich is already resolved from all sources (?tl= param, cookie, Accept-Language header, site default).This only affects initial page loads and browser refreshes. Ember internal navigation (format.json) is unaffected since it doesn't call
localize_topic_list_content.Scenarios affected and fixed (per related urls):