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.

Table of Contents

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.

Picture 1 of Multilingual (i18n) in AngularJS

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.

Picture 2 of Multilingual (i18n) in AngularJS

According to Tutorialspoint

Previous article: The Service in AngularJS

Next lesson: Attribute in C #

You've just finished reading the article "Multilingual (i18n) in AngularJS" edited by the TipsMake team. You can save multilingual-i18n-in-angularjs.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV What is jQuery?
NEXT » The Service in AngularJS