ASP.NET MVC中的多语言应用程序 - 最佳实践?

时间:2021-08-26 06:02:09

I'm developing a web application using ASP.NET MVC (I'm new to the framework and actually quite new to web development in general). My application must support multiple languages - there's a bunch of countries for which I need the application to "speak" the local language.

我正在使用ASP.NET MVC开发一个Web应用程序(我是框架的新手,对Web开发来说实际上是一个新手)。我的应用程序必须支持多种语言 - 有一些国家,我需要应用程序“说”当地语言。

The UI concept is common - have flag icons somewhere, usually the top, possibly with an additional drop-down to include less common languages. At this stage I don't want to get into automatically detecting the source country, but rather start with English and allow users to choose otherwise (and I would remember that setting of course).

UI概念很常见 - 在某处有标志图标,通常是顶部,可能还有一个额外的下拉列表,包括不常用的语言。在这个阶段,我不想进入自动检测源国家,而是从英语开始,并允许用户选择其他(当然我会记住那个设置)。

I would like to know if there's any "framework" for supporting such multilingual views in ASP.NET MVC that will make the job easier.

我想知道是否有任何“框架”支持ASP.NET MVC中的这种多语言视图,这将使工作更容易。

Any recommendations?

Thanks

1 个解决方案

#1


6  

Check out these links: first second third

看看这些链接:第一个第二个第三

Worked for me. In view - HtmlHelper.Resource("greeting"); in controller - this.Resource("greeting");
in model i got my own localization implementation.

为我工作。在视图中 - HtmlHelper.Resource(“greeting”);在控制器 - this.Resource(“问候”);在模型中我有自己的本地化实现。


Make sure You check out this approach when considering localization implementation.

确保在考虑本地化实施时检查此方法。

#1


6  

Check out these links: first second third

看看这些链接:第一个第二个第三

Worked for me. In view - HtmlHelper.Resource("greeting"); in controller - this.Resource("greeting");
in model i got my own localization implementation.

为我工作。在视图中 - HtmlHelper.Resource(“greeting”);在控制器 - this.Resource(“问候”);在模型中我有自己的本地化实现。


Make sure You check out this approach when considering localization implementation.

确保在考虑本地化实施时检查此方法。