.NET MAUI: Make your app multilingual

      Keine Kommentare zu .NET MAUI: Make your app multilingual

I am currently working on a students project, comparing native iOS development with MAUI (Multi-platform App UI). When searching for a simple solution to make the app react to changes to a devices language settings, I found this great NuGet package from András Tóth.

To change the language according to the device language on App startup, I use this code in App.xaml.cs:

public App(ITranslator translator)
{
   InitializeComponent();
   string language = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
   translator.SetCurrentCulture(new CultureInfo(language));
   MainPage = new AppShell();
}

Remark: In the meantime I prefer to use LocalizationResourceManager.Maui. See this video for a great explanation on how to use it.