Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change PLO get and set for Windows #2595

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 10 additions & 33 deletions src/Uno.Extensions.Localization.UI/LocalizationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,46 +59,23 @@ defaultCulture is null ?
}
}

private static bool overrideSupported =
#if !__WINDOWS__
true;
#else
PlatformHelper.IsAppPackaged;
#endif
private string? PrimaryLanguageOverride
{
get
{
if (!overrideSupported)
{
return default;
}
try
{
return ApplicationLanguages.PrimaryLanguageOverride;
}
catch (InvalidOperationException)
{
// This exception is raised on WinUI when unpackaged
overrideSupported = false;
return default;
}
#if WINDOWS
return Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride;
#else
return ApplicationLanguages.PrimaryLanguageOverride;
#endif
}
set
{
if (!overrideSupported)
{
return;
}
try
{
ApplicationLanguages.PrimaryLanguageOverride = value;
}
catch (InvalidOperationException)
{
// This exception is raised on WinUI when unpackaged
overrideSupported = false;
}
#if WINDOWS
Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = value;
#else
ApplicationLanguages.PrimaryLanguageOverride = value;
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<UnoSingleProject>true</UnoSingleProject>
<OutputType>Library</OutputType>

<WinAppSdkVersion>1.6.240923002</WinAppSdkVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading