question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CurrentCulture on iOS not available at startup

See original GitHub issue

Description

On iOS at startup all culture info is null. ` var c = Thread.CurrentThread.CurrentUICulture;

 var c1 = Thread.CurrentThread.CurrentCulture;

 var c3 = CultureInfo.CurrentUICulture;

 var c4 = CultureInfo.DefaultThreadCurrentUICulture;

 var c5 = CultureInfo.DefaultThreadCurrentCulture;

 var c6 = CultureInfo.InstalledUICulture;

 var c7 = CultureInfo.InvariantCulture;

 var c8 = CultureInfo.CreateSpecificCulture("en-GB");

` All of the above are null when called in MauiProgram

On android and windows targets getting the culture works as expected.

On iOS the culture info is only accessible after the first Page is displayed.

Steps to Reproduce

  1. Create new maui project.
  2. Add the code in description to the MauiProgram
  3. Run on iOS device.

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

No response

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattscheffercommented, Feb 25, 2022

Bug repro with 17.2 Preview 1 on Iphone 13 iOS 15.2. Repro project link at 3962.zip

0reactions
dais-setcommented, Apr 5, 2022

@jsuarezruiz so what additional info is required? On iOS resources always use the default culture resx and there’s no way to set any other culture or display resources from any other culture.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ios - How to get correct value for CurrentCulture?
iOS application takes into account the settings chosen by the user, i.e. how do I get the correct value for Thread.CurrentCulture ?
Read more >
Option to change language in System Settings on iOS?
I have a Xamarin Forms application, where on startup, I fetch the text content of ... a Dictionary<string, string> based on user's current...
Read more >
Can't change CurrentCulture
We change the CurrentCulture in App.OnStartup as suggested in many answers on support tickets: protected override async void OnStartup(Start.
Read more >
CultureInfo.CurrentCulture always returning Invariant ...
I've been trying to get the country of the ios/android device but It's getting quite messy. This should return the country code but...
Read more >
A Guide to Using CultureInfo in .NET Applications
The CultureInfo class provides information about the locale of a .NET application. Get to know its core features and how to use it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found