-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[iOS] Localisation not working #7362
Comments
Possible dup of dotnet/runtime#68321 |
Maybe for the invariant culture, but not for the crashing when accessing NSLocale.CurrentLocale which is returning null. Weird that when you set a breakpoint and debug you can interrogate the values but in code its null so accessing any properties causes the app to just crash. |
repro with vs main build(32522.39.main) |
Hello, we are developing DevExpress .NET MAUI controls and experienced the same issue. This issue has a Normal priority for us. Thank you for your help. |
Hi, I'm also experiencing this issue. Would be nice to know if there is a workaround or when to expect this will be fixed. |
This is also affecting MAUI hybrid-Blazor apps - my iPhone is set to UK English, but the culture settings are just coming through to the app as null, and the app is being rendered incorrectly as en-US by default. This is working and performing correctly on Android and Windows and the app is rendered as en-GB. This is a critical bug for us as dates are being formatted incorrectly. Many thanks! |
@VincentBu Hello! Any update on this issue? |
I have the same issue! |
As Eilon pointed out, this is a bug in the runtime. The bug is fixed and released for the 6.0.3xx band but not released for the 6.0.4xx band yet, hopefully that will happen soon. If you need this right now, you can create a
You can see if it worked by inspecting More is described here: dotnet/runtime#73512 (comment) If you do not need this today, wait until the next .NET 6 update and it should be released as part of that. There is nothing we can do at this time on our end. |
Description
Running an iOS app I want to be able to get the localisation information from the user settings.
On startup the values for the following are all set to "Invariant"
Thread.CurrentThread.CurrentUICulture
Thread.CurrentThread.CurrentCulture
CultureInfo.CurrentUICulture
CultureInfo.DefaultThreadCurrentUICulture
CultureInfo.DefaultThreadCurrentCulture
CultureInfo.InstalledUICulture
CultureInfo.InvariantCulture
Note: On windows and andriod these values are set correctly.
I have tried to get the localisation information to create a cultureinfo and set the values for the above properties in the AppDelegate class, I have tried to get the localization information from NSLocale.CurrentLocale or NSLocale.AutoUpdatingCurrentLocale.CollationIdentifier but it always return null. I can see the values in the debug window but on running the code to get the LocaleIdentifier throw a NullReferenceException. I have tried the following code in the overrides for CreateMauiApp, WillFinishLaunching and OnActivated.
`
var culture = CultureInfo.CreateSpecificCulture(NSLocale.CurrentLocale.CollationIdentifier);
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
`
Firstly I would have expected the CultureInfo to have been which would be consistent with Windows and Android targets, failing that I would have expected I should have been able to access the NSLocale.CurrentLocale properties.
Sample repo available here https://github.com/PedroCigaw/MauiIssueSamplesRepo.git
Steps to Reproduce
Version with bug
Release Candidate 3 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 15
Did you find any workaround?
No work round
Relevant log output
No response
The text was updated successfully, but these errors were encountered: