1

For some reason, when setting in my app CultureInfo.CurrentCulture to 'de-CH', it automatically sets CultureInfo.CurrentUICulture to 'de-CH' too. If I do it the inverse way, it is happenning too. My system is in 'en-US'

    private void SetCurrentCultures(CultureInfo cultureInfo, CultureInfo cultureUiInfo)
    {
        CultureInfo.CurrentCulture = cultureInfo;
        CultureInfo.CurrentUICulture = cultureUiInfo;

        Thread.CurrentThread.CurrentCulture = cultureInfo;
        Thread.CurrentThread.CurrentUICulture = cultureUiInfo;
    }

enter image description here

As you can see in the image, I set 'de-CH' to CurrentCulture and it sets CurrentUICulture too. After I set 'fr' to CurrentUICulture, it sets CurrentCulture to 'fr' too.

Does anyone know if this is a bug from Xamarin Forms, .NET or am I doing anything wrong?

UPDATE:

The problem is happening on a UWP app too, so it's not a XF issue.

Esteban Chornet
  • 928
  • 3
  • 14
  • 38
  • Did you check a [remarks section of `CultureInfo.CurrentCulture`](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.currentculture?view=net-5.0#remarks)? _If you do set the property value to a `CultureInfo` object that represents a new culture, the value of the `Thread.CurrentThread.CurrentCulture` property also changes._ – Pavel Anikhouski Dec 03 '20 at 11:56
  • @PavelAnikhouski: That's not about setting `CurrentUICulture` though. There are four properties here: two on `CultureInfo`, and two on `Thread.CurrentThread`. The question is about why setting `CurrentCulture` also changes `CurrentUICulture`. – Jon Skeet Dec 03 '20 at 12:10
  • Right @JonSkeet. Also in the other way. CurrentUICulture also changes CurrentCulture – Esteban Chornet Dec 03 '20 at 12:12
  • On UWP app is happening too, not XF issue. – Esteban Chornet Dec 03 '20 at 12:23
  • 1
    UWP apps do not distinguish between the current culture and the current UI culture: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.currentuiculture?view=net-5.0#the-current-ui-culture-and-uwp-apps – YZahringer Dec 03 '20 at 15:33

0 Answers0