如何本地化的ASP.NET MVC应用程序控制器名称和操作? [英] How to localize the Controller names and actions in an ASP.NET MVC application?

查看:296
本文介绍了如何本地化的ASP.NET MVC应用程序控制器名称和操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想完全本地化我的ASP.NET MVC应用程序,虽然有一些处理ASP.NET MVC本地化的各种缺陷的文章很多,他们没有处理,我要处理的一个方面,那就是URL的本地化,包括控制器名称和操作。

I'd like to fully localize my ASP.NET MVC application, and while there are many articles that deal with the various pitfalls of ASP.NET MVC localization, none of them deals with an aspect that I want to deal with, and that is the localization of URLs, including the controller names and actions.

我想办法在资源文件中指定应出现,而不是在URL中的控制器名称和动作名称的字符串,例如。

I would like a way to specify the strings that should appear instead of the controller name and action name in the URL, for example in a resource file.

这怎么是可行的理智的方式?在此先感谢您的帮助!

How is this doable in a sane way? Thanks in advance for your help!

编辑:
我仍然在寻找一种方式来做到这一点。任何帮助将受到欢迎。
是否有任何框架或lib中已经实现这一点?


I'm still looking for a way to do this. Any help would be welcome.
Is there any framework or lib implementing this already?

推荐答案

我从来没有这样做过,但不能添加一个条目到路由表中要支持的每一种语言?所有本地化路线可以重定向到您所选择的语言途径。查阅这些相关的问题:

I've never done this before, but couldn't you add an entry to the routes table for every language you want to support? All of the localized routes could redirect to the route in the language of your choice. Check out these related questions:

<一个href="http://stackoverflow.com/questions/291405/multi-lingual-websites-with-asp-net-mvc">Multi-lingual在ASP.NET MVC 网站

<一个href="http://stackoverflow.com/questions/603915/how-should-i-implement-localization-with-asp-net-mvc-routes">How我应该实现本地化的ASP.NET MVC路线?

这篇关于如何本地化的ASP.NET MVC应用程序控制器名称和操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆