首页 新闻 会员 周边

asp.net core 基于URL的多全球化

0
悬赏园豆:20 [待解决问题]

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

FelixLoeng的主页 FelixLoeng | 菜鸟二级 | 园豆:244
提问于:2019-10-31 12:01
< >
分享
所有回答(2)
0

怎么设置获取动态的???
[FromRoute] string language

this.RouteData.DataTokens

czd890 | 园豆:14412 (专家六级) | 2019-10-31 14:14
0
dudu | 园豆:31003 (高人七级) | 2019-11-02 22:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册