无法在 Visual Studio 2017 中更改程序集的默认语言 [英] Can't change default language of an assembly in Visual Studio 2017

查看:46
本文介绍了无法在 Visual Studio 2017 中更改程序集的默认语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序支持三种语言:en、es 和 fr.当我构建我的(干净的,从模板)UWP 应用程序时,我收到消息:

My application supports three languages: en, es, and fr. When I build my (clean, from a template) UWP application, I get the message:

warning PRI257: 0xdef00522 - Resources found for language(s) 'en,es,fr' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language.

然后我进入清单并将默认语言从 en-US 更改为 en-GB,当我重新编译时,我得到:

So then I go into the manifest and change the default language from en-US to en-GB and when I recompile I get:

warning PRI257: 0xdef00522 - Resources found for language(s) 'en,es,fr' but no resources found for default language(s): 'en-GB,en-US'. Change the default language or qualify resources with the default language.

什么给?如何替换 UWP 应用程序中的默认语言,使其不尝试查找 en-US 资源?

What gives? How do I replace the default language in a UWP application so that it doesn't try to find en-US resources?

推荐答案

要删除警告,您必须在 2 个地方更新语言:

To remove the warning, you have to update the language in 2 places:

  • appxmanifest 中的默认语言,在 csproj 文件中保存为 en-GB

中性汇编语言,在AssemblyInfo文件中保存为[assembly: NeutralResourcesLanguage("en-GB")],也可以通过项目的属性>汇编信息进行更改.

Neutral assembly language, which is saved in the AssemblyInfo file as [assembly: NeutralResourcesLanguage("en-GB")] and can also be changed through the project's properties > assembly information.

接下来,您必须使用完整的语言限定符(en-US、en-GB、...)作为默认语言,因为en"只是重定向到 en-US 作为默认语言.其他语言可以是仅限语言的限定符 (fr).

Next to that, you have to use a full language qualifier (en-US, en-GB, ...) as the default language, as 'en' gets just redirected to en-US as the default language. Other languages can be language-only qualifiers (fr).

请注意,使用完整限定符指定您的资产不会影响其他地区语言使用这些资源.

Note that specifying your assets with a full qualifier doesn't break other regional languages from using these resources.

Windows 确实跨区域匹配.例如,en-US 匹配 en-US,然后是 en,然后是 en-*.

Windows does cross regional matching. For example, en-US matches en-US, then en, and then en-*.

恕我直言,最好使用完整的限定词,因为您的翻译是用一种区域语言(通常是主要区域)完成的,因此 fr-FR 比仅 fr 更准确地标记您的资源文件.

Imho it's even better to use the full qualifier as your translation is done in one of the regional languages (quite often the main region), so fr-FR is more accurate to tag your resource file than just fr.

这篇关于无法在 Visual Studio 2017 中更改程序集的默认语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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