2

I try to load a specific resource set or the default resource set if the specific one is not found.

Here is the code :

ResourceSet resourceSet = MyLib.MyResource.ResourceManager.GetResourceSet( culture: someCulture, createIfNotExists: false, tryParents: false ); 

When the specific resx file exist, it works perfectly fine, but for the culture {en}, which is the default one corresponding to the file MyResource.resx it doesn't work (it means ressourceSet = null)

But if I copy/paste the file "MyResource.resx", and rename it "MyResource.en.resx", then include it in my solution, it suddenly works

My question is: how can I specify that {en} matches the default "MyResource.resx" file?

1 Answer 1

3

Try this:

ResourceSet resourceSet = MyLib.MyResource.ResourceManager.GetResourceSet( culture: CultureInfo.InvariantCulture, createIfNotExists: false, tryParents: false ); 

To get more details about CultureInfo.InvariantCulture please refer to the office documentation: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.invariantculture

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.