CultureInfo.CurrentCulture Vlastnost
Definice
Získá nebo nastaví CultureInfo objekt, který představuje jazykovou verzi používanou aktuálním vláknem.Gets or sets the CultureInfo object that represents the culture used by the current thread.
public:
static property System::Globalization::CultureInfo ^ CurrentCulture { System::Globalization::CultureInfo ^ get(); void set(System::Globalization::CultureInfo ^ value); };
public:
static property System::Globalization::CultureInfo ^ CurrentCulture { System::Globalization::CultureInfo ^ get(); };
public static System.Globalization.CultureInfo CurrentCulture { get; set; }
public static System.Globalization.CultureInfo CurrentCulture { get; }
member this.CurrentCulture : System.Globalization.CultureInfo with get, set
member this.CurrentCulture : System.Globalization.CultureInfo
Public Shared Property CurrentCulture As CultureInfo
Public Shared ReadOnly Property CurrentCulture As CultureInfo
Hodnota vlastnosti
Objekt, který představuje jazykovou verzi používanou aktuálním vláknem.An object that represents the culture used by the current thread.
Výjimky
Vlastnost je nastavena na hodnotu null
.The property is set to null
.
Příklady
Následující příklad ukazuje, jak změnit CurrentCulture a CurrentUICulture aktuálního vlákna.The following example demonstrates how to change the CurrentCulture and CurrentUICulture of the current thread.
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 Example
{
public static void 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 = 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 thread 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.
Poznámky
CultureInfoObjekt vrácený touto vlastností a přidruženými objekty určuje výchozí formát pro data, časy, čísla, hodnoty měny, pořadí řazení textu, konvencí velikosti písmen a porovnávání řetězců.The CultureInfo object that is returned by this property and its associated objects determine the default format for dates, times, numbers, currency values, the sorting order of text, casing conventions, and string comparisons.
Aktuální jazyková verze je vlastnost vykonávajícího vlákna.The current culture is a property of the executing thread. Načítání hodnoty CultureInfo.CurrentCulture vlastnosti je více výkonných ekvivalentů načtení CultureInfo objektu vráceného Thread.CurrentThread.CurrentCulture
vlastností.Retrieving the value of the CultureInfo.CurrentCulture property is a more performant equivalent of retrieving the CultureInfo object returned by the Thread.CurrentThread.CurrentCulture
property.
Poznámka
V .NET Framework 4.5.2 a starších verzích CurrentCulture je vlastnost jen pro čtení; To znamená, že můžete načíst hodnotu vlastnosti, ale nemůžete ji nastavit.In the .NET Framework 4.5.2 and earlier versions, the CurrentCulture property is read-only; that is, you can retrieve the property value, but you cannot set it. Chcete-li změnit aktuální jazykovou verzi, přiřadíte CultureInfo objekt, který představuje novou jazykovou verzi Thread.CurrentThread.CurrentCulture
Vlastnosti.To change the current culture, you assign the CultureInfo object that represents the new culture to the Thread.CurrentThread.CurrentCulture
property. Počínaje verzí .NET Framework 4.6.NET Framework 4.6 CurrentCulture je vlastnost pro čtení i zápis; můžete nastavit a načíst hodnotu vlastnosti.Starting with the .NET Framework 4.6.NET Framework 4.6, the CurrentCulture property is read-write; you can both set and retrieve the property's value. Pokud nastavíte hodnotu vlastnosti na CultureInfo objekt, který představuje novou jazykovou verzi, Thread.CurrentThread.CurrentCulture
změní se také hodnota vlastnosti.If you do set the property value to a CultureInfo object that represents a new culture, the value of the Thread.CurrentThread.CurrentCulture
property also changes.
V této části:In this section:
Způsob určení jazykové verze vlákna How a Thread's Culture Is Determined
Získávání aktuální jazykové verze Getting the Current Culture
Explicitní nastavení vlastnosti CurrentCulture Explicitly Setting the CurrentCulture Property
Aktuální jazyková verze a přepsání uživatelem The Current Culture and User Overrides
Jazyková verze a aplikace pro WindowsCulture and Windows Apps
Způsob určení jazykové verze vláknaHow a Thread's Culture Is Determined
Po spuštění vlákna je jeho jazyková verze zpočátku určena následujícím způsobem:When a thread is started, its culture is initially determined as follows:
Načtením jazykové verze, která je určena DefaultThreadCurrentCulture vlastností v doméně aplikace, ve které je vlákno spuštěno, pokud hodnota vlastnosti není
null
.By retrieving the culture that is specified by the DefaultThreadCurrentCulture property in the application domain in which the thread is executing, if the property value is notnull
.Pokud vlákno je vlákno fondu vláken, které provádí asynchronní operaci založenou na úlohách a aplikace cílí na .NET Framework 4.6.NET Framework 4.6 nebo novější verzi .NET Framework, jeho kultura je určena kulturou volajícího vlákna.If the thread is a thread pool thread that is executing a task-based asynchronous operation and the app targets the .NET Framework 4.6.NET Framework 4.6 or a later version of the .NET Framework, its culture is determined by the culture of the calling thread. Následující příklad změní aktuální jazykovou verzi na portugalštinu (Brazílie) a spustí šest úkolů, z nichž každý zobrazuje ID vlákna, jeho ID a aktuální jazykovou verzi.The following example changes the current culture to Portuguese (Brazil) and launches six tasks, each of which displays its thread ID, its task ID, and its current culture. Každá z úloh (a vláken) zdědila jazykovou verzi volajícího vlákna.Each of the tasks (and the threads) has inherited the culture of the calling thread.
using System; using System.Collections.Generic; using System.Globalization; using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; [assembly:TargetFramework(".NETFramework,Version=v4.6")] public class Example { public static async Task Main() { var tasks = new List<Task>(); Console.WriteLine("The current culture is {0}", Thread.CurrentThread.CurrentCulture.Name); Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR"); // Change the current culture to Portuguese (Brazil). Console.WriteLine("Current culture changed to {0}", Thread.CurrentThread.CurrentCulture.Name); Console.WriteLine("Application thread is thread {0}", Thread.CurrentThread.ManagedThreadId); // Launch six tasks and display their current culture. for (int ctr = 0; ctr <= 5; ctr++) tasks.Add(Task.Run( () => { Console.WriteLine("Culture of task {0} on thread {1} is {2}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.CurrentCulture.Name); } )); await Task.WhenAll(tasks.ToArray()); } } // The example displays output like the following: // The current culture is en-US // Current culture changed to pt-BR // Application thread is thread 9 // Culture of task 2 on thread 11 is pt-BR // Culture of task 1 on thread 10 is pt-BR // Culture of task 3 on thread 11 is pt-BR // Culture of task 5 on thread 11 is pt-BR // Culture of task 6 on thread 11 is pt-BR // Culture of task 4 on thread 10 is pt-BR
Imports System.Collections.Generic Imports System.Globalization Imports System.Runtime.Versioning Imports System.Threading Imports System.Threading.Tasks <assembly:TargetFramework(".NETFramework,Version=v4.6")> Module Example Public Sub Main() Dim tasks As New List(Of Task) Console.WriteLine("The current culture is {0}", Thread.CurrentThread.CurrentCulture.Name) Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-BR") ' Change the current culture to Portuguese (Brazil). Console.WriteLine("Current culture changed to {0}", Thread.CurrentThread.CurrentCulture.Name) Console.WriteLine("Application thread is thread {0}", Thread.CurrentThread.ManagedThreadId) ' Launch six tasks and display their current culture. For ctr As Integer = 0 to 5 tasks.Add(Task.Run(Sub() Console.WriteLine("Culture of task {0} on thread {1} is {2}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.CurrentCulture.Name) End Sub)) Next Task.WaitAll(tasks.ToArray()) End Sub End Module ' The example displays output like the following: ' The current culture is en-US ' Current culture changed to pt-BR ' Application thread is thread 9 ' Culture of task 2 on thread 11 is pt-BR ' Culture of task 1 on thread 10 is pt-BR ' Culture of task 3 on thread 11 is pt-BR ' Culture of task 5 on thread 11 is pt-BR ' Culture of task 6 on thread 11 is pt-BR ' Culture of task 4 on thread 10 is pt-BR
Další informace naleznete v části "jazyková verze a asynchronní operace založené na úlohách" v CultureInfo tématu.For more information, see the "Culture and task-based asynchronous operations" section in the CultureInfo topic.
Voláním
GetUserDefaultLocaleName
funkce ve Windows nebouloc_getDefault
funkce z ICU, která aktuálně volásetlocale
funkci POSIX s kategoriíLC_MESSAGES
, v systémech podobných platformě UNIX.By calling theGetUserDefaultLocaleName
function on Windows or theuloc_getDefault
function from ICU, which currently calls the POSIXsetlocale
function with categoryLC_MESSAGES
, on Unix-like systems.
Všimněte si, že pokud nastavíte konkrétní jazykovou verzi, která se liší od jazykové verze nainstalované systémem nebo preferované jazykové verze uživatele, a vaše aplikace spustí více vláken, aktuální jazyková verze těchto vláken bude jazyková verze, která je vrácena GetUserDefaultLocaleName
funkcí, pokud nepřiřazujete jazykovou verzi k DefaultThreadCurrentCulture vlastnosti v doméně aplikace, ve které je vlákno spuštěno.Note that if you set a specific culture that is different from the system-installed culture or the user's preferred culture, and your application starts multiple threads, the current culture of those threads will be the culture that is returned by the GetUserDefaultLocaleName
function, unless you assign a culture to the DefaultThreadCurrentCulture property in the application domain in which the thread is executing.
Další informace o tom, jak je určena jazyková verze vlákna, naleznete v části "jazyková verze a vlákna" na CultureInfo referenční stránce.For more information about how the culture of a thread is determined, see the "Culture and threads" section in the CultureInfo reference page.
Získávání aktuální jazykové verzeGetting the Current Culture
CultureInfo.CurrentCultureVlastnost je nastavení pro vlákno; to znamená, že každé vlákno může mít svou vlastní jazykovou verzi.The CultureInfo.CurrentCulture property is a per-thread setting; that is, each thread can have its own culture. Jazykovou verzi aktuálního vlákna získáte načtením hodnoty CultureInfo.CurrentCulture vlastnosti, jak ukazuje následující příklad.You get the culture of the current thread by retrieving the value of the CultureInfo.CurrentCulture property, as the following example illustrates.
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
CultureInfo culture = CultureInfo.CurrentCulture;
Console.WriteLine("The current culture is {0} [{1}]",
culture.NativeName, culture.Name);
}
}
// The example displays output like the following:
// The current culture is English (United States) [en-US]
Imports System.Globalization
Module Example
Public Sub Main()
Dim culture As CultureInfo = CultureInfo.CurrentCulture
Console.WriteLine("The current culture is {0} [{1}]",
culture.NativeName, culture.Name)
End Sub
End Module
' The example displays output like the following:
' The current culture is English (United States) [en-US]
Z vlastnosti můžete také načíst hodnotu jazykové verze aktuálního vlákna Thread.CurrentThread .You can also retrieve the value of the current thread's culture from the Thread.CurrentThread property.
Explicitní nastavení vlastnosti CurrentCultureExplicitly Setting the CurrentCulture Property
Pokud .NET Framework 4.6.NET Framework 4.6 chcete změnit jazykovou verzi, která je používána existujícím vláknem, nastavte CultureInfo.CurrentCulture vlastnost na novou jazykovou verzi.Staring with the .NET Framework 4.6.NET Framework 4.6, to change the culture that is used by an existing thread, you set the CultureInfo.CurrentCulture property to the new culture. Pokud tímto způsobem explicitně změníte jazykovou verzi vlákna, tato změna se zachová, pokud vlákno překračuje hranice aplikační domény.If you explicitly change a thread's culture in this way, that change persists if the thread crosses application domain boundaries. Následující příklad změní aktuální jazykovou verzi vlákna na holandština (Nizozemsko).The following example changes the current thread culture to Dutch (Netherlands). Ukazuje také to, že když aktuální vlákno překročí hranice aplikační domény, jeho aktuální jazyková verze zůstane změněna.It also shows that, when the current thread crosses application domain boundaries, its current culture remains changed.
using System;
using System.Globalization;
using System.Threading;
public class Info : MarshalByRefObject
{
public void ShowCurrentCulture()
{
Console.WriteLine("Culture of {0} in application domain {1}: {2}",
Thread.CurrentThread.Name,
AppDomain.CurrentDomain.FriendlyName,
CultureInfo.CurrentCulture.Name);
}
}
public class Example
{
public static void Main()
{
Info inf = new Info();
// Set the current culture to Dutch (Netherlands).
Thread.CurrentThread.Name = "MainThread";
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("nl-NL");
inf.ShowCurrentCulture();
// Create a new application domain.
AppDomain ad = AppDomain.CreateDomain("Domain2");
Info inf2 = (Info) ad.CreateInstanceAndUnwrap(typeof(Info).Assembly.FullName, "Info");
inf2.ShowCurrentCulture();
}
}
// The example displays the following output:
// Culture of MainThread in application domain ChangeCulture1.exe: nl-NL
// Culture of MainThread in application domain Domain2: nl-NL
Imports System.Globalization
Imports System.Threading
Public Class Info : Inherits MarshalByRefObject
Public Sub ShowCurrentCulture()
Console.WriteLine("Culture of {0} in application domain {1}: {2}",
Thread.CurrentThread.Name,
AppDomain.CurrentDomain.FriendlyName,
CultureInfo.CurrentCulture.Name)
End Sub
End Class
Module Example
Public Sub Main()
Dim inf As New Info()
' Set the current culture to Dutch (Netherlands).
Thread.CurrentThread.Name = "MainThread"
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("nl-NL")
inf.ShowCurrentCulture()
' Create a new application domain.
Dim ad As AppDomain = AppDomain.CreateDomain("Domain2")
Dim inf2 As Info = CType(ad.CreateInstanceAndUnwrap(GetType(Info).Assembly.FullName, "Info"),
Info)
inf2.ShowCurrentCulture()
End Sub
End Module
' This example displays the following output:
' Culture of MainThread in application domain Example.exe: nl-NL
' Culture of MainThread in application domain Domain2: nl-NL
Poznámka
Změna jazykové verze pomocí CultureInfo.CurrentCulture vlastnosti vyžaduje SecurityPermission oprávnění s ControlThread nastavenou hodnotou.Changing the culture by using the CultureInfo.CurrentCulture property requires a SecurityPermission permission with the ControlThread value set. Manipulace s vlákny je nebezpečná, protože stav zabezpečení je přidružený k vláknům.Manipulating threads is dangerous because of the security state associated with threads. Proto by toto oprávnění mělo být přiděleno pouze důvěryhodnému kódu a pak pouze podle potřeby.Therefore, this permission should be given only to trustworthy code, and then only as necessary. Nemůžete změnit jazykovou verzi vlákna v částečně důvěryhodném kódu.You cannot change thread culture in semi-trusted code.
Počínaje verzí .NET Framework 4.NET Framework 4 můžete explicitně změnit aktuální jazykovou verzi vlákna buď na konkrétní jazykovou verzi (například francouzština (Kanada)), nebo na neutrální jazykovou verzi (například francouzštinu).Starting with the .NET Framework 4.NET Framework 4, you can explicitly change the current thread culture to either a specific culture (such as French (Canada)) or a neutral culture (such as French). Pokud CultureInfo objekt představuje neutrální jazykovou verzi, hodnoty vlastností jako CultureInfo Calendar ,,, CompareInfo DateTimeFormat NumberFormat a TextInfo odráží konkrétní jazykovou verzi, která je přidružena k neutrální jazykové verzi.When a CultureInfo object represents a neutral culture, the values of CultureInfo properties such as Calendar, CompareInfo, DateTimeFormat, NumberFormat, and TextInfo reflect the specific culture that is associated with the neutral culture. Například dominantní jazyková verze pro anglickou neutrální jazykovou verzi je angličtina (USA); dominantní kultura pro německou jazykovou verzi je němčina (Německo).For example, the dominant culture for the English neutral culture is English (United States); the dominant culture for the German culture is German (Germany). Následující příklad znázorňuje rozdíl ve formátování, pokud je aktuální jazyková verze nastavena na konkrétní jazykovou verzi, francouzštinu (Kanada) a neutrální jazykovou verzi, francouzština.The following example illustrates the difference in formatting when the current culture is set to a specific culture, French (Canada), and a neutral culture, French.
using System;
using System.Globalization;
using System.Threading;
public class Example
{
public static void Main()
{
double value = 1634.92;
CultureInfo.CurrentCulture = new CultureInfo("fr-CA");
Console.WriteLine("Current Culture: {0}",
CultureInfo.CurrentCulture.Name);
Console.WriteLine("{0:C2}\n", value);
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");
Console.WriteLine("Current Culture: {0}",
CultureInfo.CurrentCulture.Name);
Console.WriteLine("{0:C2}", value);
}
}
// The example displays the following output:
// Current Culture: fr-CA
// 1 634,92 $
//
// Current Culture: fr
// 1 634,92 €
Imports System.Globalization
Imports System.Threading
Module Example
Public Sub Main()
Dim value As Double = 1634.92
CultureInfo.CurrentCulture = New CultureInfo("fr-CA")
Console.WriteLine("Current Culture: {0}",
CultureInfo.CurrentCulture.Name)
Console.WriteLine("{0:C2}", value)
Console.WriteLine()
Thread.CurrentThread.CurrentCulture = New CultureInfo("fr")
Console.WriteLine("Current Culture: {0}",
CultureInfo.CurrentCulture.Name)
Console.WriteLine("{0:C2}", value)
End Sub
End Module
' The example displays the following output:
' Current Culture: fr-CA
' 1 634,92 $
'
' Current Culture: fr
' 1 634,92 €
Můžete také použít CultureInfo.CurrentCulture vlastnost spolu s HttpRequest.UserLanguages vlastností pro nastavení CurrentCulture Vlastnosti aplikace ASP.NET na upřednostňovanou jazykovou verzi uživatele, jak ukazuje následující příklad.You can also use the CultureInfo.CurrentCulture property along with the HttpRequest.UserLanguages property to set the CurrentCulture property of an ASP.NET application to the user's preferred culture, as the following example illustrates.
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages(0))
Přepsání aktuální jazykové verze a uživateleThe Current Culture and User Overrides
Systém Windows umožňuje uživatelům přepsat standardní hodnoty vlastností CultureInfo objektu a jeho přidružených objektů pomocí možností místní a jazykové nastavení v Ovládacích panelech.Windows allows users to override the standard property values of the CultureInfo object and its associated objects by using Regional and Language Options in Control Panel. CultureInfoObjekt vrácený CurrentCulture vlastností odráží tato přepsání uživatele v následujících případech:The CultureInfo object returned by the CurrentCulture property reflects these user overrides in the following cases:
Pokud je aktuální jazyková verze vlákna nastavena implicitně
GetUserDefaultLocaleName
funkcí Windows.If the current thread culture is set implicitly by the WindowsGetUserDefaultLocaleName
function.Pokud aktuální jazyková verze vlákna definovaná DefaultThreadCurrentCulture vlastností odpovídá aktuální jazykové verzi systému Windows.If the current thread culture defined by the DefaultThreadCurrentCulture property corresponds to the current Windows system culture.
Pokud je aktuální jazyková verze vlákna nastavena explicitně na jazykovou verzi vrácenou CreateSpecificCulture metodou a Tato jazyková verze odpovídá aktuální jazykové verzi systému Windows.If the current thread culture is set explicitly to a culture returned by the CreateSpecificCulture method, and that culture corresponds to the current Windows system culture.
Pokud je aktuální jazyková verze vlákna nastavena explicitně na jazykovou verzi vytvořenou CultureInfo(String) konstruktorem a Tato jazyková verze odpovídá aktuální jazykové verzi systému Windows.If the current thread culture is set explicitly to a culture instantiated by the CultureInfo(String) constructor, and that culture corresponds to the current Windows system culture.
V některých případech, zejména u serverových aplikací, může být nastavení aktuální jazykové verze na CultureInfo objekt, který odráží přepsání uživatele, nežádoucí.In some cases, particularly for server applications, setting the current culture to a CultureInfo object that reflects user overrides may be undesirable. Místo toho můžete nastavit aktuální jazykovou verzi vlákna na CultureInfo objekt, který neodráží přepsání uživatele následujícími způsoby:Instead, you can set the current thread culture to a CultureInfo object that does not reflect user overrides in the following ways:
Voláním CultureInfo(String, Boolean) konstruktoru s hodnotou
false
useUserOverride
argumentu.By calling the CultureInfo(String, Boolean) constructor with a value offalse
for theuseUserOverride
argument.Zavoláním GetCultureInfo metody, která vrátí do mezipaměti objekt jen pro čtení CultureInfo .By calling the GetCultureInfo method, which returns a cached, read-only CultureInfo object.
Aktuální jazyková verze a aplikace UWPThe current culture and UWP apps
V aplikacích Univerzální platforma Windows (UWP) CurrentCulture je vlastnost pro čtení i zápis, stejně jako je v aplikacích .NET Framework a .NET Core. můžete ji použít k získání a nastavení aktuální jazykové verze.In Universal Windows Platform (UWP) apps, the CurrentCulture property is read-write, just as it is in .NET Framework and .NET Core apps; you can use it both to get and to set the current culture. Aplikace pro UWP ale nerozlišují mezi aktuální jazykovou verzí a aktuální jazykovou verzí uživatelského rozhraní.However, UWP apps do not distinguish between the current culture and the current UI culture. CurrentCultureVlastnosti a CurrentUICulture namapují na první hodnotu v kolekci Windows. ApplicationModel. Resources. Core. ResourceManager. DefaultContext. Languages .The CurrentCulture and CurrentUICulture properties map to the first value in the Windows.ApplicationModel.Resources.Core.ResourceManager.DefaultContext.Languages collection.
V aplikacích .NET Framework a .NET Core je aktuální jazyková verze nastavením pro vlákno a CurrentCulture vlastnost odráží pouze jazykovou verzi aktuálního vlákna.In .NET Framework and .NET Core apps, the current culture is a per-thread setting, and the CurrentCulture property reflects the culture of the current thread only. V aplikacích pro UWP se aktuální jazyková verze mapuje na vlastnost Windows. ApplicationModel. Resources. Core. ResourceManager. DefaultContext. Languages , což je globální nastavení.In UWP apps, the current culture maps to the Windows.ApplicationModel.Resources.Core.ResourceManager.DefaultContext.Languages property, which is a global setting. Nastavení CurrentCulture vlastnosti mění jazykovou verzi celé aplikace; jazykovou verzi nelze nastavit pro jednotlivé vlákno.Setting the CurrentCulture property changes the culture of the entire app; culture cannot be set on a per-thread basis.