views:

189

answers:

2

The shop that I work at basically has developers creating controls and a backend platform, and producers to skin and customize sites for each client.

We are currently using resx files in App_LocalResources folder to expose copy in many of our controls. The problem is that the producers have a hard time finding the correct resx for a specific string, when our controls are spread out in a deeply nested folder tree that they don't really understand.

We want to put everything in one place, and App_GlobalResources seems like a good solution (we don't mind adopting a naming convention for resource strings to avoid collisions) However, moving a file from an App_LocalResources folder to App_GlobalResources doesn't seem to work (just throws a resource not found exception)

Any idea why this is happening? Any other suggestions for tackling the problem?

+1  A: 

Perhaps the code is calling GetLocalResourceObject() instead of GetGlobalResourceObject()?

Edit: based on the comments below and given that you're using implicit localization, the correct answer is that implicit localization requires local resources.

As for an alternative, I would try using a custom resource provider instead of the default and make the CreateLocalResourceProvider() return the same as the CreateGlobalResourceProvider() method: a GlobalResXResourceProvider instance (or anything else that suits your needs).

Gonzalo
actually, we are using meta:resourcekey="key" in the markup
Matt Briggs
Oh. Then that's the problem. Implicit localization requires local resources (see http://msdn.microsoft.com/en-us/library/ms2289093(VS.80).aspx). You'll have to switch to explicit localization.
Gonzalo
Link that works: http://msdn.microsoft.com/en-us/library/ms247246(VS.80).aspx
Gonzalo
+1  A: 

There is difference to get local resources and Global resources, If you are trying to put your localized resources to Global Resources then you need to change your code as well to access resources like...

Accessing Global resources

Text="<%$ Resources:GlobalRes, YourKey %>"

Accessing Local resources

meta:resourcekey="YourKey"
Muhammad Akhtar