views:

58

answers:

2

Looking around I see a lot of articles about localization in ASP.NET MVC, but they all do the same thing - setup a .resx file, set its build action to the right tool to make sure a class with static string properties is created, then use that class.

Is there any way at all to use an existing resource provider I already have? Or at the very least somehow have those .resx files live outside the main assembly (not in App_GlobalResources)?

Edit: valid question raised below - why can't I just use my resource provider? the thing is it works, but breaks my tests as HttpContext is null in those. If there is a way to fetch my global resources via the resource provider without calling HttpContext.GetGlobalResourceObject that would most likely be a good solution.

A: 

You could always move all of your localized stuff into a separate project and just reference that project from your MVC project. Would that work for you?

No Refunds No Returns
This is what i do. Works great and keeps it all together nicely.
Patricia
Yea, that will work if there is no way to use resource providers. But its far from ideal as my resource provider has some features I really want to use.
Juvaly
A: 

Why not just use the resource provider you already have, then? I'm not understanding why you can't just make calls against it as you would in another project.

Paul
HttpContext is null and therefore breaks all tests. Makes it unusable for me.
Juvaly