How to change the Application language dynamically (Localization) in .Net MAUI?
Loading
How to change the Application language dynamically (Localization) in .Net MAUI?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jithu ThomasPosted Nov 2, 2023, 6:44 AM
using System.Globalization;
using Microsoft.Maui.Essentials;
// Initialize localization
var cultureInfo = new CultureInfo("en-US"); // Set your default language here
AppResources.Culture = cultureInfo;
// Set the current culture
CultureInfo.CurrentCulture = cultureInfo;
CultureInfo.CurrentUICulture = cultureInfo;
public void ChangeLanguage(string languageCode)
{
var cultureInfo = new CultureInfo(languageCode);
AppResources.Culture = cultureInfo;
CultureInfo.CurrentCulture = cultureInfo;
CultureInfo.CurrentUICulture = cultureInfo;
}