I am developing a multilingual (English, Arabic) application using MVC. This application should display both tags and data based on resource files.
Databasedesigned to store translated fields in the same tables, for example
Gender[Id, Name,ArabicName]
Person[Id,FirstName,FatherName,FamilyName,ArabicFirstName,
ArabicFatherName,ArabicFamilyName,GenderId]
I managed to display everything dropdownlistbased on resources by switching between fields Nameand ArabicNameusing:
ViewBag.Gender= new SelectList(mEntities.Genders.ToList(), "Id",
Resources.Global.Name);
// Name value in the Global.resx is Name and in Global.ar.resx is ArabicName
as well as display LabelForwith:
[Display(Name="FirstName", ResourceType =typeof(Resources.Global))]
public string FirstName{get;set;}
My question is: is it possible to switch between FirstName value and ArabicFirstNameusing DisplayForand how to achieve this in MVC?
For example, to display: FirstName = Antony for english , ArabicFirstName = انطوان for arabic
source
share