From 89831352ec6d76bfe624d3533309a6d0ea76213e Mon Sep 17 00:00:00 2001 From: tracyboehrer Date: Tue, 6 Feb 2024 09:40:01 -0600 Subject: [PATCH] Manually adding zh-CN and zh-TW to LanguagePolicy (#6745) * Manually adding zh-CN and zh-TW to LanguagePolicy * Only adding zh-cn to LanguagePolicy if missing. --------- Co-authored-by: Tracy Boehrer --- .../LanguagePolicy.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs index 2f10cad46e..ce3b10b1a0 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/LanguagePolicy.cs @@ -74,6 +74,20 @@ 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. 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; } }