-
Notifications
You must be signed in to change notification settings - Fork 49
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
LocalizationService does not set a culture in Windows (Unpackaged) Head #2133
Comments
@nickrandolph |
Thanks for following up on this. I've confirmed that:
|
Looks like we might be stalled on this microsoft/WindowsAppSDK#4181 |
I also noticed that DateTimes are in the wrong format for the Unpackaged Head. I fixed the issue with following workaround: App.Dispatcher.TryEnqueue(() =>
{
CultureInfo ci = new CultureInfo("de-DE");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}); |
@nickrandolph it looks like microsoft/WindowsAppSDK#4181 has been closed. |
@rajamatt now that microsoft/WindowsAppSDK#4181 is closed, can you re-test with latest version please |
I created a new app using Uno.WinUI 5.3.123 and the culture localization was working well in both Packaged and Unpackaged Windows. The I did not test with 1.6.240701003-experimental2 yet as I am having trouble overriding the version that it takes from Uno.WinUI in Playground. This should be the next step. |
I found a way to substitute the However, if I override the It seems that this 1.6.240701003-experimental2 version doesn't help. I also tried the latest version 1.6.240821007-preview2 which didn't help either. @agneszitte Could you also quickly test if a new unoapp with Uno.Sdk 5.3.99 handles the localization change correctly? You can:
public Task ToggleLocalizationAsync()
{
var currentCulture = localizationService.CurrentCulture;
var culture = localizationService.SupportedCultures.First(culture => culture.Name != currentCulture.Name);
return localizationService.SetCurrentCultureAsync(culture);
}
|
@Kunal22shah can you help do a test with latest 1.6.240829007 please |
@agneszitte I have tested with Uno.Sdk 5.3.108 and latest 1.6.240829007 WinAppSdk and can confirm that localization works fine. |
@Kunal22shah Thanks for the help 🚀 @agneszitte I want to re-test pure Xaml culture/localization as well as I don't remember clearly if it was working or not. I will report the result here. |
Thanks a lot @Kunal22shah for the previous test and thanks in advance for the result of the next test @rajamatt |
Tested again with latest stable Uno.Sdk and both: Code behind & Xaml X:Uid's are working correctly on the Unpackaged Windows head. Launching the app, setting the culture, then restarting the app displays the correct selected culture. |
Thanks a lot for the feedback @rajamatt ! |
I retested and am not able to make localization work on the Unpackaged head. I am not sure what happened but I am guessing I overrode the WinAppSdk to the preview version and then Extensions always kept that version. It is weird though, because that specific preview version adds to the API with More importantly, this new |
WinAppSdk seems to just have been updated and now includes this change (on a stable version!) I will test further to see if this new version 1.6.240923002 helps. |
thank you. |
@Seekuhnetz if you want to give it a try on your side while @rajamatt is testing it on his side, you can add in your Name_Of_Your_Project.csproj file For more info about implicit packages: |
thank you, but sadly this did not fix the bug for me. From @agneszitte: |
Thanks for the test @Seekuhnetz. I believe this will require a fix in the Uno.Extensions.Localization project as over there we are currently setting the PrimaryLanguage property which isn't compatible with Unpackaged apps. I will investigate more to prepare the details and share them here. |
cc @kazo0, @eriklimakc for info |
Current behavior
I created a new App with the UnoApp Template and Localization and Configuration enabled.
I added the
ToggleLocalizationAsync()
of this page.The Current Culture gets updated in the (Packaged) but not in the (Unpackaged) Windows Head.
I also had to add
.Section<LocalizationConfiguration>()
underconfigBuilder
in myApp.cs
else theSupportedCultures
would be empty.I guess the problem could be fixed if i was able to also add
.Section<LocalizationSettings>()
. But i can not because it is internal.Expected behavior
The Current Culture should be updated in the (Unpackaged) Windows Head like in the (Packaged) Head.
How to reproduce it (as minimally and precisely as possible)
ToggleLocalizationAsync()
of this page.Workaround
No response
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
No response
Affected platforms
Windows
IDE
Visual Studio 2022
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: