简单搜索了一下连接里的代码,
似乎是直接调用.net core 的 UseRequestLocalization(),那在 startup()设置一下应该就好了吧,
直接贴.net core 的样例麻烦自己改吧:
var supportedCultures = new[]
{
new CultureInfo("en-US"),
new CultureInfo("fr"),
};
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture("en-US"),
// Formatting numbers, dates, etc.
SupportedCultures = supportedCultures,
// UI strings that we have localized.
SupportedUICultures = supportedCultures
});
app.UseStaticFiles();
// To configure external authentication,
// see:
http://go.microsoft.com/fwlink/?LinkID=532715app.UseAuthentication();
app.UseMvcWithDefaultRoute();
来自:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-2.2