How to Set Culture Setting in ASP.NET 5

Updated on     Kisan Patel

Problem
How to Set Culture Setting in ASP.NET 5

Solution

Just Open Startup.cs and in the Configure() method use the UseRequestLocalization() extension method to configure the culture.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    // Configure the localization options
    app.UseRequestLocalization(new RequestLocalizationOptions
    {
        DefaultRequestCulture = new RequestCulture(new CultureInfo("gb"))
        SupportedCultures = new List
        {
            new CultureInfo("gb")
        },
        SupportedUICultures = new List
        {
            new CultureInfo("gb")
        }
    });

}

ASP.NET

Leave a Reply