Search code examples
c#embedded-resource.net-assembly

C# Assembly.LoadWithPartialName non neutral culture


I have two resource files : Resource.resx and Resource.fr.resx.

I want to be able to load resources in both english and french by using Assembly.LoadWithPartialName

Can I load french resources which are in .\fr\Resource.resx by using Assembly.LoadWithPartialName?

Edit 1:

I am currently using :

var resMgr = new ResourceManager("Currency.Strings", assembly);
result = resMgr.GetString("Romania", CultureInfo.GetCultureInfo("fr"));

Which will not bring anything but the neutral language translation.


Solution

  • Follow this MSDN article to get convenient access to embedded resources with the ResourceManager.

    Basically, with the convention, Resource.resx Resource.fr.resx, you can create a ResourceManager looking at Resource and when you change the current thread's culture to 'fr' then the resource manager starts pulling the strings from the second resource.