In some cases in our project we have to ignore current culture of application and get resources in English.
Basically, we do it like for all languages
<label>@ModelEntities.Properties.Resource.Gender</label>
How is it possible to get in English only?
I assume we have somehow created some reference to Resource.resx ?
I have used
ResourceManager rm = new ResourceManager("Resource.Strings",
Assembly.GetAssembly(typeof(ModelEntities.Properties.Resource)));
var s = rm.GetString("Age");
But it seems like not working.
Thank you!
I found the working solution.
First of all our resource files are ending like
Resource.resx
and not like Resources.resx
And in second we have resources in a separate assembly: ModelEntities
So the working code is following
var resourceManager = new ResourceManager(typeof(ModelEntities.Properties.Resource));
var genderString = resourceManager.GetString("Gender", ci);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With