Get Resource Set for WestWind Globalization

359 views Asked by At

I'd like to retrieve all the values back from a particular Resource Set in Westwind. I tried to use GetResourceSet but it doesn't return results. Is there anything that does this?

Thanks, David

1

There are 1 answers

0
BraunSe On

This post is a bit older, but maybe my answer will help you or others.

I have not found a way to get the ResourceSet object with the values of Westwind, but I have found a way to load the keys and values of the resource set.

var resManager = DbRes.GetResourceManager(resourceSetName);
DbResXConverter converter = new DbResXConverter();
var resourceSetDictionary = converter.GetResourcesNormalizedForLocale(resManager, Thread.CurrentThread.CurrentUICulture.Name);

This returns a dictionary with all values of the resource set.

See also: GitHub - JavaScriptResourceHandler.cs - ProcessRequest()

I used this variant to get the data from the database. To get the values of a resx file I use the current assembly:

var resourceSet = new ResourceSet(_resourceSetAssembly.GetManifestResourceStream(resourceSetName));
var resourceSetDictionary = resourceSet.Cast<DictionaryEntry>().ToDictionary(e => e.Key.ToString(), e => e.Value);