Skip to content

PrimaryLanguageOverride always return null/empty #6118

@ghost1372

Description

@ghost1372

Describe the bug

Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride is not persisted across app relaunch (unlike UWP behavior).

ApplicationLanguages.PrimaryLanguageOverride behaves differently in WinUI 3 compared to UWP (Windows.Globalization).

In UWP, once PrimaryLanguageOverride is set and the app is relaunched, the value is persisted and can be read again.
In WinUI 3, after relaunching the application, PrimaryLanguageOverride always returns null or an empty string, even though it was previously set successfully.

This creates a behavior inconsistency between UWP and WinUI and makes it impossible to rely on PrimaryLanguageOverride for persistent language selection.

Is this behavior by design, or is it a bug / missing implementation in Microsoft.Windows.Globalization?

If by design, documentation should explicitly state that PrimaryLanguageOverride is not persisted in WinUI 3.

Sorry guys for tagging you:
@stefansjfw
@kmahone
@riverar

Steps to reproduce the bug

1.Create a WinUI 3 desktop application.
2.Set the language override:
Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";
3.Close the application.
4.Relaunch the application.
5.Read:

Debug.WriteLine(Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride);

Expected behavior

After relaunch, PrimaryLanguageOverride should still return the previously set value (same behavior as UWP Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride).

Screenshots

No response

NuGet package version

Latest
None

Packaging type

Packaged
No response

Windows version

11 Latest
No response

IDE

VS2026
No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions