我将“ .AspNetCore.Culture” cookie设置为nb-NO,但是当前的区域性始终是en-US。
启动,ConfigureServices: services.AddLocalization(options);
services.AddMvc()
.AddViewLocalization(options)
.AddDataAnnotationsLocalization()
.SetCompatibilityVersion(Const.DefaultCompatibilityVersion);
启动,配置:
builder.UseLCAssetsLocalization(opt =>
{
opt.DefaultRequestCulture = new RequestCulture(Const.LocalizationDefaultCulture);
opt.SupportedCultures = Const.LocalizationDefaultSupportedCultures.ToList();
opt.SupportedUICultures = Const.LocalizationDefaultSupportedCultures.ToList();
});
public static IApplicationBuilder UseLCAssetsLocalization(this IApplicationBuilder builder, Action<RequestLocalizationOptions> options)
{
builder.UseStaticFiles();
RequestLocalizationOptions opts = new RequestLocalizationOptions();
options.Invoke(opts);
return builder.UseRequestLocalization(opts);
}
Const.LocalizationDefaultCulture :nb-NO
设置:
"LC.Assets": {
"SiteId": 8,
"Language": "nb-NO"
}
我错过了什么吗?