从 Windows 10 UAP C# 中的代码设置区域性语言
Set culture language from code in Windows 10 UAP C#
我创建了包含文件夹 en、eu 等的主文件夹 "Strings"。
然后我创建资源文件并填充它。所有的战争。
我可以从代码更改应用程序语言吗?例如,将语言添加到组合框,然后在单击组合框后更改我的语言?
您可以为此使用 CurrentCulture and CurrentUICulture。在您的组合框中,您可以有一个区域列表或字符串列表,例如 "en-US"、"nl-BE" 等
var culture = new CultureInfo("en-US"); // replace en-US with the selected culture or string from the combobox
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
同样有趣的是:What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?
我创建了包含文件夹 en、eu 等的主文件夹 "Strings"。 然后我创建资源文件并填充它。所有的战争。 我可以从代码更改应用程序语言吗?例如,将语言添加到组合框,然后在单击组合框后更改我的语言?
您可以为此使用 CurrentCulture and CurrentUICulture。在您的组合框中,您可以有一个区域列表或字符串列表,例如 "en-US"、"nl-BE" 等
var culture = new CultureInfo("en-US"); // replace en-US with the selected culture or string from the combobox
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
同样有趣的是:What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?