asp.net – CultureInfo.CurrentCulture从中读取文化

我想知道System.Globalization.CultureInfo.CurrentCulture读取其值的设置或位置.

我使用的是Windows 7笔记本电脑,并将我的系统区域和日期时间设置更改为美国.

我在下面的web.config设置下使用了我的代码

<globalization culture="en-US" />

谢谢

解决方法

MSDN

The culture is a property of the executing thread. This read-only property is equivalent to retrieving the CultureInfo object returned by the Thread.CurrentCulture property. When a thread is started,its culture is initially determined by calling the Windows GetUserDefaultLocaleName function.

换句话说,它基于Thread,在ASP.NET上下文中有一个上下文…来自客户端浏览器中使用的Locale,如果使用服务器变量或其他所有的系统设置.

在这个Web上下文中,您可以使用HTTP_ACCEPT_LANGUAGE上的Server.Variables方法获取它,您将得到类似的内容

en-US,en;q=0.8,pt-PT;q=0.6,pt;q=0.4

Witch声称客户端浏览器设置了3种语言,其中第一种是en-US.

System.Globalization的所有内容都来自系统定义,如下图所示:

上面的代码是:

<p>
    <pre>System.Globalization.CultureInfo.CurrentCulture</pre> 
    is @System.Globalization.CultureInfo.CurrentCulture.EnglishName
</p>

无论使用什么浏览器,System.Globalization的定义将始终来自操作系统定义

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....