Global Resources for Additional Cultures Ignored in ASP.NET Web Application

I have this ASP.NET web application that I am developing with Visual Studio 2015 and .NET 4.6.1. I make extensive use of local and global resources to localize my application in English (default), Spanish, and Galician. On my development machine that uses IIS Express, everything works fine. But when I publish a web application on our production server that uses IIS 7 in Windows Server 2008, the Spanish global resource is ignored, and only English is used by default, as well as Galician.

I publish a web application through the "file system" method of web publishing. As far as I can see, .resx files are not deployed for global resources; instead, files named App_GlobalResources.resources.dll deployed to the bin , bin/es and bin/gl folders. In addition, the file MyNamespace.resources.dll deployed to bin/es , but not bin/gl , which is very odd.

I should also say that I switch cultures to my code by setting Thread.CurrentThread.CurrentUICulture to a CultureInfo object based on either en-GB , es-ES , or gl-ES .

I tried to name global resource files in my code using neutral (e.g. gl ) and localized (e.g. gl-ES ) forms of culture codes. This does not seem to make any difference. In addition, local resource files are named using neutral options.

Any ideas why Spanish global resources are being ignored? Thanks.

+5
source share
1 answer

Naming resource files should work correctly, for example. Have you tried naming files using the full culture specification, for example. ResourceTexts.resx , ResourceTexts.es-ES.resx and ResourceTexts.gl-ES.resx . After publication, they should be available in the App_GlobalResources folder.

+4
source

Source: https://habr.com/ru/post/1258762/


All Articles