3

I created a few resource files for different languages. (E.g. resource.resx, resource.nl-NL.resx etc)

At this moment I only can see the result with the phone emulator. (By changing the language setting in the phone emulator)

For the design phase I want to see the result in different languages at design time. For example Dutch. (Or even better, some pseudo language)

It looks like Visual Studio (2012) and Blend both use the default resource file. (resource.resx)

Is there a way to use another resource file?

4

2 回答 2

0

我找不到一个好的解决方案,所以我做了一件非常丑陋的事情。工作,但一点也不好玩。

我重命名了资源文件,这样我想看到的语言就没有语言后缀(而原来的语言有一个我知道我不会使用的后缀)。

一些警告:

  • 原始语言中性资源文件具有“PublicResXFileCodeGenerator”(或等效项)的“自定义工具”属性。作为新的中性语言的资源文件需要此属性。待我们测试后回到原来的情况时,必须将其删除。
  • 如果您要测试的语言没有重新定义所有字符串,您可能会遇到一些编译时错误,您需要从原始中性资源文件中复制丢失的字符串。

唯一的优点是无需重新启动模拟器即可查看此语言的运行情况。

于 2014-02-12T13:57:23.120 回答
-1

您可以通过将以下代码插入到 app.xaml.cs 中的 InitializePhoneApplication 中来设置 CultureInfo 属性

private void InitializePhoneApplication()
{
    Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK");
    Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

这将覆盖文化,因此您不必在模拟器内更改它。

于 2013-04-04T11:18:32.427 回答