【问题标题】:Set culture language from code in Windows 10 UAP C#从 Windows 10 UAP C# 中的代码设置文化语言
【发布时间】:2016-01-08 21:16:51
【问题描述】:

我用文件夹 en、eu 等创建主文件夹“Strings”。 然后我创建资源文件并填充它。都战。 我可以从代码更改应用程序语言吗?例如将语言添加到组合框,然后单击组合框后更改我的语言?

【问题讨论】:

标签: c# localization windows-phone-8.1 resources windows-10


【解决方案1】:

您可以为此使用CurrentCultureCurrentUICulture。在您的组合框中,您可以有一个文化列表或字符串,如“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?

【讨论】:

  • thanls,但它的命名空间不存在于 Windows 10 uap 中,但我发现这个 varculture = new System.Globalization.CultureInfo("ru-RU"); // 将 en-US 替换为组合框中选定的文化或字符串 System.Globalization.CultureInfo.CurrentCulture =culture; System.Globalization.CultureInfo.CurrentUICulture = 文化;但这对我不起作用;(
猜你喜欢
  • 2015-12-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-05
  • 2011-06-24
  • 1970-01-01
相关资源
最近更新 更多