(function () {
  'use strict';

  angular
    .module('app.services')
    .factory('LanguageService', LanguageService);

  LanguageService.$inject = ['$q', '$translate', 'amMoment', 'tmhDynamicLocale'];

  function LanguageService ($q, $translate, amMoment, tmhDynamicLocale) {
    var language = '';

    return {
      change: change,
      getLanguage: getLanguage,
      clientLocale: clientLocale
    };

    function getLanguage () {
      return language;
    }

    function change (key) {
      var deferred = $q.defer();
      $translate.use(key).then(function (key) {
        console.info('Sprache zu '+ key +' gewechselt.');
        amMoment.changeLocale(key.split('_')[0]);
        tmhDynamicLocale.set(key.split('_')[0]);
        language = key.split('_')[0];
        deferred.resolve('Sprache zu ' + key + 'gewechselt');
      }, function (key) {
        console.error('Fehler beim wechseln zur Sprache ' + key);
        deferred.reject('Fehler beim wechseln zur Sprache: ' + key);
      });

      return deferred.promise;
    }

    function clientLocale ()
    {
      return $translate.resolveClientLocale();
    }
  }
})();

@@ -847,32 +847,82 @@
 unction (key) %7B%0A
+        amMoment.changeLocale(key.split('_')%5B0%5D);%0A
         console.

set locale for moment on error