'use strict';

angular.module('sammui.translateServices', ['ngResource']).
    factory('translateLoader', ['$q', '$timeout', '$resource', function ($q, $timeout, $resource) {

        return function (options) {
            var deferred = $q.defer(), translations = new Object();

            var Languages = $resource('/l10n/manage/langs/:lang', {lang: '@lang'});

            console.debug('Downloading translate');
            var lang = Languages.get({lang: options.key}, function () {
                lang.translations.forEach(function(t){
                    if (t) {
                        translations[t.key] = t.value;
                    }
                })

                deferred.resolve(translations);
            });

            return deferred.promise;
        };
    }]);
@@ -70,111 +70,213 @@
 e'%5D)
-.%0A    factory('translateLoader', %5B'$q', '$timeout', '$resource', function ($q, $timeout, $resource
+%0A    .factory('translateLangs', function ($resource) %7B%0A        return $resource('/l10n/manage/langs/:lang');%0A    %7D).%0A    factory('translateLoader', %5B'$q', 'translateLangs', function ($q, translateLangs
 ) %7B%0A
-%0A
     
@@ -380,93 +380,8 @@
 );%0A%0A
-            var Languages = $resource('/l10n/manage/langs/:lang', %7Blang: '@lang'%7D);%0A%0A
     
@@ -424,17 +424,36 @@
 ranslate
-'
+ for ' + options.key
 );%0A     
@@ -474,16 +474,21 @@
 g = 
+translate
 Lang
-uage
 s.ge
@@ -574,19 +574,21 @@
 function
+ 
 (t)
+ 
 %7B%0A      

Centralizando o serviço de Translate Lang