Use invariant culture by default

This commit is contained in:
hishamco
2020-09-29 22:12:03 +03:00
parent 2924e7849f
commit f83c1b1741
3 changed files with 8 additions and 3 deletions

View File

@ -21,12 +21,16 @@ namespace Oqtane.Extensions
var configuration = app.ApplicationServices.GetService<IConfiguration>();
var defaultCulture = configuration.GetSection(DefaultCultureKey).Value;
var supportedCultures = configuration.GetSection(SupportedCulturesKey).Get<string[]>();
if (defaultCulture == CultureInfo.InstalledUICulture.Name)
{
LocalizationSettings.DefaultCulture = defaultCulture;
}
if (supportedCultures.Length > 0)
{
LocalizationSettings.SupportedCultures.AddRange(supportedCultures);
}
LocalizationSettings.DefaultCulture = defaultCulture;
CultureInfo.CurrentUICulture = new CultureInfo(defaultCulture);
app.UseRequestLocalization(options => {