'use strict';

app.factory('TranslationService', function($http, TRANSLATION_SERVICE_URL) {
  return {
    translate: function(text, sourceLang, targetLang) {
      return $http.get(TRANSLATION_SERVICE_URL, {
        params: {
          text: text,
          sourceLang: sourceLang,
          targetLang: targetLang,
          alignmentInfo: true,
        },
      });
    },
  };
});

@@ -81,16 +81,20 @@
 VICE_URL
+, $q
 ) %7B%0A  re
@@ -373,16 +373,281 @@
 %0A    %7D,%0A
+    translateMany(text, sourceLang, targetsLang) %7B%0A      var requests = %5B%5D;%0A      var that = this;%0A      targetsLang.forEach(function(targetLang) %7B%0A        requests.push(that.translate(text, sourceLang, targetLang));%0A      %7D);%0A      return $q.all(requests);%0A    %7D,%0A
   %7D;%0A%7D);

handle many request