MSBuild AssignCulture task assigns empty culture to pseudo-cultures (qps-ploc, qps-plocm)

596 views Asked by At

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?

2

There are 2 answers

0
orom On BEST ANSWER

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

0
Linq On

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.