AngularJS 1

  1. Add module to application :
var app = angular.module('app', ['Languages'])
  1. Initialize the language in the config method
Languages.init('fr_FR', './languages/', () => {
  angular.bootstrap(document, ['app']);
});
  1. 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');
})

results matching ""

    No results matching ""