rana hodroj

rana hodroj

  • NA
  • 57
  • 867

support different languages in xamarin.forms app

May 7 2022 1:17 PM

hello all. i am trying to make my app support 2 languages arabic and english. i followed the steps in this tutorial Support Multiple Languages In Xamarin.Forms Application (c-sharpcorner.com). my problem is that when the phone's language is first set to english, the app takes the english language. but when i change it to arabic, the app doesn't take the arabic language unless the app is restarted from my visual studio. like i have to run it again so it starts from the begining. i want the app to detect the change in language when i reopen it and change its language dynamically. i tried to implement this in app.xaml.cs:

 CultureInfo language = CultureInfo.InstalledUICulture;
 Thread.CurrentThread.CurrentUICulture = language;
 ApplicationResource.Culture = language;
Application.Current.MainPage = new NavigationPage(new MainPage());

but it didn't work. any suggestions?


Answers (2)