Skip to main content
Logo Appt Light

Localization on Xamarin

Assistive technologies, such as the screen reader, use the locale for the pronunciation of utterances. It is important to explictly set a locale for your app. An incorrect locale leads to unclear pronunciation. Also, setting a locale can help with displaying characters correctly.

With Xamarin, you can use CultureInfo to set a language. For more information, see String and Image localization in Xamarin Forms.

using System.Globalization;
using System.Threading;

CultureInfo ci = CultureInfo.GetCultureInfo(DependencyService.Get<IGeneralPreferences>().Language);

CultureInfo.DefaultThreadCurrentCulture = ci;
CultureInfo.DefaultThreadCurrentUICulture = ci;
AppResources.Culture = ci;
CultureInfo.CurrentUICulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = ci;


Let us know!