Fix: OrchardCore.Setup silently overrides tenant localization settings - #19898
Open
DavidHolmlabs wants to merge 2 commits into
Open
DavidHolmlabs wants to merge 2 commits into
DavidHolmlabs wants to merge 2 commits into
Conversation
…etup OrchardCore.Setup.Startup.Configure() unconditionally calls UseRequestLocalization() with its own hard-coded, setup-wizard-only culture list. Since this feature commonly stays enabled after a tenant finishes setup, and its Startup has no ConfigureOrder override, it runs after OrchardCore.Localization.Startup (ConfigureOrder -100) and registers a second RequestLocalizationMiddleware on the same shared RequestLocalizationOptions instance. AddSupportedCultures/ AddSupportedUICultures replace rather than merge the list, so this silently discards the tenant's real Localization settings (Admin > Configuration > Settings > Localization) in favor of the setup wizard's ~20-language list. Symptom: the admin culture picker cookie is set correctly, but any configured culture that isn't also in the setup wizard's hard-coded list (most regional variants, e.g. sl-SI) is silently rejected and the request falls back to the tenant's default culture instead. Fix: only run this module's own request-localization configuration while the tenant is still uninitialized (ShellSettings.IsUninitialized()). Once a tenant is running, its real Localization settings should be the only source of truth for RequestLocalizationOptions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request. |
Author
|
@dotnet-policy-service agree company="Sustainable Interaction AB"
Den tors 17 sep. 2026 kl 14:28 skrev github-actions[bot] <
***@***.***>:
… *github-actions[bot]* left a comment (OrchardCMS/OrchardCore#19898)
<#19898 (comment)>
Thank you for submitting your first pull request, awesome! 🚀 If you
haven't already, please take a moment to review our contribution guide
<https://docs.orchardcore.net/en/latest/contributing/>. This guide
provides helpful information to ensure your contribution aligns with our
standards. A core team member will review your pull request.
If you like Orchard Core, please star our repo and join our community
channels
<https://github.com/OrchardCMS/OrchardCore/?tab=readme-ov-file#get-in-touch>
.
—
Reply to this email directly, view it on GitHub
<#19898?email_source=notifications&email_token=AAETT4XWG2UMRJYKI657TDT5PPKF7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRGQZTIOBQGQY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5714348041>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAETT4TNSNQGSDFR4RI57EL5PPKF7AVCNFSNUABEKJSXA33TNF2G64TZHMZDMOBYGQ3TENJ3JFZXG5LFHM2TIOBXGMZTKNBUHGQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAETT4UKWUQKDPBEGLZZVXT5PPKF7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRGQZTIOBQGQY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAETT4UNWO4EQ5L4FZCX2K35PPKF7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRGQZTIOBQGQY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Member
|
Would you be able to add a functional test to verify it's doing what you need now and we don't regress? |
Regresses OrchardCore.Setup.Startup silently re-applying its own hard-coded, setup-wizard-only culture list once a tenant is running and the Setup feature is enabled, which discards cultures configured in the tenant's own Localization settings (e.g. "sl-SI", requested by Sebastien Ros for coverage of #987490b). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
Fixed.
The problem was that I have enabled OrchardCore.Setup in a self-service
module in order to create tenants for customers.
Now there are functional tests.
All the best
David
Den tors 17 sep. 2026 kl 20:02 skrev Sébastien Ros ***@***.***
…:
*sebastienros* left a comment (OrchardCMS/OrchardCore#19898)
<#19898 (comment)>
Would you be able to add a functional test to verify it's doing what you
need now and we don't regress?
—
Reply to this email directly, view it on GitHub
<#19898?email_source=notifications&email_token=AAETT4SSQ4QIOKPRQWWMCI35PQRNDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRHA4TSMBXGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5718990736>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAETT4SPG734WOQWRAPJ27D5PQRNDAVCNFSNUABEKJSXA33TNF2G64TZHMZDMOBYGQ3TENJ3JFZXG5LFHM2TIOBXGMZTKNBUHGQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAETT4TBZ5UZNQZDNXXZGNL5PQRNDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRHA4TSMBXGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAETT4TSPMRDOA6VHJNRB7T5PQRNDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNZRHA4TSMBXGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This branch has not been deployed
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.
Summary
OrchardCore.Setup.Startup.Configure()unconditionally callsapp.UseRequestLocalization(...), using its own hard-coded, setup-wizard-only culture list (~20 languages). Nothing disables theOrchardCore.Setupfeature once a tenant finishes setup, and thisStartuphas noConfigureOrderoverride, so it runs afterOrchardCore.Localization.Startup(ConfigureOrder = -100).Both resolve the same shared
IOptions<RequestLocalizationOptions>.Valueinstance, andAddSupportedCultures/AddSupportedUICulturesreplaceSupportedCultures/SupportedUICulturesrather than merge into them. So on every running (already set-up) tenant,OrchardCore.Setup's hard-coded culture list silently clobbers the tenant's realLocalizationSettings.SupportedCulturesright afterOrchardCore.Localizationcorrectly configures it — and since Setup's middleware is registered second, it also runs last and wins.Symptom
The admin culture picker (
OrchardCore.Localization.AdminCulturePicker) sets its cookie correctly, but any tenant-configured culture that isn't also in the setup wizard's hard-coded list (most regional variants without an OrchardCore admin translation — e.g.sl-SI) is silently rejected byRequestLocalizationMiddleware, and the request falls back to the tenant's default culture. Cultures that happen to overlap with the hard-coded list (or whose parent does, when "fall back to parent culture" is enabled) appear to work, which makes the bug confusing to diagnose — it looks culture-specific rather than systemic.Confirmed via
Serilog.MinimumLevel.Override["Microsoft.AspNetCore.Localization"] = "Debug", which logsAdminCookieCultureProvider returned the following unsupported cultures [...], and via dumping the liveIOptions<RequestLocalizationOptions>.Value, which showed exactlyOrchardCore.Setup's hard-coded list instead of the tenant's configured cultures.Fix
Guard the request-localization configuration in
OrchardCore.Setup.Startup.Configure()behindShellSettings.IsUninitialized(). The setup wizard's own culture list is only relevant while the tenant genuinely hasn't been set up yet; once it's running,OrchardCore.Localization's configuration (driven by the tenant's real Localization settings) should be the only source of truth. The route registration is left untouched — this only affects the localization options mutation.Workaround (for anyone hitting this before this ships)
Disable the
OrchardCore.Setupfeature on any tenant that has already completed setup (Admin → Configuration → Features → Setup → Disable). It's only needed for the initial tenant-provisioning wizard.Test plan
dotnet build src/OrchardCore.Modules/OrchardCore.Setup/OrchardCore.Setup.csproj— 0 errors, both before and after pulling latestmainOrchardCore.Setupenabled, a tenant-configured culture (sl-SI) not in the setup wizard's hard-coded list was silently rejected; disabling the feature (the operational equivalent of this code fix not mattering once the tenant is running) immediately resolved itShellSettings.State == Uninitialized) still localizes correctly with this change — the guarded branch should behave identically to before in that case, but I don't have an easy way to exercise the very first setup request in my repro environment🤖 Generated with Claude Code