How do I set CultureInfo.CurrentCulture from an App.Config file?

I don’t know a built-in way to set it from App.config, but you could just define a key in your App.config like this

        <add key="DefaultCulture" value="pt-BR" />

and in your application read that value and set the culture

CultureInfo culture = new CultureInfo(ConfigurationManager.AppSettings["DefaultCulture"]);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;

Also, as @Ilya has mentioned, since .NET 4.5 you can set the default culture once, rather than per-thread:

CultureInfo.DefaultThreadCurrentCulture = culture
CultureInfo.DefaultThreadCurrentUICulture = culture

Leave a Comment