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?
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