How to load a JSON array to translate an AngularJS web page using Angular -Translate

I'm still learning AngularJS, so I apologize for all my poor quality code / lack of knowledge.

What i want to do

I want to translate my webpage into 2 languages. It currently works when I translate static content using Angular-Translate to index.html . Like this

function translateConfiguration($translateProvider) {

    $translateProvider.useSanitizeValueStrategy(null);

    $translateProvider.useStaticFilesLoader({
      files: [{
        prefix: '../JSON/locale-',
        suffix: '.json'
      }]
});

$translateProvider.preferredLanguage('en');
$translateProvider.fallbackLanguage('en');

};

I upload my simple JSON files for EN and RU locales structured this way

{
 "HEADING" : "Lorem",
 "TEXT" : "Ipsum"
}

Then I access the variables through the Angular -translate directive

<h1 class="z-logo header-text md-display-1" translate="HEADING">
</h1>

Everything works as it should.

I want to be able to do the same with my custom directives and ng-repeat.

Problem

I have several custom directives on my AngularJS site. For instance,

<about-card flex="33" flex-xs="100" flex-sm="100" class="center-content" ng-repeat="data in aboutCardCtrl.info">
</about-card>

, JSON

<md-card class="card-bg card-height">
  <md-card-title layout="column" class="about-card">
    <md-card-title-media class="center-elements">
      <img class="md-media-lg" ng-src="{{data.image}}" alt="{{data.imageAlt}}"/>
    </md-card-title-media>
    <md-card-title-text>
      <div class="md-headline card-title-padding">{{data.heading}}</div>
    </md-card-title-text>
  </md-card-title>
  <md-card-content>
    {{data.content | translate}}
  </md-card-content>
</md-card>

(function() {
  'use strict'

  angular
    .module('webApp')
    .directive('aboutCard', aboutCard);

  function aboutCard() {
    return {
      restrict: 'EA',
      priority: 1001,
      templateUrl: '../TEMPLATES/about.html',
      controller: 'aboutCardController',
      controllerAs: 'aboutCardCtrl'
    };
  };
})();

(function() {
  'use strict'

  angular
    .module('webApp')
    .controller('aboutCardController', aboutCardController);

  aboutCardController.$inject = ['JsonData', '$translate'];

  function aboutCardController(JsonData, $translate) {
    var vm = this;

    vm.pathToJson = '../JSON/about-en.json';
    vm.info = [];

    JsonData.all(vm.pathToJson).then(function(response) {
      vm.info = response.data.information;
    });
  };
})();

JSON

  {
      "information": [{
        "heading": "Reliability",
        "content": "Our partners have been working on the market for over 10 years",
        "image": "../IMG/shield.svg",
        "imageAlt": "Reliability Image"
      }, {
        "heading": "Professionalism",
        "content": "We are ready to provide profesional opinion for our clients to ensure the right choice",
        "image": "../IMG/people.svg",
        "imageAlt": "Professionalism Image"
      }, {
        "heading": "Development",
        "content": "Organization of educational programs in collaboration with our partners",
        "image": "../IMG/cogwheel.svg",
        "imageAlt": "Development Image"
      }]
    }

, , , , JSON ng-repeat. JSON .

wiki- Angular -Translate, index.html main app.js, / , Google,

https://technpol.wordpress.com/2013/11/02/adding-translation-using-angular-translate-to-an-angularjs-app/

https://github.com/angular-translate/angular-translate/issues/1154

+4
1

.

$translateProvider.useLoader('$translatePartialLoader', {
  urlTemplate: 'JSON/{part}/{lang}.json'
});

JSON, :

$translatePartialLoader.addPart('about');

.

+1

All Articles