QA InfoTech » Dot Net » Multilingual MVC Application

Multilingual MVC Application

Multilingual MVC Application


In this post I will explain how to create multilingual application in MVC. This sample is developed to provide the solution to Multilanguage support for MVC project.This application currently support two languages such as es-Es and en-En


In this application I have made use of resource files to store the strings from different languages. This way of implementing the Multilanguage application is called implicit localization. In implicit localization, you specify that control properties should automatically be read from a resource file, but you do not need to explicitly specify which properties are localized.

Step – 1 : Create New Project.

Go to File > New > Project > Select web application > Entre Application Name > Click OK.

Choose MVC -> Click OK.

Step -2 : Add App_GlobalResources Folder.

Right click on the Project -> Add->Add folder -> App_GlobalResources

Step -3 . Add Resources file for save different language under “App_GlobalResources” Folder

Right Click on “App_GlobalResources” Folder form Solution Explorer > Add > New Item > Select “Resources File” under Visual C# > Enter Name (Like “”) > Add.
[N:B: Please take care of the file Name.]

Now add key and value in each resource file. For ex. Add two files for Home_Index.resx and Home_index.ex.resx

  1. Home_Index.resx

Step-4 : Write code in Global.ascx.cs

protectedvoid Application_BeginRequest(Object source, EventArgs e)


var userLanguages = Request.UserLanguages;

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(userLanguages[0] .ToString());

System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;


Step – 5 : Use resources Keys in Views.

Replace your text in views with Resources keys. For. ex.


ViewBag.Title = @Resources.Home_Index.title;





<p><ahref=”#”class=”btn btn-primary btn-lg”>@Resources.Home_Index.more &raquo;</a></p>






<p><aclass=”btn btn-default”href=”#”>@Resources.Home_Index.more &raquo;</a></p>





<p><aclass=”btn btn-default”href=”#”>@Resources.Home_Index.more &raquo;</a></p>





<p><aclass=”btn btn-default”href=”#”>@Resources.Home_Index.more &raquo;</a></p>



Step- 6. Build and run your application.


About the Author