From bcfc084bf1a0017969d3f0488e462398ec296988 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 6 Feb 2024 08:59:56 -0600 Subject: [PATCH 1/2] Manually adding zh-CN and zh-TW to LanguagePolicy --- .../LanguagePolicy.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs index 2f10cad46e..e3f512d00f 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs @@ -74,6 +74,13 @@ private static IDictionary DefaultPolicy(string[] defaultLangu policy.Add(language, fallback.ToArray()); } + // Locales like zh-CN, zh-TW, etc... are deprecated locales returned by CultureInfo. + // However, many still supply the old value when setting up WebChat. Since we + // really just need the progression to check for LG/LU files, we are manually adding + // them so that these files are found. + policy.Add("zh-cn", new string[] { "zh-cn", "zh" }); + policy.Add("zh-tw", new string[] { "zh-tw", "zh" }); + return policy; } } From b9a23be3a5a87d57b62179ae83bbacb0676f083d Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 6 Feb 2024 09:23:03 -0600 Subject: [PATCH 2/2] Only adding zh-cn to LanguagePolicy if missing. --- .../LanguagePolicy.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs index e3f512d00f..ce3b10b1a0 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs @@ -77,9 +77,16 @@ private static IDictionary DefaultPolicy(string[] defaultLangu // Locales like zh-CN, zh-TW, etc... are deprecated locales returned by CultureInfo. // However, many still supply the old value when setting up WebChat. Since we // really just need the progression to check for LG/LU files, we are manually adding - // them so that these files are found. - policy.Add("zh-cn", new string[] { "zh-cn", "zh" }); - policy.Add("zh-tw", new string[] { "zh-tw", "zh" }); + // them so that these files are found. This is OS version specific. + if (!policy.ContainsKey("zh-cn")) + { + policy.Add("zh-cn", new string[] { "zh-cn", "zh" }); + } + + if (!policy.ContainsKey("zh-tw")) + { + policy.Add("zh-tw", new string[] { "zh-tw", "zh" }); + } return policy; }