Skip to content

refactor(globalization)!: Remove UseLegacyPrimaryLanguageOverride (BC50) - #23905

Merged
Xiaoy312 merged 3 commits into
feature/breakingchangesfrom
dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride
Aug 5, 2026
Merged

Xiaoy312 merged 3 commits into
feature/breakingchangesfrom
dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #13704

PR Type:

💬 Other... Breaking change (behaviour alignment with WinUI)

What changed? 🚀

Hard-removes the Uno-only WinRTFeatureConfiguration.ApplicationLanguages.UseLegacyPrimaryLanguageOverride flag and, with it, the legacy immediate-culture-apply path (BC50 of the Phase 5 breaking-changes wave).

Before: the flag defaulted to true, so setting Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride swapped CultureInfo.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.Languages immediately, and Application's constructor still calls ApplyCulture() at startup — so the net behaviour is WinUI's restart-to-apply.

Resource lookup is unaffected: ResourceLoader reads PrimaryLanguageOverride directly (via the separate, unchanged WinRTFeatureConfiguration.ResourceLoader.UsePrimaryLanguageOverride), so x:Uid / GetString keep 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-gated ApplyCulture() call.
  • WinRTFeatureConfiguration — deleted the flag and the now-empty ApplicationLanguages holder (no [Obsolete] shim, per the recorded decision).
  • PackageDiffIgnore.xml — 4 entries under <IgnoreSet baseVersion="6.6">: the removed holder type, the property form, and the get_/set_ accessors. (The 6.5 set is retired — an in-file comment notes its entries were relocated to 6.6 when the diff base advanced to 6.6.166, since generatepkgdiff consults only the set matching the base major.minor.)
  • Docs — migration note in migrating-to-uno-7.md, plus a note in the "change app language at runtime" guide, which documents exactly this scenario.

Validation

  • Runtime (fails-before / passes-after): new Given_ApplicationLanguages.When_PrimaryLanguageOverride_Then_Culture_Unchanged — failed before the source change (CurrentCulture became fr-CA, expected en-US) and passes after. It picks its target language relative to the ambient culture so it cannot pass by coincidence, and restores all four CultureInfo statics in a finally.
  • Runtime (regression), Skia Desktop net10.0: Given_ApplicationLanguages 3/3, Given_ResourceLoader 18/18 (confirms resource resolution still follows the override immediately), Given_DatePicker 12/12.
  • Compile: Uno.UWP (Skia net10.0) full rebuild with UnoFastDevBuild=false — analyzers on, 0 warnings / 0 errors. SamplesApp.Skia.Generic clean.
  • Pre-existing failures, verified unrelated — identical results with src/Uno.UWP/ reverted and rebuilt: When_Calendar 13 failures in Uno.UI.UnitTests (3997 pass), DatePickerIntegrationTests 2 failures.
  • Native Android/iOS heads were not built locally — CI validates them. The removed flag had no callers anywhere in the repo outside the setter it gated.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — Given_ApplicationLanguages.When_PrimaryLanguageOverride_Then_Culture_Unchanged, fails-before / passes-after.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — migration note in migrating-to-uno-7.md and in guides/hotswap-app-language.md.
  • 🖼️ Validated PR Screenshots Compare Test Run results — N/A (no visual change).
  • ❗ Contains NO breaking changes — intentionally left unchecked; this is a breaking change (see below).
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

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 PrimaryLanguageOverride and relied on CultureInfo.CurrentCulture following immediately lose that side effect — number, date, and currency formatting (and .NET resource lookup through CurrentUICulture) 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:

    ApplicationLanguages.PrimaryLanguageOverride = language;
    
    var culture = new CultureInfo(language);
    CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = culture;
    CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = culture;

    Apps that already restart — or re-navigate — on language change need no change: localized strings still update through ResourceLoader.

@github-actions github-actions Bot added area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Jul 29, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224734 found UI Test snapshots differences: skia-linux-screenshots: 88, skia-windows-screenshots: 91

Details
  • skia-linux-screenshots: 88 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png
    • ColorPickerSample.png
    • ImageSourceUrlMsAppDataScheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Image_UseTargetSizeLate.png-dark
    • Image_UseTargetSizeLate.png
  • skia-windows-screenshots: 91 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContextRequested.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • DynamicFont.png
    • Image_UseTargetSize.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • Buttons.png
    • ClipboardTests.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • FluentStyle_NavigationViewSample.png-dark

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 224734 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride branch from 971aa1c to c1de3f8 Compare July 29, 2026 20:12
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224861 found UI Test snapshots differences: skia-linux-screenshots: 88, skia-windows-screenshots: 90

Details
  • skia-linux-screenshots: 88 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ColorPickerSample.png
    • DropDownButtonPage.png-dark
    • DataTransferManager.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Image_Margin_Large.png-dark
    • Image_UseTargetSizeLate.png-dark
    • Image_UseTargetSizeLate.png
    • Buttons.png-dark
    • Buttons.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DoubleImageBrushInList.png-dark
  • skia-windows-screenshots: 90 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_Enumeration.png-dark
    • Buttons.png-dark
    • Buttons.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Image_UseTargetSize.png-dark
    • AppBar_KeyBoard.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 224861 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride branch from c1de3f8 to e1f97c5 Compare August 3, 2026 15:28
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 225493 found UI Test snapshots differences: skia-linux-screenshots: 74, skia-windows-screenshots: 277

Details
  • skia-linux-screenshots: 74 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_CurrentReading.png-dark
    • ImageBrushWithRotateTransform.png
    • DamageRegion_ShadowChildPaintingCaster.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DropDownButtonPage.png-dark
    • Gamepad_Enumeration.png-dark
    • CalendarView_Theming.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Image_Margin_Large.png
    • DynamicFont.png-dark
    • Buttons.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DoubleImageBrushInList.png-dark
  • skia-windows-screenshots: 277 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • EllipsemaskingEllipseGrid.png-dark
    • EllipsemaskingEllipseGrid.png
    • BitmapIcon_Foreground.png
    • Button_Enabled_Control_Disabled.png
    • Contacts_Pick.png-dark
    • Contacts_Pick.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • GetFocus.png-dark
    • GetFocus.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • BitmapIcon_Generic.png
    • BorderVisualClipping.png
    • ElevatedView_Dimensions.png-dark
    • ElevatedView_Dimensions.png
    • ElevatedView_Levels.png-dark
    • ElevatedView_Levels.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 225493 has failed on Uno.UI - CI.

Xiaoy312 and others added 3 commits August 4, 2026 17:07
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) <[email protected]>
The runtime language-switch guide sets PrimaryLanguageOverride and relies on
re-navigation to refresh localized strings, which still works. Call out that the
culture itself now follows on the next app start (BC50), and give the explicit
CultureInfo assignment for apps that need formatting to switch in-session.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Given_BitmapSource.When_MsAppData hangs indefinitely on the Linux
FrameBuffer runtime-test host under .NET 11 Preview 6 (9 occurrences,
never on 10.0.105; the X11 stage runs the same binary and stays green).
The test awaits an ImageOpened TCS with no ImageFailed handler and no
[Timeout], and UnitTestsControl only times out an async body when
[Timeout] is present, so the stall consumes the entire 60-minute CI job
and no results file is published.

Exclude it via RuntimeTestPlatforms.SkiaFrameBuffer, which resolves from
the host assembly name at runtime — both Linux stages run the same
SamplesApp.Skia.Generic binary and differ only by xvfb, so a compile-time
condition could not tell them apart. When_MsAppData_StreamDisposed_
FileNotLocked exercises the same ms-appdata load and is the next test to
run, so it is excluded too.

For #23967.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride branch from e1f97c5 to 92cad57 Compare August 4, 2026 21:21
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 225816 found UI Test snapshots differences: skia-linux-screenshots: 74, skia-windows-screenshots: 296

Details
  • skia-linux-screenshots: 74 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • CalendarView_Theming.png-dark
    • DamageRegion_ShadowChildPaintingCaster.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_Enumeration.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • DoubleImageBrushInList.png-dark
    • DisplayInformation.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrush_Stretch.png
    • Image_UseTargetSizeLate.png-dark
    • Image_UseTargetSizeLate.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
  • skia-windows-screenshots: 296 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Battery.png
    • BitmapIcon_Generic.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • EllipsemaskingEllipseGrid.png-dark
    • EllipsemaskingEllipseGrid.png
    • BitmapIcon_Sizing.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ElevatedView_Tester.png-dark
    • ElevatedView_Tester.png
    • Elevation.png-dark
    • Elevation.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • BitmapIcon_Generic.png-dark
    • Button_Enabled_Control_Disabled.png
    • Contacts_Pick.png-dark
    • Contacts_Pick.png
    • DisplayInformation.png-dark

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@Xiaoy312
Xiaoy312 merged commit ba78aa9 into feature/breakingchanges Aug 5, 2026
68 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260728/bc50-remove-uselegacyprimarylanguageoverride branch August 5, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants