Multilingual (i18n) in AngularJS

AngularJS provides multi-lingual functions (i18n) with 3 types of filters, currency, date and number. We just need to combine the js corresponding to the location depending on the country. By default it will attach to the location in the web browser.

AngularJS provides multi-lingual functions (i18n) with 3 types of filters, currency, date and number. We just need to combine the js corresponding to the location depending on the country. By default it will attach to the location in the web browser. For example, when using location in Denmark, you use the following script:

 src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js" > 

Example for Danish example in AngularJS

dangonngu.html

 Vi du Da is stupid (i18n) in AngularJS 

 

 Cavalier AngularJS  currency}} 

date}}

number}}

src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> src="https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js">

Result:

Open the dangonngu.html page in a web browser and see the results.

Multilingual (i18n) in AngularJS Picture 1Multilingual (i18n) in AngularJS Picture 1

For example use the location of the Browser

vidui18n.html

 Vi du Da is stupid (i18n) in AngularJS 

 

 Cavalier AngularJS  currency}} 

date}}

number}} src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js" >

Result:

Open the vidui18n.html page in a web browser and see the results.

Multilingual (i18n) in AngularJS Picture 2Multilingual (i18n) in AngularJS Picture 2

According to Tutorialspoint

Previous article: The Service in AngularJS

Next lesson: Attribute in C #

4.5 ★ | 2 Vote