MSBuild AssignCulture 任务将空区域性分配给伪区域性(qps-ploc、qps-plocm)

发布于 2024-12-18 22:00:22 字数 784 浏览 5 评论 0原文

我的项目中有许多本地化的 RESX 文件:

    Messages.resx
    Messages.de.resx
    Messages.qps-ploc.resx

最后一个是用于测试目的的伪本地化文本资源。我希望将其编译为卫星程序集(即project/qps-ploc/project.resources.dll)作为其余的本地化。但由于某种原因,AssignCulture 任务正在将空区域性分配给该资源,并且不会将其编译为结果。

MSBuild 日志中的片段:

    Task "AssignCulture"
      Culture of "de" was assigned to file "Resources\Messages.de.resx".
      Culture of "" was assigned to file "Resources\Messages.resx".
      Culture of "" was assigned to file "Resources\Messages.qps-ploc.resx".
    Done executing task "AssignCulture".

已在注册表中启用伪本地化区域性,如此处所述 并且 new CultureInfo("qps-ploc") 返回正确的伪区域性。

这是AssignCulture 的预期行为还是只是我错误地使用了它?

I have a number of localized RESX files in my project:

    Messages.resx
    Messages.de.resx
    Messages.qps-ploc.resx

The last one being a pseudo-localized text resource for testing purposes. I would like it to be compiled to a satellite assembly (i.e. project/qps-ploc/project.resources.dll) as the rest of localizations . But for some reason AssignCulture task is assigning empty culture to this resource and it's not compiled as the result.

Snippet from MSBuild log:

    Task "AssignCulture"
      Culture of "de" was assigned to file "Resources\Messages.de.resx".
      Culture of "" was assigned to file "Resources\Messages.resx".
      Culture of "" was assigned to file "Resources\Messages.qps-ploc.resx".
    Done executing task "AssignCulture".

Pseudo-localization cultures have been enabled in registry as described here
and new CultureInfo("qps-ploc") returns correct pseudo culture.

Is this an expected behavior from AssignCulture or just me using it wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烂人 2024-12-25 22:00:22

不知道发生了什么,但突然一切都开始工作了。也许与系统重启有关。

Not sure what happened, but suddenly everything started to work. Perhaps somehow related to system reboot.

小ぇ时光︴ 2024-12-25 22:00:22

我也遇到了同样的问题,重启后也自行解决了。我认为这是因为AssignCulture任务必须检查资源文件中使用的区域性,如果它不是标准区域性或在Windows\Globalization文件夹中具有.nlp文件的自定义区域性,则分配在编译期间失败并且没有资源文件被创建。

就我而言,我刚刚创建了一个自定义区域性,但我猜 Visual Studio 并不知道它,因为它必须缓存了在上次系统重新启动时找到的资源文件。再次重新启动电脑,肯定已经更新了缓存的资源文件(包括自定义资源文件),AssignCulture 任务就能够成功匹配资源并创建资源文件。

I had the same problem and it also resolved itself after a reboot. I think it's because the AssignCulture task must check the culture used in a resource file and, if it's not a standard one or a custom culture that has an .nlp file in your Windows\Globalization folder, the assignment fails during compilation and no resource file is created.

In my case I'd just created a custom culture but I guess Visual Studio didn't know about it as it must have cached the resource files that were found at the previous system reboot. Rebooting the PC again must have updated the cached resource files (including the custom ones) and the AssignCulture task was then able to match the resource successfully and the resource file was created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文