开发者

How do you centralize error message text, prompts, and other site verbiage?

I'm using ASP.NET MVC 2.0 and C#. I've done this before by rolling my own solution using the database, but I was wondering if there's开发者_JS百科 an easier way or an established practice for doing this. I'm also hoping the solution I choose makes it easy to support multiple languages later.


I use a database in conjunction with a utility application which generates the resx files. The database can store multiple languages, and the utility application generates all the resx files for different languages.

I then use the language settings in the browser (passed back as part of the Request object I believe) to decide which resx file to use.


If you intend to localize messages later it is a good practice to store them in resource files. Here's a nice blog post.


I use a static cached Dictionary<string, string> tied to the CurrentUICulture with various providers. It is possible to use a database, an xml file, ... as a localization source.

It has javascript and silverlight counterparts as well in order to download text from application servers dynamically (if necessary).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜