如何设置 UWP 应用的默认语言? [英] How can i set default language of UWP app?

查看:30
本文介绍了如何设置 UWP 应用的默认语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种语言.en-US 和 ru-Ru

I have 2 languages. en-US and ru-Ru

当我将默认语言设置为 ru-RU 时出现错误:

When i set Default Language to ru-RU i got the error:

PRI257: 0xdef00522 - 找到语言ru-ru,en-us"的资源但没有找到默认语言的资源:'ru-RU'.改变默认语言或使用默认语言限定资源.

PRI257: 0xdef00522 - Resources found for language(s) 'ru-ru,en-us' but no resources found for default language(s): 'ru-RU'. Change the default language or qualify resources with the default language.

怎么了?

推荐答案

我遇到了同样的问题:找到了语言nl-be,en-us"的资源,但没有找到默认语言的资源:nl-be,en-us".所以它抱怨寻找资源,它没有找到.这可能与 OP 问题的根本原因不同,但我想分享我的修复,这就是为什么我将解释我如何修复的搜索路径它下面.也许您可以在任何这些步骤中找到适合您特定情况的解决方案.开始:我的项目在其 appxmanifest 中有默认语言 nl-BE.

I had the same issue: Resources found for language(s) 'nl-be,en-us' but no resources found for default language(s): 'nl-be,en-us'. So it complains about finding resources, it doesn't find. It may not be the result of the same root cause as OP's problem, but I want to share my fix, that's why I'll explain my search path of how I fixed it below. Maybe you can find a solution for your specific situation in any of these steps. To start: My project has as default language nl-BE in its appxmanifest.

我的搜索将我带到此页面 https://docs.microsoft.com/en-us/windows/uwp/app-resources/specify-default-resources-installed.尝试此操作后,我发现当我构建为 Release 而不是 Debug 时,警告没有出现.在上面的文章中,他们提到了\obj\\priconfig.xml 所以我去那里看看.

My search led me to this page https://docs.microsoft.com/en-us/windows/uwp/app-resources/specify-default-resources-installed. After trying this, I discovered the warning didn't show up when I build as Release instead of Debug. In the article above, they mentioned <ProjectFolder>\obj\<ReleaseConfiguration folder>\priconfig.xml so I went there and took a look.

在这个文件夹中有所有这些resource*.resfile.我检查了每一个.我找不到任何问题(它们都包含两种语言(nl-BE 和 en-US)的资源).也就是说,当我查看 Release 时.但是,当我查看 Debug 对应文件时,我发现了一个 resources.en-us.resfiles 文件.没有 nl-be 对应物,它包含单个资源 obj\x64\Debug\FxResources.System.Text.Json.SR.resw.据我所知,这些是代码分析器的资源(不是我主动添加到我的项目中的东西),并且没有 nl-be 对应物.

In this folder there are all these resource*.resfiles. I checked each one of them. I couldn't find any issues (they all contained resources for both languages (nl-BE and en-US)). That is, when I look in Release. However, when I looked in the Debug counterpart, I found a resources.en-us.resfiles file. There was no nl-be counterpart and it contained a single resource obj\x64\Debug\FxResources.System.Text.Json.SR.resw. As far as I know, these are resources for code analyzers (not something I actively added to my project) and there is no nl-be counterpart.

我的项目在其 appxmanifest 中有默认语言 nl-BE.设置 priconfig.default.xml 中的/> 当然仍然没有修复 Debug 中的警告(没有 nl-BE FxResources),但是改变了appxmanifest 中的默认语言和 priconfig.default.xmlen-US 确实修复了 Debug 中的警告.resources.en-us.resfiles 文件不再出现,资源 FxResources.System.Text.Json.SR.resw 被添加到 resources.resfile.发现这一切后,我将我的项目恢复到 nl-BE 并且不再打扰警告.

My project has as default language nl-BE in its appxmanifest. Setting <qualifier name="Language" value="nl-BE" /> in priconfig.default.xml of course still didn't fix the warning in Debug (there are no nl-BE FxResources), but changing the default language in the appxmanifest and priconfig.default.xml to en-US did fix the warnings in Debug. The resources.en-us.resfiles file doesn't appear anymore and the resource FxResources.System.Text.Json.SR.resw is added to the resources.resfile. After discovering all this, I reverted my project back to nl-BE and don't bother anymore with the warning.

TL;DR:这只是因为代码分析器的缘故,Release 中没有包含这些分析器.

TL;DR: It only happens because of the code analyzers, which are not included in Release.

这篇关于如何设置 UWP 应用的默认语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆