WinRTFeatureConfiguration.ApplicationLanguages.UseLegacyPrimaryLanguageOverride
gated a Uno-only extra ApplyCulture() call inside the PrimaryLanguageOverride
setter, so setting the override swapped CultureInfo.CurrentCulture mid-session.
WinUI applies the override to the culture only on the next app start.
Hard-remove it (no [Obsolete] shim) and behave as if it were false:
- ApplicationLanguages: drop the gated ApplyCulture() from the setter. The
override is still persisted and still updates Languages immediately, and
Application's constructor still applies the culture at startup, so the
behaviour is WinUI's restart-to-apply.
- WinRTFeatureConfiguration: delete the now-empty ApplicationLanguages holder.
- PackageDiffIgnore (6.6): ignore the removed holder plus the flag property and
its get/set accessors.
- Given_ApplicationLanguages: fails-before/passes-after guard asserting the
culture is untouched while Languages[0] follows the override.
- migrating-to-uno-7.md: migration note. The flag defaulted to true, so unlike
the other removed flags this changes behaviour for apps that never touched it;
the note gives them the explicit CultureInfo assignment to use instead.
Resource lookup (x:Uid, ResourceLoader) reads PrimaryLanguageOverride directly,
so localized strings keep updating without a restart.
BC50 of the 7.0 breaking-changes rollup (#8339), for #13704.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub Issue: closes #13704
PR Type:
💬 Other... Breaking change (behaviour alignment with WinUI)
What changed? 🚀
Hard-removes the Uno-only
WinRTFeatureConfiguration.ApplicationLanguages.UseLegacyPrimaryLanguageOverrideflag and, with it, the legacy immediate-culture-apply path (BC50 of the Phase 5 breaking-changes wave).Before: the flag defaulted to
true, so settingWindows.Globalization.ApplicationLanguages.PrimaryLanguageOverrideswappedCultureInfo.CurrentCulture/CurrentUICulture/DefaultThreadCurrent*from inside the setter — a mid-session culture change with no WinUI counterpart.After: the setter no longer touches the culture. The override is still persisted to local settings and still updates
ApplicationLanguages.Languagesimmediately, andApplication's constructor still callsApplyCulture()at startup — so the net behaviour is WinUI's restart-to-apply.Resource lookup is unaffected:
ResourceLoaderreadsPrimaryLanguageOverridedirectly (via the separate, unchangedWinRTFeatureConfiguration.ResourceLoader.UsePrimaryLanguageOverride), sox:Uid/GetStringkeep following the new value immediately. Localized strings still hot-swap on page reload; only the formatting culture waits for the restart.ApplicationLanguages.PrimaryLanguageOverride— dropped the flag-gatedApplyCulture()call.WinRTFeatureConfiguration— deleted the flag and the now-emptyApplicationLanguagesholder (no[Obsolete]shim, per the recorded decision).PackageDiffIgnore.xml— 4 entries under<IgnoreSet baseVersion="6.6">: the removed holder type, the property form, and theget_/set_accessors. (The6.5set is retired — an in-file comment notes its entries were relocated to6.6when the diff base advanced to 6.6.166, sincegeneratepkgdiffconsults only the set matching the base major.minor.)migrating-to-uno-7.md, plus a note in the "change app language at runtime" guide, which documents exactly this scenario.Validation
Given_ApplicationLanguages.When_PrimaryLanguageOverride_Then_Culture_Unchanged— failed before the source change (CurrentCulturebecamefr-CA, expecteden-US) and passes after. It picks its target language relative to the ambient culture so it cannot pass by coincidence, and restores all fourCultureInfostatics in afinally.Given_ApplicationLanguages3/3,Given_ResourceLoader18/18 (confirms resource resolution still follows the override immediately),Given_DatePicker12/12.Uno.UWP(Skia net10.0) full rebuild withUnoFastDevBuild=false— analyzers on, 0 warnings / 0 errors.SamplesApp.Skia.Genericclean.src/Uno.UWP/reverted and rebuilt:When_Calendar13 failures inUno.UI.UnitTests(3997 pass),DatePickerIntegrationTests2 failures.PR Checklist ✅
Given_ApplicationLanguages.When_PrimaryLanguageOverride_Then_Culture_Unchanged, fails-before / passes-after.migrating-to-uno-7.mdand inguides/hotswap-app-language.md.Screenshots Compare Test Runresults — N/A (no visual change).Breaking change — impact & migration path
Unlike most flag removals in this wave, this flag defaulted to
true, so it changes behaviour for apps that never touched it.Impact (behavioural + source-breaking): apps that switched UI language at runtime by setting
PrimaryLanguageOverrideand relied onCultureInfo.CurrentCulturefollowing immediately lose that side effect — number, date, and currency formatting (and .NET resource lookup throughCurrentUICulture) keep the previous culture until the next app start. Code that read or set the flag no longer compiles, and there is no opt-back-in: the legacy path is gone.Migration: set the culture explicitly alongside the override:
Apps that already restart — or re-navigate — on language change need no change: localized strings still update through
ResourceLoader.