CultureInfo.CurrentUICulture 속성
리소스 관리자가 런타임에 culture 관련 리소스를 찾기 위해 사용하는 현재 culture를 나타내는 CultureInfo를 가져옵니다.
네임스페이스: System.Globalization
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
Public Shared ReadOnly Property CurrentUICulture As CultureInfo
‘사용 방법
Dim value As CultureInfo
value = CultureInfo.CurrentUICulture
public static CultureInfo CurrentUICulture { get; }
public:
static property CultureInfo^ CurrentUICulture {
CultureInfo^ get ();
}
/** @property */
public static CultureInfo get_CurrentUICulture ()
public static function get CurrentUICulture () : CultureInfo
속성 값
리소스 관리자가 런타임에 culture 관련 리소스를 찾기 위해 사용하는 현재 culture를 나타내는 CultureInfo입니다.
설명
culture는 실행 스레드의 속성입니다. 이 속성은 Thread.CurrentUICulture를 반환합니다. 스레드가 시작되면 Windows API에서 GetUserDefaultUILanguage를 사용하여 해당 UI culture를 초기에 결정합니다. 스레드에서 사용하는 UI culture를 변경하려면 Thread.CurrentUICulture를 새 culture로 설정합니다. Thread.CurrentThread의 culture를 변경하려면 ControlThread 플래그가 설정된 SecurityPermission이 필요합니다. 스레드와 관련된 보안 상태 때문에 스레드를 조작하는 것은 위험합니다. 따라서 이 사용 권한은 신뢰할 수 있는 코드에 필요할 때만 부여해야 합니다. 일부 신뢰된 코드에서는 스레드의 culture를 변경하면 안됩니다.
예제
다음 코드 예제에서는 현재 스레드의 CurrentCulture와 CurrentUICulture를 변경하는 방법을 보여 줍니다.
Imports System
Imports System.Globalization
Imports System.Security.Permissions
Imports System.Threading
<assembly: SecurityPermission(SecurityAction.RequestMinimum, ControlThread := True)>
Public Class SamplesCultureInfo
Public Shared Sub Main()
' Displays the name of the CurrentCulture of the current thread.
Console.WriteLine("CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name)
' Changes the CurrentCulture of the current thread to th-TH.
Thread.CurrentThread.CurrentCulture = New 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.CurrentUICulture.Name)
' Changes the CurrentUICulture of the current thread to ja-JP.
Thread.CurrentThread.CurrentUICulture = New CultureInfo("ja-JP", False)
Console.WriteLine("CurrentUICulture is now {0}.", CultureInfo.CurrentUICulture.Name)
End Sub 'Main
End Class 'SamplesCultureInfo
'This code produces the following output, if the ControlThread permission is granted (for example, if this code is run from the local drive).
'
'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.Security.Permissions;
using System.Threading;
[assembly:SecurityPermission( SecurityAction.RequestMinimum, ControlThread = true )]
public class SamplesCultureInfo {
public static void Main() {
// Displays the name of the CurrentCulture of the current thread.
Console.WriteLine( "CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name );
// Changes the CurrentCulture of the current thread to th-TH.
Thread.CurrentThread.CurrentCulture = new 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.CurrentUICulture.Name );
// Changes the CurrentUICulture of the current thread to ja-JP.
Thread.CurrentThread.CurrentUICulture = new CultureInfo( "ja-JP", false );
Console.WriteLine( "CurrentUICulture is now {0}.", CultureInfo.CurrentUICulture.Name );
}
}
/*
This code produces the following output, if the ControlThread permission is granted (for example, if this code is run from the local drive).
CurrentCulture is en-US.
CurrentCulture is now th-TH.
CurrentUICulture is en-US.
CurrentUICulture is now ja-JP.
*/
using namespace System;
using namespace System::Globalization;
using namespace System::Security::Permissions;
using namespace System::Threading;
[assembly:SecurityPermission(SecurityAction::RequestMinimum,ControlThread=true)];
int main()
{
// Displays the name of the CurrentCulture of the current thread.
Console::WriteLine( "CurrentCulture is {0}.", CultureInfo::CurrentCulture->Name );
// Changes the CurrentCulture of the current thread to th-TH.
Thread::CurrentThread->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.
Thread::CurrentThread->CurrentUICulture = gcnew CultureInfo( "ja-JP",false );
Console::WriteLine( "CurrentUICulture is now {0}.", CultureInfo::CurrentCulture->Name );
}
/*
This code produces the following output, if the ControlThread permission is granted (for example, if this code is run from the local drive).
CurrentCulture is en-US.
CurrentCulture is now th-TH.
CurrentUICulture is en-US.
CurrentUICulture is now ja-JP.
*/
import System.* ;
import System.Globalization.* ;
import System.Security.Permissions.* ;
import System.Threading.* ;
/** @assembly SecurityPermission(SecurityAction.RequestMinimum,
ControlThread = true)
*/
public class SamplesCultureInfo
{
public static void main(String[] args)
{
// Displays the name of the CurrentCulture of the current thread.
Console.WriteLine("CurrentCulture is {0}.",
CultureInfo.get_CurrentCulture().get_Name());
// Changes the CurrentCulture of the current thread to th-TH.
System.Threading.Thread.get_CurrentThread().set_CurrentCulture(
new CultureInfo("th-TH", false));
Console.WriteLine("CurrentCulture is now {0}.",
CultureInfo.get_CurrentCulture().get_Name());
// Displays the name of the CurrentUICulture of the current thread.
Console.WriteLine("CurrentUICulture is {0}.",
CultureInfo.get_CurrentUICulture().get_Name());
// Changes the CurrentUICulture of the current thread to ja-JP.
System.Threading.Thread.get_CurrentThread().set_CurrentUICulture(
new CultureInfo("ja-JP", false));
Console.WriteLine("CurrentUICulture is now {0}.",
CultureInfo.get_CurrentUICulture().get_Name());
} //main
} //SamplesCultureInfo
/*
This code produces the following output, if the ControlThread permission is
granted (for example, if this code is run from the local drive).
CurrentCulture is en-US.
CurrentCulture is now th-TH.
CurrentUICulture is en-US.
CurrentUICulture is now ja-JP.
*/
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0, 1.0에서 지원
참고 항목
참조
CultureInfo 클래스
CultureInfo 멤버
System.Globalization 네임스페이스
ResourceManager
Thread.CurrentUICulture
CultureInfo.CurrentCulture 속성
InstalledUICulture
InvariantCulture
Parent
SecurityPermission
SecurityPermissionAttribute