Clear, practical technology insights About · Contact

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.

Author: David Pac2 minutes read
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.

images 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.

images 1 of Multilingual (i18n) in AngularJS

According to Tutorialspoint

Previous article: The Service in AngularJS

Next lesson: Attribute in C #

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.