• ASP.NET 3.5(c#)区域化设置(LCID)


    代码
      1    /// <summary>
      2     ///区域设置ID(LCID)
      3     ///涂聚文 http://geovindu.blog.163.com 
      4     /// </summary>
      5     /// <param name="sender"></param>
      6     /// <param name="e"></param>
      7     protected void Page_Load(object sender, EventArgs e)
      8     {
      9         try
     10         {
     11             Response.ContentEncoding = Encoding.UTF8;
     12             Response.Write("<table border=\"1\">");
     13             Response.Write(ShowDateTimeCurrency("af-ZA"));
     14             Response.Write(ShowDateTimeCurrency("sq-AL"));
     15             Response.Write(ShowDateTimeCurrency("ar-DZ"));
     16             Response.Write(ShowDateTimeCurrency("ar-BH"));
     17             Response.Write(ShowDateTimeCurrency("ar-EG"));
     18             Response.Write(ShowDateTimeCurrency("ar-IQ"));
     19             Response.Write(ShowDateTimeCurrency("ar-JO"));
     20             Response.Write(ShowDateTimeCurrency("ar-KW"));
     21             Response.Write(ShowDateTimeCurrency("ar-LB"));
     22             Response.Write(ShowDateTimeCurrency("ar-LY"));
     23             Response.Write(ShowDateTimeCurrency("ar-MA"));
     24             Response.Write(ShowDateTimeCurrency("ar-OM"));
     25             Response.Write(ShowDateTimeCurrency("ar-QA"));
     26             Response.Write(ShowDateTimeCurrency("ar-SA"));
     27             Response.Write(ShowDateTimeCurrency("ar-SY"));
     28             Response.Write(ShowDateTimeCurrency("ar-TN"));
     29             Response.Write(ShowDateTimeCurrency("ar-AE"));
     30             Response.Write(ShowDateTimeCurrency("ar-YE"));
     31             Response.Write(ShowDateTimeCurrency("hy-AM"));
     32            // Response.Write(ShowDateTimeCurrency("az-AZ-Cyrl"));
     33             Response.Write(ShowDateTimeCurrency("eu-ES"));
     34             Response.Write(ShowDateTimeCurrency("ca-ES"));
     35             Response.Write(ShowDateTimeCurrency("be-BY"));
     36             Response.Write(ShowDateTimeCurrency("bg-BG"));
     37             Response.Write(ShowDateTimeCurrency("hr-HR"));
     38             Response.Write(ShowDateTimeCurrency("cs-CZ"));
     39             Response.Write(ShowDateTimeCurrency("da-DK"));
     40             //Response.Write(ShowDateTimeCurrency("div-MV"));
     41             Response.Write(ShowDateTimeCurrency("nl-BE"));
     42             Response.Write(ShowDateTimeCurrency("nl-NL"));
     43             Response.Write(ShowDateTimeCurrency("et-EE"));
     44             Response.Write(ShowDateTimeCurrency("fo-FO"));
     45             Response.Write(ShowDateTimeCurrency("fa-IR"));
     46             Response.Write(ShowDateTimeCurrency("fi-FI"));
     47             Response.Write(ShowDateTimeCurrency("fr-BE"));
     48             Response.Write(ShowDateTimeCurrency("fr-CA"));
     49             Response.Write(ShowDateTimeCurrency("fr-FR"));
     50             Response.Write(ShowDateTimeCurrency("fr-LU"));
     51             Response.Write(ShowDateTimeCurrency("fr-MC"));
     52             Response.Write(ShowDateTimeCurrency("fr-CH"));
     53             Response.Write(ShowDateTimeCurrency("gl-ES"));
     54             Response.Write(ShowDateTimeCurrency("ka-GE"));
     55             Response.Write(ShowDateTimeCurrency("de-AT"));
     56             Response.Write(ShowDateTimeCurrency("de-DE"));
     57             Response.Write(ShowDateTimeCurrency("de-LI"));
     58             Response.Write(ShowDateTimeCurrency("de-LU"));
     59             Response.Write(ShowDateTimeCurrency("de-CH"));
     60             Response.Write(ShowDateTimeCurrency("el-GR"));
     61             Response.Write(ShowDateTimeCurrency("gu-IN"));
     62             Response.Write(ShowDateTimeCurrency("he-IL"));
     63             Response.Write(ShowDateTimeCurrency("hi-IN"));
     64             Response.Write(ShowDateTimeCurrency("hu-HU"));
     65             Response.Write(ShowDateTimeCurrency("is-IS"));
     66             Response.Write(ShowDateTimeCurrency("id-ID"));
     67             Response.Write(ShowDateTimeCurrency("it-IT"));
     68             Response.Write(ShowDateTimeCurrency("it-CH"));
     69             Response.Write(ShowDateTimeCurrency("kn-IN"));
     70             Response.Write(ShowDateTimeCurrency("kk-KZ"));
     71             Response.Write(ShowDateTimeCurrency("kok-IN"));
     72             Response.Write(ShowDateTimeCurrency("ky-KG"));
     73             Response.Write(ShowDateTimeCurrency("lv-LV"));
     74             Response.Write(ShowDateTimeCurrency("lt-LT"));
     75             Response.Write(ShowDateTimeCurrency("mk-MK"));
     76             Response.Write(ShowDateTimeCurrency("ms-BN"));
     77             Response.Write(ShowDateTimeCurrency("ms-MY"));
     78             Response.Write(ShowDateTimeCurrency("mr-IN"));
     79             Response.Write(ShowDateTimeCurrency("mn-MN"));
     80             Response.Write(ShowDateTimeCurrency("nb-NO"));
     81             Response.Write(ShowDateTimeCurrency("nn-NO"));
     82             Response.Write(ShowDateTimeCurrency("pl-PL"));
     83             Response.Write(ShowDateTimeCurrency("pt-BR"));
     84             Response.Write(ShowDateTimeCurrency("pt-PT"));
     85             Response.Write(ShowDateTimeCurrency("ro-RO"));
     86             Response.Write(ShowDateTimeCurrency("ru-RU"));
     87             Response.Write(ShowDateTimeCurrency("sa-IN"));
     88             Response.Write(ShowDateTimeCurrency("sk-SK"));
     89             Response.Write(ShowDateTimeCurrency("sl-SI"));
     90             Response.Write(ShowDateTimeCurrency("es-AR"));
     91             Response.Write(ShowDateTimeCurrency("es-BO"));
     92             Response.Write(ShowDateTimeCurrency("es-CL"));
     93             Response.Write(ShowDateTimeCurrency("es-CO"));
     94             Response.Write(ShowDateTimeCurrency("es-CR"));
     95             Response.Write(ShowDateTimeCurrency("es-DO"));
     96             Response.Write(ShowDateTimeCurrency("es-EC"));
     97             Response.Write(ShowDateTimeCurrency("es-SV"));
     98             Response.Write(ShowDateTimeCurrency("es-GT"));
     99             Response.Write(ShowDateTimeCurrency("es-HN"));
    100             Response.Write(ShowDateTimeCurrency("es-MX"));
    101             Response.Write(ShowDateTimeCurrency("es-NI"));
    102             Response.Write(ShowDateTimeCurrency("es-PA"));
    103             Response.Write(ShowDateTimeCurrency("es-PY"));
    104             Response.Write(ShowDateTimeCurrency("es-PE"));
    105             Response.Write(ShowDateTimeCurrency("es-PR"));
    106             Response.Write(ShowDateTimeCurrency("es-ES"));
    107             Response.Write(ShowDateTimeCurrency("es-UY"));
    108             Response.Write(ShowDateTimeCurrency("es-VE"));
    109             Response.Write(ShowDateTimeCurrency("sw-KE"));
    110             Response.Write(ShowDateTimeCurrency("sv-FI"));
    111             Response.Write(ShowDateTimeCurrency("sv-SE"));
    112             Response.Write(ShowDateTimeCurrency("syr-SY"));
    113             Response.Write(ShowDateTimeCurrency("ta-IN"));
    114             Response.Write(ShowDateTimeCurrency("tt-RU"));
    115             Response.Write(ShowDateTimeCurrency("te-IN"));
    116             Response.Write(ShowDateTimeCurrency("th-TH"));
    117             Response.Write(ShowDateTimeCurrency("tr-TR"));
    118             Response.Write(ShowDateTimeCurrency("uk-UA"));
    119             Response.Write(ShowDateTimeCurrency(""));
    120             Response.Write(ShowDateTimeCurrency("en-US"));
    121             Response.Write(ShowDateTimeCurrency("en-AU"));
    122             Response.Write(ShowDateTimeCurrency("en-BZ"));
    123             Response.Write(ShowDateTimeCurrency("en-CA"));
    124            // Response.Write(ShowDateTimeCurrency("en-CB"));
    125             Response.Write(ShowDateTimeCurrency("en-IE"));
    126             Response.Write(ShowDateTimeCurrency("en-JM"));
    127             Response.Write(ShowDateTimeCurrency("en-NZ"));
    128             Response.Write(ShowDateTimeCurrency("en-PH"));
    129             Response.Write(ShowDateTimeCurrency("en-ZA"));
    130             Response.Write(ShowDateTimeCurrency("en-TT"));
    131             Response.Write(ShowDateTimeCurrency("en-GB"));
    132             Response.Write(ShowDateTimeCurrency("en-ZW"));
    133             Response.Write(ShowDateTimeCurrency("ja-JP"));
    134             Response.Write(ShowDateTimeCurrency("de-DE"));
    135             Response.Write(ShowDateTimeCurrency("zh-CN"));
    136             Response.Write(ShowDateTimeCurrency("ko-KR"));
    137             Response.Write(ShowDateTimeCurrency("ru-RU"));
    138             Response.Write(ShowDateTimeCurrency("zh-TW"));
    139             Response.Write(ShowDateTimeCurrency("zh-HK"));
    140             Response.Write(ShowDateTimeCurrency("zh-SG"));
    141             Response.Write(ShowDateTimeCurrency("zh-MO"));
    142            // Response.Write(ShowDateTimeCurrency("zh-CHS"));
    143            // Response.Write(ShowDateTimeCurrency("zh-CHT"));
    144             Response.Write(ShowDateTimeCurrency("ur-PK"));
    145             //Response.Write(ShowDateTimeCurrency("uz"));
    146             //Response.Write(ShowDateTimeCurrency("uz-UZ-Cyrl"));
    147            // Response.Write(ShowDateTimeCurrency("uz-UZ-Latn"));
    148             //Response.Write(ShowDateTimeCurrency("vi"));
    149             Response.Write(ShowDateTimeCurrency("vi-VN"));
    150 
    151             Response.Write("</table>");
    152         }
    153         catch (Exception ex)
    154         {
    155             Response.Write("erro:" + ex.Message.ToString() + "<br/>");
    156         }
    157     }
    158     /// <summary>
    159     /// 区域化设置和符集的匹配
    160     /// </summary>
    161     /// <param name="sLocale">区域代码LCID</param>
    162     /// <returns>返回区域字符集</returns>
    163     public string ShowDateTimeCurrency(string sLocale)
    164     {
    165         Page.Culture = sLocale;
    166         string formateDate=(DateTimeFormatInfo.GetInstance(null)).LongDatePattern;
    167         string formateTime=(DateTimeFormatInfo.GetInstance(null)).LongTimePattern;
    168         int i=1000;
    169         string formateCurrency=i.ToString("C");
    170         int j=50;
    171         double k=0.2;
    172         string formateNumber=j.ToString("F")+"&"+k.ToString("F");
    173         string Result="<tr>";
    174         Result+="<td>"+CultureInfo.CurrentCulture.DisplayName+"</td>";
    175         Result+="<td>"+DateTime.Now.ToString(formateDate)+"</td>";
    176         Result+="<td>"+DateTime.Now.ToString(formateTime)+"</td>";
    177         Result+="<td>"+formateCurrency+"</td>";
    178         Result+="<td>"+formateNumber+"</td></td>";
    179         return (Result);
    180 
    181     }
    182 


  • 相关阅读:
    对生产稳定的一些思考
    tsar指标解释
    tsar采集nginx指标
    Nginx如何处理一个连接
    Java : 如何更优雅的设计异常
    MySql的索引实现
    IntelliJ Idea 常用配置
    ICSharpCode.SharpZipLib.dll 压缩、解压Zip文件 附源码
    Java BigDecimal使用
    社交系统中用户好友关系数据库设计
  • 原文地址:https://www.cnblogs.com/geovindu/p/1754221.html
Copyright © 2020-2023  润新知