views:

36

answers:

3

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 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.

A: 

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

Darin Dimitrov
A: 

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).

Jaroslav Jandek
+1  A: 

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.

Antony Scott
if you're interested I have just perfected this technique in MVC2 using the browsers language settings.
Antony Scott