AngularJS Internationalization: In AngularJS, three types of filters are supported for the purpose of internationalization. These include the date, currency, and numbers.
To do this, one only needs to incorporate the necessary is depending on the country they are in or what they need. The default setting is that it handles the locale of the browser.
AngularJS Internationalization Example
Consider the example given below:
<script src = "https://code.angularjs.org/1.2.5/i18n/angular-locale_da-dk.js"></script>
In the above case, the user wants to use a Danish locale. Consider our example which is given below:
<html> <head> <title> Forms in Angular JS </title> </head> <body> <h2>AngularJS Example Applications/h2> <div ng-app ="mainApplication" ng-controller ="St Controller Controller"> {{fees | currency }} <br/><br/> {{date of admission date}} <br/><br/> {{position number}} </div> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src="https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js"></script> <script> var mainApplication = angular.module(" mainApplication",[]); mainApplication.controller('StController', function($scope) { $scope.fees 150; $scope.date of admission new Date(); $scope.position = 7; }); </script> </body> </html>
You can write the program just as it has been written, and then save it. After that, open it in your favorite browser, and observe the output that you get. It will be shown below.
Angular JS Internationalization Example Output
150.00 kr
02/10/2015
?
That is how it can be done.
Browser Locale AngularJS Example
For those who need to use the locale of the browser, do it as shown in an example is given below:
<html> <head> <title> Forms in Angular JS </title> </head> <body> <h2>AngularJS Example Application</h2> <div ng-app "mainApplication" ng-controller ="StController"> {{fees currency }} <br/><br/> {{date of admission date } <br/><br/> {{position number }} </div> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <!-- <script src="https://code.angularjs.org/1.3.14/i18n/angular-locale_da-dk.js"></ script>--> <script> var mainApplication angular.module(" mainApplication", []); mainApplication.controller('StController', function($scope) { $scope.fees = 150; $scope.date of admission = new Date(); $scope position=7; }); </script> </body> </html>