I know that @Kevin already answered ur, but you can also do something similar using '$ filter'.
var translations = { HEADLINE: 'What an awesome module!', PARAGRAPH: 'Srsly!', NAMESPACE: { PARAGRAPH: 'And it comes with awesome features!' } }; var app = angular.module('myApp', ['pascalprecht.translate']); app.config(['$translateProvider', function ($translateProvider) { // add translation table $translateProvider.translations(translations); }]); app.controller('Ctrl', ['$scope', '$filter', function ($scope, $filter) { $scope.headline = $filter('translate')("HEADLINE"); $scope.paragraph = $filter('translate')("PARAGRAPH"); $scope.namespaced_paragraph = $filter('translate')("NAMESPACE.PARAGRAPH"); }]);
and pass in the scope variables you want to show.
and I think that with this approach, you do not need to transfer your every filter (if there are more than one) to the controller and achieve the same result.
source share