I have asp.net core application which I want to localize and translate (v 1.1.0). I want the source code to support both english and norwegian deployments, and I found this
Sure.
appsettings.json
:
{
"SiteLocale" : "en-US"
}
Startup.cs
:
var locale = Configuration["SiteLocale"];
RequestLocalizationOptions localizationOptions = new RequestLocalizationOptions
{
SupportedCultures = new List<CultureInfo> { new CultureInfo(locale) },
SupportedUICultures = new List<CultureInfo> { new CultureInfo(locale) },
DefaultRequestCulture = new RequestCulture(locale)
};
app.UseRequestLocalization(localizationOptions);