How to create multi lingual website in asp net mvc

In this tutorial i am going to explain about How to create multi lingual website in asp net mvc. In my previous tutorial i have explained about

Implementation :

Now we will see the implementation of How to create multi lingual website in asp net mvc.

Step 1: First create an asp.net mvc application and name it as MultilingualWebsite. Then

Step 2: Right click on the project choose Add – > Add Asp.Net Folder -> App_GlobalResources. It will create App_GlobalResources folder in our project. Please refer the below screenshot.

Step 2 of How to create multi lingual website in asp net mvc

Step 3: After adding App_GlobalResources folder, right click on that folder and choose Add -> Add Resource File option. Name it as Resource and it will be used for the default language. Please refer the below screenshot.




Step 3 of How to create multi lingual website in asp net mvc

Step 4: Now open the Resource.resx file and add the below key value contents.

Step 4 of How to create multi lingual website in asp net mvc

Step 5: Similarly add another resource file french language and name it as Resource.fr.resx and add the sample resource contents in that file.

Step 5 of How to create multi lingual website in asp net mvc

Step 6: Now right click on controller folder and add another controller called BaseController and override the BeginExecuteCore method to set the selected user language as the current culture. Below is the complete code of BaseController.

C#.Net:

VB.Net:

Step 7: Now create another controller and name it as DemoController and add the below code.

C#.Net

VB.Net:

Step 8: Now add view to Index method and add the below code in it.

Since i have used jquery function in my index.cshtml, i have moved my jquery file from bottom to top in layout.cshtml file. Below i my modified layout.cshtml file.

Output:

Now if you run the program you can see the output of How to create multi lingual website in asp net mvc.

Output of How to create multi lingual website in asp net mvc

Source Code:

You can download the sourcecode of how to create multi lingual website in asp net mvc from the below download link.

Source code of how to create multi lingual website in asp net mvc

 

 

 

Conclusion:

Hope you learned How to create multi lingual website in asp net mvc. Do you like this tutorial? Help us to improve. Please post your comments and feedback below.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!