Use invariant culture by default
This commit is contained in:
parent
2924e7849f
commit
f83c1b1741
|
@ -21,12 +21,16 @@ namespace Oqtane.Extensions
|
||||||
var configuration = app.ApplicationServices.GetService<IConfiguration>();
|
var configuration = app.ApplicationServices.GetService<IConfiguration>();
|
||||||
var defaultCulture = configuration.GetSection(DefaultCultureKey).Value;
|
var defaultCulture = configuration.GetSection(DefaultCultureKey).Value;
|
||||||
var supportedCultures = configuration.GetSection(SupportedCulturesKey).Get<string[]>();
|
var supportedCultures = configuration.GetSection(SupportedCulturesKey).Get<string[]>();
|
||||||
|
if (defaultCulture == CultureInfo.InstalledUICulture.Name)
|
||||||
|
{
|
||||||
|
LocalizationSettings.DefaultCulture = defaultCulture;
|
||||||
|
}
|
||||||
|
|
||||||
if (supportedCultures.Length > 0)
|
if (supportedCultures.Length > 0)
|
||||||
{
|
{
|
||||||
LocalizationSettings.SupportedCultures.AddRange(supportedCultures);
|
LocalizationSettings.SupportedCultures.AddRange(supportedCultures);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalizationSettings.DefaultCulture = defaultCulture;
|
|
||||||
CultureInfo.CurrentUICulture = new CultureInfo(defaultCulture);
|
CultureInfo.CurrentUICulture = new CultureInfo(defaultCulture);
|
||||||
|
|
||||||
app.UseRequestLocalization(options => {
|
app.UseRequestLocalization(options => {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"DefaultContainer": ""
|
"DefaultContainer": ""
|
||||||
},
|
},
|
||||||
"Localization": {
|
"Localization": {
|
||||||
"DefaultCulture": "en-US",
|
"DefaultCulture": "",
|
||||||
"SupportedCultures": []
|
"SupportedCultures": []
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Oqtane.Shared
|
namespace Oqtane.Shared
|
||||||
{
|
{
|
||||||
|
@ -60,6 +61,6 @@ namespace Oqtane.Shared
|
||||||
|
|
||||||
public static readonly string StalliteAssemblyExtension = ".resources.dll";
|
public static readonly string StalliteAssemblyExtension = ".resources.dll";
|
||||||
|
|
||||||
public static readonly string DefaultCulture = "en-US";
|
public static readonly string DefaultCulture = CultureInfo.InstalledUICulture.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user