views:

20

answers:

2

I need to design a configurable content system for all of the text in our web application that will tie together our need for Translation with the ability for Groups of users, Subgroups of users, and single Users to configure what a given label, Error Message, or piece of system text says.

Because everything needs to be configurable through the interface, resource files don't seem like the solution.

I don't expect to find something like this out of the box. How would you go about designing something like this, or what would you begin to configure in order to get this functionality?

A: 

Create a simple table along the lines of:

table Resources {
  language varchar(100)
  label varchar(100) /* you might consider a different key type, but this would be easiest on coding */
  value varchar(max)
}

You might simply cache the whole table on the web server to perform the look ups locally and simply expire the cache when a value is changed.

It's a relatively easy thing.

Chris Lively
Make sure you are using UTF8 Encoding. Nothing sucks more than havin encoding problems
citronas
A: 

I have achieved the type of functionality you are looking for by creating a database backed custom resource provider, and setting the <globalization> tag in the Web.Config to point to your custom provider. see: http://msdn.microsoft.com/en-us/library/aa905797.aspx

Then within your pages and code, you can refer to GetGlobalResourceObject or GetLocalResourceObject to get localized resources.

Whilst this is primarily designed for multiple languages, I have used it in combination with custom locale functionality to provide different labels, error messages and text to different groups of users.

Clicktricity