除了更改线程的 CurrentCulture 之外,还有其他方法可以测试本地化吗?
在 ASP .Net MVC 应用程序中。我想确保我的代码从正确区域性的资源文件中获取其字符串。我知道我可以在代码中添加类似以下内容:
Thread.CurrentThread.CurrentCulture = myCultureInfo;
Thread.CurrentThread.CurrentUICulture = myCultureInfo;
它会起作用。我只是想知道是否有一种方法可以在不修改源代码的情况下做到这一点。我记得很久以前有人向我展示,通过更改 IE 中的某些设置可以达到目的,但我不知道他到底更改了什么以及是否可以使用 Chrome 和/或 FireFox 执行类似的操作。
In an ASP .Net MVC application. I want to make sure my code is getting its strings from the resource files of the correct culture. I know I can put something like the following on the code:
Thread.CurrentThread.CurrentCulture = myCultureInfo;
Thread.CurrentThread.CurrentUICulture = myCultureInfo;
and it will work. I was just wondering if there is a way of doing it without modifying the source code. I remember someone showed me quite a while ago that by changing some setting in IE could do the trick but I do not what exactly he changed and if you can do something similar with Chrome and/or FireFox.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 web.config 中的 元素来设置区域性为某个特定值或将其设置为
auto
意味着将使用客户端设置:现在 ASP.NET 将使用客户端浏览器上配置的区域性。例如在 FireFox 中:
我还建议您阅读 以下博客文章介绍 ASP.NET 中的全球化。
You could use the element in your web.config to set the culture to some specific value or set it to
auto
meaning that the client settings will be used:Now ASP.NET will use the culture configured on the client browser. For example in FireFox:
I would also recommend you reading the following blog post on globalization in ASP.NET.