Dunc
Dunc

Reputation: 18922

Culture-specific resource files not being generated in Visual Studio 2013 SP2

I have created an MVC 5 project in VS2013 (with Update 2). If I add a resource file to the App_GlobalResources folder, it correctly generates the corresponding .designer.cs file when I save.

However, if I make a copy of the resource file and include a culture in the name, e.g. Resource.fr-FR.resx, the designer file is always empty.

Steps to replicate:

  1. Create an App_GlobalResources folder (right-click project > Add ASP.NET Folder > ...)
  2. Right click this folder > Add > Resources file
  3. Accept default name (Resource1)
  4. Make a copy (you should have Resource1 - Copy.resx)
  5. Rename the copy to Resource1.fr-FR.resx
  6. Inspect the .designer.cs file - it is empty

Maybe this has something to do with the custom tool (GlobalResourceProxyGenerator) and file names with a dot/period? I'm pretty new to localization so I'm probably doing it wrong!

Upvotes: 4

Views: 1621

Answers (1)

MorioBoncz
MorioBoncz

Reputation: 920

Check if it still resolves to correct resources when you change UICulture of the thread. I bet it does. Translation data is included in resx file itself. I looks like Resources class is only generated for main / default fallback language (if you include dot in the name tool does not generate the Resources class). Resources class does not include any culture specific values so one is enough. For culture specific resx files you can set No code generation.

Upvotes: 2

Related Questions