views:

221

answers:

1

Im making a asp.net(2.0) website.

I have defined two resource files in the App_GlobalResources folder 1) Website.ar.resx 2) Website.en.resx

Im trying to obtain the ResourceManager programatically.

Now, if I would have only defined Website.resx, VisualStudio automatically starts showing me a 'Resouces' namespace with the Class 'Website' that I can use to either directly access the resource objects and also gives me a ResourceManager property.

But when I renamed the file to Website.ar.resx that stopped happening.

My question is how can I obtain the ResourceManager object programatically for a desired culure?

A: 
  1. You must have default(neutral) resource table in your assembly. This is the one without culture identifier in the name. There is an [assembly: NeutralResourcesLanguageAttribute(culture-identifier)] attribute but i do not know if it will help you.

  2. To get ResourceManager for desired culture, you must set Thread.CurrentThread.CurrentUICulture to desired culture before getting the ResourceManager.

Alex Reitbort