How to force Xamain - Android / iOS to work in US English culture regardless of user setting. The issue I am facing in my application is, The app only support US/UK English, But if the user changes the langue preference to Spanish , German etc. The number date etc format will change.
For Example, 2.35 will represent in Spanish, German as 2,35.
So if the user try to use the application with similar language, the app will miss behave or crash. Crash will occur in situation like when I try for Convert.ToDouble("2,35");
or similar.
So my doubt is,
Is it possible in Xamarin to forcefully set the culture as en-US. May be in one place, otherwise I need to change it all the places I performing Conversion.
Please help.
I am working with a Xamarin Forms
App.
Setting the Culture in the App
Class did the trick for me.
using System.Globalization;
using System.Threading;
private void SetCultureToUSEnglish()
{
CultureInfo englishUSCulture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = englishUSCulture;
}