<p>I need to store products for an e-commerce solution in a database. Each product should have descriptive information, such as name, description etc.</p>

<p>I need any product to be localized to x number of languages.</p>

<p>What I've done so far, is to make any column that should be localized and <code>nvarchar(MAX)</code> and then i store an XML string like this:</p>

<pre><code>&lt;cultures&gt;
    &lt;culture code="en-us"&gt;Super fast laptop&lt;/culture&gt;
    &lt;culture code="da-dk"&gt;Super hurtig bærbar&lt;/culture&gt;
&lt;/cultures&gt;
</code></pre>

<p>And when I load it from the database, into my business logic objects, I parse the XML string to a <code>Dictionary&lt;string, string&gt;</code> where the key is the culture/language code.</p>

<p>So when I want to display the name of a product, I do this:</p>

<pre><code>lblName.Text = product.Name["en-us"];
</code></pre>

<p>Does anyone have a better solution?</p>

[{'answer_id': 28603, 'author': 'bdukes', 'author_id': 2688, 'author_profile': 'https://Stackoverflow.com/users/2688', 'pm_score': 1, 'selected': False, 'text': '<p>Rob Conery\'s MVC Storefront webcast series has <a href="http://blog.wekeroad.com/mvc-storefront/mvcstore-part-5/" rel="nofollow noreferrer">a video on this issue</a> (he gets to the database around 5:30).  He stores a list of cultures, and then has a Product table for non-localized data and a ProductCultureDetail table for localized text.</p>\n'}, {'answer_id': 28606, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>resource files</p>\n'}, {'answer_id': 28871, 'author': 'Luke', 'author_id': 327, 'author_profile': 'https://Stackoverflow.com/users/327', 'pm_score': 3, 'selected': True, 'text': '<p>You should store the current language somewhere (in a <a href="http://www.yoda.arachsys.com/csharp/singleton.html" rel="nofollow noreferrer">singleton</a>, for instance) and in the product.Name property use the language setting to get the correct string.  This way you only have to write the language specific code once for each field rather than thinking about languages everywhere the field is used.  </p>\n\n<p>For example, assuming your singleton is defined in the Localizer class that stores an enum corresponding to the current language:</p>\n\n<pre><code>public class Product\n{\n  private idType id;\n  public string Name\n  {\n    get\n    {\n      return Localizer.Instance.GetLocalString(id, "Name");\n    }\n  }\n}\n</code></pre>\n\n<p>Where GetLocalString looks something like:</p>\n\n<pre><code>  public string GetLocalString(idType objectId, string fieldName)\n  {\n    switch (_currentLanguage)\n    {\n      case Language.English:\n        // db access code to retrieve your string, may need to include the table\n        // the object is in (e.g. "Products" "Orders" etc.)\n        db.GetValue(objectId, fieldName, "en-us");\n        break;\n    }\n  }\n</code></pre>\n'}, {'answer_id': 76693, 'author': 'Craig Fisher', 'author_id': 13534, 'author_profile': 'https://Stackoverflow.com/users/13534', 'pm_score': 0, 'selected': False, 'text': '<p>This is basically the approach we took with Microsoft Commerce Server 2002. Yeah indexed views will help your performance.</p>\n'}]
['https://Stackoverflow.com/questions/28577', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2972/']