Resource with database

1

Well I have the following environment:

Table:

Livro
    id
    titulo
    tituloEN
    descricao
    descricaoEN

Controller:

[LivroController]
public ActionResult Index()
    {
        var livros = bdLivro.ListarTodos();
        return View(livros);
    }

View:

[Index]
@model List<Dominio.PUPO_Livro>
@foreach (var item in Model)
{
     if(languagePT())
     {
         <p>@item.titulo</p>
         <p>@item.descricao</p>
     }
     else
     {
         <p>@item.tituloEN</p>
         <p>@item.descricaoEN</p>
     }
}

I would like to know if there is any other method, other than by if.

    
asked by anonymous 25.07.2014 / 15:09

1 answer

1

I think you are looking for internationalization. Take a look at this answer here .

Edited:

With respect to internationalization of the database what you can do is:

1 - Replicate the entire database and leave each language with its own database. In this case, when you switch languages, you will need to modify the connection string and runtime. A possible problem with this approach is with regard to data synchronization, which may or may not cause some problem;

2 - Another solution that you can adopt is simply add a new ID value to each table that needs to be internationalized called "MasterID" and another field that specifies the language. The ID points back to the parent record. The rest of the structure remains the same.

I found this information here . Try to read to get more details on how to do it.

    
25.07.2014 / 15:14