asp.net MVC - how to get complete local and global resources

Posted by Buthrakaur on Stack Overflow See other posts from Stack Overflow or by Buthrakaur
Published on 2009-06-03T08:38:54Z Indexed on 2010/04/06 12:03 UTC
Read the original article Hit count: 383

Filed under:
|

I'm localizing application and need to provide JSON representation of local and global resources for JS part of application for all views. My current idea is I'd implement HtmlHelper extension methods like GetLocalResourcesJSON/GetGlobalResourcesJSON which should encode all resource keys+values and return them JSON encoded as string (I'd implement caching as well).

At the moment I'm able to retrieve single specific key from global or local resource belonging to current view (using httpContext.GetGlobalResourceObject/GetLocalResourceObject), but I'm not able to find out how to retrieve whole resource object and iterate all its keys+values. Is there any method how to achieve this?

it looks like ResourceProviderFactory could be the the key to this problem, but it's not accessible publicly anywhere. I could instantiate ResourceExpressionBuilder and use reflection to retrieve the provider using GetLocal/GlobalResourceProvider() methods, but I don't like using reflection here at all...

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about resources