+1  A: 

I'm not sure you'd want to do this in the database. I think it would be more sensible to use a configuration file or resource that defines Culture-specific names.

You might also check Microsoft's documentation on internationalization and localization.

gaustin
Agreed. This is the correct way to do iot.
Craig Stuntz
Resources are more dedicated to stores static values than dynamic ones, like in this case. Animal is a definition of an entity that you don't know how many values (instances) will has. In this case the better approach (not the only one) is the suggested by Pyttroll
Lester
+2  A: 

What I did in a similar situation is created a view say LocalizedAnimals which is a flat representation of that 2 table structure and created an EF model for that view. So when I need to display say French animal data I would filter those LocalizedAnimals and have nice simple object list as a result.

Something like this:

var localizedAnimals = myContext.LocalizedAnimals.Where(
                           p => p.CultureName == Thread.CurrentThread.CurrentUICulture.Name
                       );
Alan Mendelevich
A: 

Sorry Alan, but if you create a new "Animals" with 3 localization how you doing?

Fabrizio Gatto
A: 

i tried this:

For wrapping City with it's selected LocalLanguage
public class CityLocolized
{
    public City City { get; set; }
    public String LocalName { get; set; }
}

Here, we chose the either default so with if else no join, else chose from CityCulture table

    string lang = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
    List<CityLocolized> citiesLocalized = null;
    if (lang == "en") // which is default in db
    {
        citiesLocalized = (from c in fke.Cities
                        select new CityLocolized
                        {
                            City = c,
                            LocalName = c.Name
                        }
                        ).ToList();
    }
    else // for other languages 
    {
        citiesLocalized = (from c in fke.Cities
                        join cc in fke.CityCultures
                        on c.Id equals cc.CityId
                        where cc.LangId == lang
                        select new CityLocolized
                        {
                            City = c,
                            LocalName = cc.LocalName
                        }).ToList();

    }
   and this one for passing View:

   ViewData["CitiesLocolized"] = new SelectList(citiesLocalized, "City.Id", "LocalName");

  finally at view:
  <%:Html.DropDownListFor(model => model.CityId,  ViewData["CitiesLocolized"] as SelectList)%>

  i think this is it.

Also instead of if else which seems weird, this this below with some join cost:

        cityLocos = (from c in fke.Cities
                        join cc in fke.CityCultures
                        on c.Id equals cc.CityId
                        where cc.LangId == lang
                        select new CityLoco
                        {
                            City = c,
                            LocalName = lang == "en" ? c.Name : cc.LocalName // "en" being default language
                        }).ToList();

moguzalp

moguzalp