Learn MVC Using Angular Dynamic Localization


This article demonstrates low to use Agular dynamic localization in MVC using the Angular i18n package in Visual Studio 2017.


Localization is a very important part of region based applications. It customizes your application for a given culture and locale. So, this localization can change dynamically using Angular Dynamic Locale Module.

By following the below steps, you can use Angular file upload in MVC.

  • Create MVC Project.
  • Configure Angular i18n and Dynamic Locale.
  • Work in Angular i18n and Dynamic Locale.

Create MVC Project

Open Visual Studio 2017.


Go to New menu > click New and Project. Now, it will open a New Project window.


You can select ASP.NET Web Application on Framework 4.5. Enter the name of the project in “Solution name” text box, then click OK.


One more window should appear. Select the MVC Template in this pop-up and click OK. Now, start cropping the image.

Configure Angular i18n and Dynamic Locale

You can download the plug-in from:

Or you can install it from npm. If you try npm, don’t forget to install Node.js. Then, use the following commands:

npm install angular-i18n 

npm install angular-dynamic-locale 

Open the _Layout.cshtml and refer the.js file from downloaded folder to this View page.

Link your Angular configurable file.

Angular Module

You will need to include the module as a dependency on your application.

 Work in Angular i18n and Dynamic Locale

“Locale” is my Angular module name. So, I have added as the value for “ng-app.”


Angular Config

This module expects for the Angular locales to present at ‘angular-i18n/angular-locale_{{locale}}.js.’ If the locales are at another URL, this can be changed at tmhDynamicLocaleProvider using localeLocationPattern (string).

Angular Controller

Angular initiates the locale in a dropdown and sets the locale id as “en” in Angular.

When using this method, tmhDynamicLocale.set will return a promise that will be resolved when the locale is loaded and will resolve to the new locale

Click the F5 button and run the application. Now, it will open the browser where you can see the result.

Output 1


I have loaded default locale as English.

Output 2


I have changed the locale to Chinese, so the data is changed to Chinese.


In this article, we have seen dynamic localization using Angular i18n. If you have any queries, please tell me through the comments section.

Happy Coding!

Thiruppathi Rengasamy
I'm a Dotnet Developer & Blogger. And also I'm working as a senior software engineer. I would like to spend my precious time writing articles, research on .Net technologies, and learning new technologies.