tags:

views:

32

answers:

1

If we are going to localize content so we can retrieve SAME content item in different languages what would be the best practice?

One solution is to put localized content into separate class (table):

public class Category
{
 public Guid ID {get;set;}
 private CategoryContent GetOrCreateCurrentCultureContent()
 {
   // return (and create if not exists)
   // instance of CategoryContent regarding to current culture
 }
 // encapsulate content properties
 public string Title {
 get {
  return GetOrCreateCurrentCultureContent().Title;
 } 
 set {
  GetOrCreateCurrentCultureContent().Title = value;
 }
}

public class CategoryContent
{
 public string Title {get;set;}
 ...
}

Any better idea?

A: 

It seems you are using C#, so I would suggest going through articles on

[http://msdn.microsoft.com/en-us/goglobal/bb688096.aspx%5D%5B1%5D

At the same time, localizing dynamic content (content that comes from configuration) is a different story.

We have a thin UI layer, and create services that provide API for the UI. These services can return objects that have dynamic content. We write a wrapper over these services that intercepts the call, and returns a translated content.

The actual translations are stored in XML files and there is a class that returns a translated string for every string in configuration.

Tanmay
Thanks. Something messed url. So the correct url is http://msdn.microsoft.com/en-us/goglobal/bb688096.aspx
Andrej Kaurin