在项目中的Web.config配置文件中,可以对服务端的语言进行设置。
具体操作为:将<globalization culture="语言类型" uiCulture="语言类型"/>添加到Web.config的<system.Web>节点处即可。
1、如果服务器端的语言设置为en-US,那么(1002.3).Tostring("c")将返回$1,002.3
2、如果服务器端的语言设置为en-GB,那么(1002.3).Tostring("c")将返回£1,002.3
3、如果服务器端的语言设置为fr-FR,那么(1002.3).Tostring("c")将返回1,002.3€
ToString("c")方法中的"c"表示的是:将数字值渲染成货币形式。
代码如下:
<system.web> <compilation debug="true" targetFramework="4.8" /> <httpRuntime targetFramework="4.8" /> <!--修改服务器的语言设置--> <globalization culture="fr-FR" uiCulture="fr-FR"/> <!--<globalization culture="en-GB" uiCulture="en-GB"/>--> <!--<globalization culture="en-US" uiCulture="en-US"/>--> </system.web>
posted on
浙公网安备 33010602011771号