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

.NET MAUI Blazor Hybrid Localization issue #22551

Closed
bpsc-wkubis opened this issue May 21, 2024 · 2 comments
Closed

.NET MAUI Blazor Hybrid Localization issue #22551

bpsc-wkubis opened this issue May 21, 2024 · 2 comments
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/android 🤖 t/bug Something isn't working

Comments

@bpsc-wkubis
Copy link

Description

I have basically followeed jfversluis on Maui Blazor hybrid localization, which can be found here

However, I've encountered an issue when trying to preserve localization settings in Preferences. Specifically, once the culture is set when the app starts, it becomes impossible to change it later. The code causing this issue is as follows

var language = Preferences.Get("language", "en-US");
var culture = new CultureInfo(language);

Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;

By commenting out this code ni App.xaml.cs, we enable the culture change to function correctly. However, this leaves us without a mechanism to maintain the set culture across application restarts

In video this problem does not occur because navigation was not performed. When we actually would navigate to counter page and then back to home, language will be same as app has set in start in App.xaml.cs.

Steps to Reproduce

Clone the application from the repository, switch the language setting to 'pl-PL', navigate to a different page such as the 'Counter' page, and then return to the main page where the Localizer with resources is located.

Link to public reproduction project repository

https://github.com/bpsc-wkubis/maui-blazor-hybrid-localization-issue

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@bpsc-wkubis bpsc-wkubis added the t/bug Something isn't working label May 21, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen
Copy link
Member

This issue was moved to xamarin/xamarin-android#8972

@dotnet dotnet locked and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants