Get current culture in MVC 3 application
I'm trying to create a small开发者_JS百科 app that contains errormessages in database, so they'll be easy to edit etc from a webpage.
So my question is what do I need to put in my class, the "...typeof(MyCustomErrorApp)" to get the current culture? What needs to be derived (?) from etc?
/Lasse
The ASP.NET resource provider is extensible. So you could write your custom ResourceProviderFactory
.
I assume you are talking about validation attributes - those are loading resources from static class using reflection. You can simply target any class with static properties:
public class DBErrorResources
{
public static string Required
{
get { return DB.FetchErrorMesssage(CultureInfo.CurrentUICulture); }
}
}
精彩评论