CultureInfo.CurrentUICulture Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur CultureInfo objek yang mewakili budaya antarmuka pengguna saat ini yang digunakan oleh Resource Manager untuk mencari sumber daya khusus budaya pada durasi.
public:
static property System::Globalization::CultureInfo ^ CurrentUICulture { System::Globalization::CultureInfo ^ get(); void set(System::Globalization::CultureInfo ^ value); };
public:
static property System::Globalization::CultureInfo ^ CurrentUICulture { System::Globalization::CultureInfo ^ get(); };
public static System.Globalization.CultureInfo CurrentUICulture { get; set; }
public static System.Globalization.CultureInfo CurrentUICulture { get; }
static member CurrentUICulture : System.Globalization.CultureInfo with get, set
static member CurrentUICulture : System.Globalization.CultureInfo
Public Shared Property CurrentUICulture As CultureInfo
Public Shared ReadOnly Property CurrentUICulture As CultureInfo
Nilai Properti
Budaya yang digunakan oleh Resource Manager untuk mencari sumber daya khusus budaya pada durasi.
Pengecualian
Properti diatur ke null
.
Properti diatur ke nama budaya yang tidak dapat digunakan untuk menemukan file sumber daya. Nama file sumber daya hanya dapat menyertakan huruf, angka, tanda hubung, atau garis bawah.
Contoh
Contoh kode berikut menunjukkan cara mengubah CurrentCulture dan CurrentUICulture dari utas saat ini.
using namespace System;
using namespace System::Globalization;
using namespace System::Threading;
int main()
{
// Display the name of the current thread culture.
Console::WriteLine("CurrentCulture is {0}.", CultureInfo::CurrentCulture->Name);
// Change the current culture to th-TH.
CultureInfo::CurrentCulture = gcnew CultureInfo("th-TH",false);
Console::WriteLine("CurrentCulture is now {0}.", CultureInfo::CurrentCulture->Name);
// Displays the name of the CurrentUICulture of the current thread.
Console::WriteLine("CurrentUICulture is {0}.", CultureInfo::CurrentCulture->Name);
// Changes the CurrentUICulture of the current thread to ja-JP.
CultureInfo::CurrentUICulture = gcnew CultureInfo("ja-JP",false);
Console::WriteLine("CurrentUICulture is now {0}.", CultureInfo::CurrentCulture->Name);
}
// The example displays the following output:
// CurrentCulture is en-US.
// CurrentCulture is now th-TH.
// CurrentUICulture is en-US.
// CurrentUICulture is now ja-JP.
using System;
using System.Globalization;
using System.Threading;
public class Example0
{
public static void Main()
{
// Display the name of the current culture.
Console.WriteLine("CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name);
// Change the current culture to th-TH.
CultureInfo.CurrentCulture = new CultureInfo("th-TH", false);
Console.WriteLine("CurrentCulture is now {0}.", CultureInfo.CurrentCulture.Name);
// Display the name of the current UI culture.
Console.WriteLine("CurrentUICulture is {0}.", CultureInfo.CurrentUICulture.Name);
// Change the current UI culture to ja-JP.
CultureInfo.CurrentUICulture = new CultureInfo( "ja-JP", false );
Console.WriteLine("CurrentUICulture is now {0}.", CultureInfo.CurrentUICulture.Name);
}
}
// The example displays the following output:
// CurrentCulture is en-US.
// CurrentCulture is now th-TH.
// CurrentUICulture is en-US.
// CurrentUICulture is now ja-JP.
Imports System.Globalization
Imports System.Threading
Public Module Example
Public Sub Main()
' Display the name of the current culture.
Console.WriteLine("CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name)
' Change the current culture to th-TH.
CultureInfo.CurrentCulture = New CultureInfo("th-TH", False)
Console.WriteLine("CurrentCulture is now {0}.", CultureInfo.CurrentCulture.Name)
' Display the name of the current UI culture.
Console.WriteLine("CurrentUICulture is {0}.", CultureInfo.CurrentUICulture.Name)
' Change the current UI culture to ja-JP.
CultureInfo.CurrentUICulture = New CultureInfo("ja-JP", False)
Console.WriteLine("CurrentUICulture is now {0}.", CultureInfo.CurrentUICulture.Name)
End Sub
End Module
' The example displays the following output:
' CurrentCulture is en-US.
' CurrentCulture is now th-TH.
' CurrentUICulture is en-US.
' CurrentUICulture is now ja-JP.
Keterangan
Untuk informasi selengkapnya tentang API ini, lihat Keterangan API Tambahan untuk CultureInfo.CurrentUICulture.