Internationalization:
Internationalization is the process of designing a software application in such a way so that it can potentially be adapted to various languages and regions without changes.
AngularJS Internationalization:
AngularJS provides the inbuilt internationalization for three types of filters currency, date and numbers. We only need to tell AngularJS what locale to use when writing localized output i.e. we need to include the corresponding AngularJS locale file. By default it handles the locale of the browser.
Note: Check correct locale for your country at code.angularjs.org.
Example:
<html> <head> <title>AngularJS Internationalization Example</title> <script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"> </script> <script src = "https://code.angularjs.org/1.4.8/i18n/angular-locale_da-dk.js"> </script> </head> <body> <h2>AngularJS Internationalization Example</h2> <div ng-app = "testApp" ng-controller = "StudentController"> {{fees | currency }} <br/><br/> {{admissiondate | date }} <br/><br/> {{rollno | number }} </div> <script> var mainApp = angular.module("testApp", []); mainApp.controller('StudentController', function($scope) { $scope.fees = 200.50; $scope.admissiondate = new Date(); $scope.rollno = 12; }); </script> </body> </html> |