app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "lang",
pattern: "{language}-{country}/{controller=Home}/{action=Index}/{id?}",
constraints: new { id = new IntRouteConstraint() },
dataTokens: new { locale = "{language}-{country}" }
);
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
在dataTokens:这里 怎么设置获取动态的{language}-{country}呢?
只要是实现基于URL的多语言方案
http://www.xx.com/zh-CN/order/list
http://www.xx.com/en-US/order/list
怎么设置获取动态的???
[FromRoute] string language
this.RouteData.DataTokens