igor-js,
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
</head>
<body ng-controller="translateController">
<h1 translate>Hello!</h1>
<script>
var app = angular.module('app', []);
app
.controller('translateController', ['$scope', '$http', function ($scope, $http) {
$scope.msg = 'YES';
$scope.dictionary = {};
/*$http.get('translations.json').then(function (success) {
$scope.dictionary = success.data;
})*/
$scope.dictionary = {"Hello!" : "Привет!","Bye" : "Пока"}
}])
.directive("translate", function () {
return {
compile: function(elem){
var text = elem.text();
elem.html('{{dictionary[text]}}')
return function(scope){
scope.text = text;
}
}
}
})
</script>
</body>
</html>