AngularJS 1
- Add module to application :
var app = angular.module('app', ['Languages'])
- Initialize the language in the config method
Languages.init('fr_FR', './languages/', () => {
angular.bootstrap(document, ['app']);
});
- Using filters in templates :
<p>{{'hello' | t}}</p>
You can use the settings :
<p>{{'you have nb message' | t:2}}</p>
Use service
You can access Language with Injection Dependency :
app.controller('MyController', function(Languages) {
Languages.translate('hello');
})