From 4289068f92c2c578c8d0b37969b29e739133e5a4 Mon Sep 17 00:00:00 2001 From: luqunl Date: Thu, 28 Jun 2018 11:56:21 -0700 Subject: [PATCH 1/2] Add public implementation CultureDataSupport --- .../System.Private.CoreLib.csproj | 3 ++- .../Globalization/CultureDataSupport.cs | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index dbf45450a7ec..9dd42dafa590 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -303,8 +303,9 @@ - + + diff --git a/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs b/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs new file mode 100644 index 000000000000..5dd4f488ade2 --- /dev/null +++ b/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; + +namespace Internal.Globalization +{ + public static class CultureDataSupport + { + /// + /// Check whether CultureData exists for specified language + /// This API is used for WindowsRuntimeResourceManager in System.Runtime.WindowsRuntime + /// + public static bool IsCultureDataExists(string language) + { + return CultureData.GetCultureData(language, /* useUserOverride */ true) != null; + } + } +} From e24a318867b8eaa17b59759caf874876cbe0504d Mon Sep 17 00:00:00 2001 From: luqunl Date: Thu, 28 Jun 2018 15:08:56 -0700 Subject: [PATCH 2/2] update for comments --- .../System.Private.CoreLib.csproj | 1 - .../Globalization/CultureDataSupport.cs | 21 ------------------- .../WindowsRuntimeResourceManagerBase.cs | 9 ++++++++ 3 files changed, 9 insertions(+), 22 deletions(-) delete mode 100644 src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index 9dd42dafa590..1d522cb65872 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -303,7 +303,6 @@ - diff --git a/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs b/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs deleted file mode 100644 index 5dd4f488ade2..000000000000 --- a/src/System.Private.CoreLib/src/Internal/Globalization/CultureDataSupport.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Globalization; - -namespace Internal.Globalization -{ - public static class CultureDataSupport - { - /// - /// Check whether CultureData exists for specified language - /// This API is used for WindowsRuntimeResourceManager in System.Runtime.WindowsRuntime - /// - public static bool IsCultureDataExists(string language) - { - return CultureData.GetCultureData(language, /* useUserOverride */ true) != null; - } - } -} diff --git a/src/System.Private.CoreLib/src/Internal/Resources/WindowsRuntimeResourceManagerBase.cs b/src/System.Private.CoreLib/src/Internal/Resources/WindowsRuntimeResourceManagerBase.cs index ac18b20c6af6..6594ae6f055e 100644 --- a/src/System.Private.CoreLib/src/Internal/Resources/WindowsRuntimeResourceManagerBase.cs +++ b/src/System.Private.CoreLib/src/Internal/Resources/WindowsRuntimeResourceManagerBase.cs @@ -21,5 +21,14 @@ public abstract CultureInfo GlobalResourceContextBestFitCultureInfo } public abstract bool SetGlobalResourceContextDefaultCulture(CultureInfo ci); + + /// + /// Check whether CultureData exists for specified cultureName + /// This API is used for WindowsRuntimeResourceManager in System.Runtime.WindowsRuntime + /// + public static bool IsValidCulture(string cultureName) + { + return CultureData.GetCultureData(cultureName, /* useUserOverride */ true) != null; + } } }