【发布时间】:2016-02-18 20:46:12
【问题描述】:
我正在构建一个支持两种语言(en 和 de)的 UWP 应用。我创建了Resource.resw 文件和testfile.xml,这基本上是我的应用程序的数据源。如果我直接从 Visual Studio(DEBUG 或 RELEASE 模式)运行应用程序,它工作正常,但是一旦我从商店安装它或通过 WinAppDeployCmd.exe 将其侧载到设备,它不会从 @987654330 加载资源@
这是我在 Strings 目录中的文件结构:
我有指向Resources.resw 文件中指定的测试文件的链接,如下所示:
应用启动后,我使用ResourceLoader 检索Testfile 键的值以加载正确的(en 或 de)文件。
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
var value = loader.GetString("Testfile");
var testfile = Path.Combine(Package.Current.InstalledLocation.Path + "/Strings/", value);
在构建过程中,这些警告会显示在输出窗口中
MakePRI : warning 0xdef01051: No default or neutral resource given for 'Files/Project/Strings/testfile_de.xml'. The application may throw an exception for certain user configurations when retrieving the resources.
MakePRI : warning 0xdef00522: Resources found for language(s) 'en,de' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language.
您知道为什么通过商店安装或旁加载应用时资源没有加载吗?
【问题讨论】:
-
将您的文件夹更改为 en-US 而不是 en,因为它似乎认为这是默认设置
标签: c# wpf xaml localization win-universal-app