本地化和放大器;在全球化asp.net的MVC 2.0 [英] Localization & Globalization in asp.net mvc 2.0

查看:118
本文介绍了本地化和放大器;在全球化asp.net的MVC 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道已经有关于这一主题已经一对夫妇的帖子,但我仍然感到困惑。

I know there have been a couple postings on this topic already but I am still confused.

http://www.$c$cproject.com/KB/aspnet/Localizing_ASP_NET_MVC.aspx?msg=3189952#xx3189952xx

这一次似乎pretty简单,但也有人指出,它不使用App_LocalResources文件夹。

This one seems pretty simple but some people stated that it does not make use of the App_LocalResources folder.

所以我不知道这些文件夹的区别是什么,为什么你应该同时使用。

So I am not sure what the difference between these folders are and why you should be using both.

在另一面此公告似乎pretty长,有相当多的code,使其改变语言。

On the flip side this posting seems pretty long and has quite a bit of code to make it change languages.

http://adamyan.blogspot.com/ 2010/02 / ASPNET-MVC-2定位 - complete.html

所以,我不知道哪一个更好。第一个是我期望的code是,但我不知道这是否是因为你给用户的选择来选择他们的语言(而不是使用自动或硬codeD值)的code只是膨胀起来,是那么长。

So I am not sure which one is better. The first one is what I expected the code to be but I am not sure if it is because you given the user the choice to choose their language(opposed to using auto or hard coded value) that the code just swells up and is so long.

推荐答案

这两种方法基本上是相同的,因为资源文件生成的属性返回字符串的公共类。

Both approaches are basically the same, since the resource files generate public classes with properties returning the strings.

第一次使用一个全局资源,所有的字符串( App_GlobalResources文件),而第二个解释了如何做不同的看法分隔的资源。

The first use one global resource for all the strings (App_GlobalResources), and the second one explains how do separate the resource for different views.

在我看来是个全球性的资源是MVC应用程序更好,因为你可以在模型和视图重用他们,但情况因人而异。

In my opinion a global resources are better for MVC apps since you can reuse them in the model and in the views, but YMMV.

这篇关于本地化和放大器;在全球化asp.net的MVC 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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