用.NET FRAMEWORK 2.0可以針對不同的語系去展示網頁.
而culture都是預設的zh-TW, en-US, 如果要自訂Culture呢? 方法如下, 使用Console 端做例子

Imports System.Globalization
Imports System.Threading

Module Module1

    Sub Main()

        CultureAndRegionInfoBuilder.Unregister("zh-TW-adams")

        Dim DemoBuilder As New CultureAndRegionInfoBuilder("zh-TW-adams", CultureAndRegionModifiers.None)

        Dim TWCulture As New CultureInfo("zh-TW")
        Dim TWRegion As New RegionInfo("zh-TW")
        DemoBuilder.LoadDataFromCultureInfo(TWCulture)
        DemoBuilder.LoadDataFromRegionInfo(TWRegion)

        Dim NumberInfo As New NumberFormatInfo()
        NumberInfo.CurrencySymbol = "##"
        NumberInfo.CurrencyDecimalDigits = "4″
        DemoBuilder.NumberFormat = NumberInfo

        Dim DateInfo As New DateTimeFormatInfo
        DateInfo.DateSeparator = "."
        DemoBuilder.GregorianDateTimeFormat = DateInfo

        DemoBuilder.Register()
        Thread.CurrentThread.CurrentCulture = New CultureInfo("zh-TW-adams")
        Thread.CurrentThread.CurrentCulture.NumberFormat = NumberInfo
        Thread.CurrentThread.CurrentCulture.DateTimeFormat = DateInfo
        Console.WriteLine("Culture: " & Thread.CurrentThread.CurrentCulture.Name)
        Console.WriteLine("DateTime: " & DateTime.Now.ToString)
        Console.WriteLine("Currency: " & 1000.ToString("c"))
        Console.Read()
    End Sub

End Module

Leave a reply

required

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>