开发者

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); }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜