angular-translate
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -0,1 +1,48 @@ | ||
<a name="2.7.0"></a> | ||
## 2.7.0 (2015-05-02) | ||
#### Bug Fixes | ||
* **directive:** | ||
* fix translate-value-* weren't be available on init ([98e82798](http://github.com/angular-translate/angular-translate/commit/98e827980ec491152ab6108f5fd5eac28010e89e)) | ||
* fix wrong initial translation causing overloading ([657ed8a6](http://github.com/angular-translate/angular-translate/commit/657ed8a6e8d09cbf5fd53a26ea98cbcf928637cd)) | ||
* fix issue with `data-` prefixed attributes #954 ([ee253bc3](http://github.com/angular-translate/angular-translate/commit/ee253bc397aa70b8688893430ea814c0e2387344)) | ||
* make translate-values interpolate correctly with newer MessageFormat.js ([887dc1b4](http://github.com/angular-translate/angular-translate/commit/887dc1b4c0e928fbfd595a1d03cb292fcd536839)) | ||
* Make interpolate message format work smoothly also on message format > 0.1.7 - f ([2533f2d0](http://github.com/angular-translate/angular-translate/commit/2533f2d0b2e9f21007335c510772418a4c7a3962)) | ||
* handle interpolation of undefined keys correctly in updateTranslations, fixes is ([3f7cf4cf](http://github.com/angular-translate/angular-translate/commit/3f7cf4cf6eecb0487da2dc4dd8cb805500cb1aff)) | ||
* **docs:** | ||
* fix invalid link in directive ([985cfd5b](http://github.com/angular-translate/angular-translate/commit/985cfd5bedec12043e5f24b16b86394150c6182e)) | ||
* typo in module type ([f0527b14](http://github.com/angular-translate/angular-translate/commit/f0527b1431f7b426584e32b5f17bc181d409ce41)) | ||
* bug in "Flash of untranslated content" section ([af5d746a](http://github.com/angular-translate/angular-translate/commit/af5d746a6476d82f31968d608ebc21227212cd7e)) | ||
* **feat:** export module name improving usage module loaders #944 ([cb33f63b](http://github.com/angular-translate/angular-translate/commit/cb33f63b8869aff386718c7d3b18365d2483d3eb)) | ||
* **messageformat:** add duck type check for numbers #789 ([bbc1cbef](http://github.com/angular-translate/angular-translate/commit/bbc1cbefb69e80579f15f7da59ac5c5536388fc2)) | ||
* **refresh:** it has to clear all tables if no language key is specified ([3cce7950](http://github.com/angular-translate/angular-translate/commit/3cce795022e790bc31656ab946ed63bba6c238c3)) | ||
* **service:** | ||
* fix possible npe ([1aaab980](http://github.com/angular-translate/angular-translate/commit/1aaab980760f8863551598ed748d200f1f03d9c6)) | ||
* do not try to load a predefined fallback language ([3be14df8](http://github.com/angular-translate/angular-translate/commit/3be14df809d3c162f4a1aecffb90d62b5296b4d9)) | ||
* fix an issue resolving after missing translations ([a13899fc](http://github.com/angular-translate/angular-translate/commit/a13899fcf677588e0c56b780c57f9aaba6d6e976)) | ||
* always remove stored ref for lang promises ([dbd5be93](http://github.com/angular-translate/angular-translate/commit/dbd5be936d0588a1ec6f29e5ce52a4e0f096ea36), closes [#824](http://github.com/angular-translate/angular-translate/issues/824), [#969](http://github.com/angular-translate/angular-translate/issues/969)) | ||
#### Features | ||
* **$translatePartialLoader:** accept function in urlTemplate ([401204aa](http://github.com/angular-translate/angular-translate/commit/401204aade22e4729de5349a03689b02f9e6d20b)) | ||
* **build:** introduce module definition ([00b73ff6](http://github.com/angular-translate/angular-translate/commit/00b73ff6f40daeabc54afade7b5e6217722b70e8)) | ||
* **filter:** add new option `$translate.statefulFilter()` ([dec4bf34](http://github.com/angular-translate/angular-translate/commit/dec4bf34b7bb30bba4ca80df263df1858b3e68f5)) | ||
* **missingTranslationHandlerFactory:** pass interpolationParams to missingTranslationHandlerFactory ([a361fd05](http://github.com/angular-translate/angular-translate/commit/a361fd050f490e550b7e2e5fbfea91b85ba3e879)) | ||
* **sanitization:** refactored, fixed and extended sanitization #993 ([12dbc575](http://github.com/angular-translate/angular-translate/commit/12dbc5754c8315d41144794918f1ec8ca34c601e)) | ||
* **service:** add uniformLanguageTagResolver ([b534e1a3](http://github.com/angular-translate/angular-translate/commit/b534e1a3c7e43f27b00a2579750d8136aebc57fd)) | ||
#### Breaking Changes | ||
* You will get a warning message when using the default security option (not escaping the content). | ||
You can fix (and remove) this warning by explicit set a sanitization strategy | ||
within your config phase configuring $translateProvider. Even configuring the `null` mode will let the | ||
warning disapper. You are highly encouraged specifing any mode except `null` because of security concerns. | ||
([12dbc575](http://github.com/angular-translate/angular-translate/commit/12dbc5754c8315d41144794918f1ec8ca34c601e)) | ||
<a name="2.6.1"></a> | ||
@@ -2,0 +49,0 @@ ### 2.6.1 (2015-03-01) |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -19,7 +35,17 @@ | ||
*/ | ||
.factory('$translateMissingTranslationHandlerLog', ['$log', function ($log) { | ||
.factory('$translateMissingTranslationHandlerLog', $translateMissingTranslationHandlerLog); | ||
function $translateMissingTranslationHandlerLog ($log) { | ||
'use strict'; | ||
return function (translationId) { | ||
$log.warn('Translation for ' + translationId + ' doesn\'t exist'); | ||
}; | ||
}]); | ||
} | ||
$translateMissingTranslationHandlerLog.$inject = ['$log']; | ||
$translateMissingTranslationHandlerLog.displayName = '$translateMissingTranslationHandlerLog'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",["$log",function(a){return function(b){a.warn("Translation for "+b+" doesn't exist")}}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";return function(b){a.warn("Translation for "+b+" doesn't exist")}}return angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",a),a.$inject=["$log"],a.displayName="$translateMissingTranslationHandlerLog","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
/** | ||
* @ngdoc property | ||
* @name pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE | ||
* @requires TRANSLATE_MF_INTERPOLATION_CACHE | ||
* | ||
* @description | ||
* Uses MessageFormat.js to interpolate strings against some values. | ||
*/ | ||
.constant('TRANSLATE_MF_INTERPOLATION_CACHE', '$translateMessageFormatInterpolation') | ||
@@ -13,3 +37,3 @@ | ||
* @name pascalprecht.translate.$translateMessageFormatInterpolation | ||
* @requires TRANSLATE_MF_INTERPOLATION_CACHE | ||
* @requires pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE | ||
* | ||
@@ -19,6 +43,16 @@ * @description | ||
* | ||
* @return {object} $translateInterpolator Interpolator service | ||
* Be aware to configure a proper sanitization strategy. | ||
* | ||
* See also: | ||
* * {@link pascalprecht.translate.$translateSanitization} | ||
* * {@link https://github.com/SlexAxton/messageformat.js} | ||
* | ||
* @return {object} $translateMessageFormatInterpolation Interpolator service | ||
*/ | ||
.factory('$translateMessageFormatInterpolation', ['$cacheFactory', 'TRANSLATE_MF_INTERPOLATION_CACHE', function ($cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE) { | ||
.factory('$translateMessageFormatInterpolation', $translateMessageFormatInterpolation); | ||
function $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE) { | ||
'use strict'; | ||
var $translateInterpolator = {}, | ||
@@ -28,27 +62,4 @@ $cache = $cacheFactory.get(TRANSLATE_MF_INTERPOLATION_CACHE), | ||
$mf = new MessageFormat('en'), | ||
$identifier = 'messageformat', | ||
$sanitizeValueStrategy = null, | ||
// map of all sanitize strategies | ||
sanitizeValueStrategies = { | ||
escaped: function (params) { | ||
var result = {}; | ||
for (var key in params) { | ||
if (Object.prototype.hasOwnProperty.call(params, key)) { | ||
result[key] = angular.element('<div></div>').text(params[key]).html(); | ||
} | ||
} | ||
return result; | ||
} | ||
}; | ||
$identifier = 'messageformat'; | ||
var sanitizeParams = function (params) { | ||
var result; | ||
if (angular.isFunction(sanitizeValueStrategies[$sanitizeValueStrategy])) { | ||
result = sanitizeValueStrategies[$sanitizeValueStrategy](params); | ||
} else { | ||
result = params; | ||
} | ||
return result; | ||
}; | ||
if (!$cache) { | ||
@@ -93,4 +104,8 @@ // create cache if it doesn't exist already | ||
/** | ||
* @deprecated will be removed in 3.0 | ||
* @see {@link pascalprecht.translate.$translateSanitization} | ||
*/ | ||
$translateInterpolator.useSanitizeValueStrategy = function (value) { | ||
$sanitizeValueStrategy = value; | ||
$translateSanitization.useStrategy(value); | ||
return this; | ||
@@ -109,17 +124,29 @@ }; | ||
*/ | ||
$translateInterpolator.interpolate = function (string, interpolateParams) { | ||
$translateInterpolator.interpolate = function (string, interpolationParams) { | ||
interpolationParams = interpolationParams || {}; | ||
interpolationParams = $translateSanitization.sanitize(interpolationParams, 'params'); | ||
interpolateParams = interpolateParams || {}; | ||
var interpolatedText = $cache.get(string + angular.toJson(interpolationParams)); | ||
if ($sanitizeValueStrategy) { | ||
interpolateParams = sanitizeParams(interpolateParams); | ||
} | ||
// if given string wasn't interpolated yet, we do so now and never have to do it again | ||
if (!interpolatedText) { | ||
var interpolatedText = $cache.get(string + angular.toJson(interpolateParams)); | ||
// Ensure explicit type if possible | ||
// MessageFormat checks the actual type (i.e. for amount based conditions) | ||
for (var key in interpolationParams) { | ||
if (interpolationParams.hasOwnProperty(key)) { | ||
// ensure number | ||
var number = parseInt(interpolationParams[key], 10); | ||
if (angular.isNumber(number) && ('' + number) === interpolationParams[key]) { | ||
interpolationParams[key] = number; | ||
} | ||
} | ||
} | ||
// if given string wasn't interpolated yet, we do so now and never have to do it again | ||
if (!interpolatedText) { | ||
interpolatedText = $mf.compile(string)(interpolateParams); | ||
$cache.put(string + angular.toJson(interpolateParams), interpolatedText); | ||
interpolatedText = $mf.compile(string)(interpolationParams); | ||
interpolatedText = $translateSanitization.sanitize(interpolatedText, 'text'); | ||
$cache.put(string + angular.toJson(interpolationParams), interpolatedText); | ||
} | ||
return interpolatedText; | ||
@@ -129,2 +156,8 @@ }; | ||
return $translateInterpolator; | ||
}]); | ||
} | ||
$translateMessageFormatInterpolation.$inject = ['$translateSanitization', '$cacheFactory', 'TRANSLATE_MF_INTERPOLATION_CACHE']; | ||
$translateMessageFormatInterpolation.displayName = '$translateMessageFormatInterpolation'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").factory("$translateMessageFormatInterpolation",["$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE",function(a,b){var c={},d=a.get(b),e=new MessageFormat("en"),f="messageformat",g=null,h={escaped:function(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=angular.element("<div></div>").text(a[c]).html());return b}},i=function(a){var b;return b=angular.isFunction(h[g])?h[g](a):a};return d||(d=a(b)),d.put("en",e),c.setLocale=function(a){e=d.get(a),e||(e=new MessageFormat(a),d.put(a,e))},c.getInterpolationIdentifier=function(){return f},c.useSanitizeValueStrategy=function(a){return g=a,this},c.interpolate=function(a,b){b=b||{},g&&(b=i(b));var c=d.get(a+angular.toJson(b));return c||(c=e.compile(a)(b),d.put(a+angular.toJson(b),c)),c},c}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b,c){"use strict";var d={},e=b.get(c),f=new MessageFormat("en"),g="messageformat";return e||(e=b(c)),e.put("en",f),d.setLocale=function(a){f=e.get(a),f||(f=new MessageFormat(a),e.put(a,f))},d.getInterpolationIdentifier=function(){return g},d.useSanitizeValueStrategy=function(b){return a.useStrategy(b),this},d.interpolate=function(b,c){c=c||{},c=a.sanitize(c,"params");var d=e.get(b+angular.toJson(c));if(!d){for(var g in c)if(c.hasOwnProperty(g)){var h=parseInt(c[g],10);angular.isNumber(h)&&""+h===c[g]&&(c[g]=h)}d=f.compile(b)(c),d=a.sanitize(d,"text"),e.put(b+angular.toJson(c),d)}return d},d}return angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").factory("$translateMessageFormatInterpolation",a),a.$inject=["$translateSanitization","$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE"],a.displayName="$translateMessageFormatInterpolation","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -17,4 +33,8 @@ /** | ||
*/ | ||
.provider('$translatePartialLoader', function() { | ||
.provider('$translatePartialLoader', $translatePartialLoader); | ||
function $translatePartialLoader() { | ||
'use strict'; | ||
/** | ||
@@ -42,7 +62,12 @@ * @constructor | ||
* | ||
* @param {string} urlTemplate Url pattern to use. | ||
* @param {string} targetLang Language key for language to be used. | ||
* @param {string|function} urlTemplate - Either a string containing an url pattern (with | ||
* '{part}' and '{lang}') or a function(part, lang) | ||
* returning a string. | ||
* @param {string} targetLang - Language key for language to be used. | ||
* @return {string} Parsed url template string | ||
*/ | ||
Part.prototype.parseUrl = function(urlTemplate, targetLang) { | ||
if (angular.isFunction(urlTemplate)) { | ||
return urlTemplate(this.name, targetLang); | ||
} | ||
return urlTemplate.replace(/\{part\}/g, this.name).replace(/\{lang\}/g, targetLang); | ||
@@ -176,3 +201,3 @@ }; | ||
*/ | ||
this.setPart = function(lang, part, table) { | ||
this.setPart = function (lang, part, table) { | ||
if (!isStringValid(lang)) { | ||
@@ -213,3 +238,3 @@ throw new TypeError('Couldn\'t set part.`lang` parameter has to be a string!'); | ||
*/ | ||
this.deletePart = function(name) { | ||
this.deletePart = function (name) { | ||
if (!isStringValid(name)) { | ||
@@ -284,4 +309,4 @@ throw new TypeError('Couldn\'t delete part, first arg has to be string.'); | ||
if (!isStringValid(options.urlTemplate)) { | ||
throw new TypeError('Unable to load data, a urlTemplate is not a non-empty string.'); | ||
if (!isStringValid(options.urlTemplate) && !angular.isFunction(options.urlTemplate)) { | ||
throw new TypeError('Unable to load data, a urlTemplate is not a non-empty string or not a function.'); | ||
} | ||
@@ -293,3 +318,5 @@ | ||
throw new Error('Unable to load data, a loadFailureHandler is not a string.'); | ||
} else errorHandler = $injector.get(errorHandler); | ||
} else { | ||
errorHandler = $injector.get(errorHandler); | ||
} | ||
} | ||
@@ -301,3 +328,3 @@ | ||
angular.forEach(prioritizedParts, function(part, index) { | ||
angular.forEach(prioritizedParts, function(part) { | ||
loaders.push( | ||
@@ -498,2 +525,7 @@ part.getTable(options.key, $q, $http, options.$http, options.urlTemplate, errorHandler) | ||
}); | ||
} | ||
$translatePartialLoader.displayName = '$translatePartialLoader'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").provider("$translatePartialLoader",function(){function a(a,b){this.name=a,this.isActive=!0,this.tables={},this.priority=b||0}function b(a){return Object.prototype.hasOwnProperty.call(g,a)}function c(a){return angular.isString(a)&&""!==a}function d(a){if(!c(a))throw new TypeError("Invalid type of a first argument, a non-empty string expected.");return b(a)&&g[a].isActive}function e(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},e(a[c],b[c])):a[c]=b[c];return a}function f(){var a=[];for(var b in g)g[b].isActive&&a.push(g[b]);return a.sort(function(a,b){return a.priority-b.priority}),a}a.prototype.parseUrl=function(a,b){return a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=b.defer();if(this.tables[a])g.resolve(this.tables[a]);else{var h=this;c(angular.extend({method:"GET",url:this.parseUrl(e,a)},d)).success(function(b){h.tables[a]=b,g.resolve(b)}).error(function(){f?f(h.name,a).then(function(b){h.tables[a]=b,g.resolve(b)},function(){g.reject(h.name)}):g.reject(h.name)})}return g.promise};var g={};this.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(g[d]=new a(d,e)),g[d].isActive=!0,this},this.setPart=function(d,e,f){if(!c(d))throw new TypeError("Couldn't set part.`lang` parameter has to be a string!");if(!c(e))throw new TypeError("Couldn't set part.`part` parameter has to be a string!");if("object"!=typeof f||null===f)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(g[e]=new a(e),g[e].isActive=!1),g[e].tables[d]=f,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(g[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http",function(h,i,j,k){var l=function(a){if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string.");var b=a.loadFailureHandler;if(void 0!==b){if(!angular.isString(b))throw new Error("Unable to load data, a loadFailureHandler is not a string.");b=i.get(b)}var d=[],g=j.defer(),h=f();return angular.forEach(h,function(c){d.push(c.getTable(a.key,j,k,a.$http,a.urlTemplate,b)),c.urlTemplate=a.urlTemplate}),j.all(d).then(function(){var b={};angular.forEach(h,function(c){e(b,c.tables[a.key])}),g.resolve(b)},function(){g.reject(a.key)}),g.promise};return l.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?g[d].isActive||(g[d].isActive=!0,h.$emit("$translatePartialLoaderStructureChanged",d)):(g[d]=new a(d,e),h.$emit("$translatePartialLoaderStructureChanged",d)),l},l.deletePart=function(a,d){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string");if(void 0===d)d=!1;else if("boolean"!=typeof d)throw new TypeError("Invalid type of a second argument, a boolean expected.");if(b(a)){var e=g[a].isActive;if(d){var f=i.get("$translate"),j=f.loaderCache();"string"==typeof j&&(j=i.get(j)),"object"==typeof j&&angular.forEach(g[a].tables,function(b,c){j.remove(g[a].parseUrl(g[a].urlTemplate,c))}),delete g[a]}else g[a].isActive=!1;e&&h.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartLoaded=function(a,b){return angular.isDefined(g[a])&&angular.isDefined(g[a].tables[b])},l.getRegisteredParts=function(){var a=[];return angular.forEach(g,function(b){b.isActive&&a.push(b.name)}),a},l.isPartAvailable=d,l}]}); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(){"use strict";function a(a,b){this.name=a,this.isActive=!0,this.tables={},this.priority=b||0}function b(a){return Object.prototype.hasOwnProperty.call(g,a)}function c(a){return angular.isString(a)&&""!==a}function d(a){if(!c(a))throw new TypeError("Invalid type of a first argument, a non-empty string expected.");return b(a)&&g[a].isActive}function e(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},e(a[c],b[c])):a[c]=b[c];return a}function f(){var a=[];for(var b in g)g[b].isActive&&a.push(g[b]);return a.sort(function(a,b){return a.priority-b.priority}),a}a.prototype.parseUrl=function(a,b){return angular.isFunction(a)?a(this.name,b):a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=b.defer();if(this.tables[a])g.resolve(this.tables[a]);else{var h=this;c(angular.extend({method:"GET",url:this.parseUrl(e,a)},d)).success(function(b){h.tables[a]=b,g.resolve(b)}).error(function(){f?f(h.name,a).then(function(b){h.tables[a]=b,g.resolve(b)},function(){g.reject(h.name)}):g.reject(h.name)})}return g.promise};var g={};this.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(g[d]=new a(d,e)),g[d].isActive=!0,this},this.setPart=function(d,e,f){if(!c(d))throw new TypeError("Couldn't set part.`lang` parameter has to be a string!");if(!c(e))throw new TypeError("Couldn't set part.`part` parameter has to be a string!");if("object"!=typeof f||null===f)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(g[e]=new a(e),g[e].isActive=!1),g[e].tables[d]=f,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(g[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http",function(h,i,j,k){var l=function(a){if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate)&&!angular.isFunction(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string or not a function.");var b=a.loadFailureHandler;if(void 0!==b){if(!angular.isString(b))throw new Error("Unable to load data, a loadFailureHandler is not a string.");b=i.get(b)}var d=[],g=j.defer(),h=f();return angular.forEach(h,function(c){d.push(c.getTable(a.key,j,k,a.$http,a.urlTemplate,b)),c.urlTemplate=a.urlTemplate}),j.all(d).then(function(){var b={};angular.forEach(h,function(c){e(b,c.tables[a.key])}),g.resolve(b)},function(){g.reject(a.key)}),g.promise};return l.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?g[d].isActive||(g[d].isActive=!0,h.$emit("$translatePartialLoaderStructureChanged",d)):(g[d]=new a(d,e),h.$emit("$translatePartialLoaderStructureChanged",d)),l},l.deletePart=function(a,d){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string");if(void 0===d)d=!1;else if("boolean"!=typeof d)throw new TypeError("Invalid type of a second argument, a boolean expected.");if(b(a)){var e=g[a].isActive;if(d){var f=i.get("$translate"),j=f.loaderCache();"string"==typeof j&&(j=i.get(j)),"object"==typeof j&&angular.forEach(g[a].tables,function(b,c){j.remove(g[a].parseUrl(g[a].urlTemplate,c))}),delete g[a]}else g[a].isActive=!1;e&&h.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartLoaded=function(a,b){return angular.isDefined(g[a])&&angular.isDefined(g[a].tables[b])},l.getRegisteredParts=function(){var a=[];return angular.forEach(g,function(b){b.isActive&&a.push(b.name)}),a},l.isPartAvailable=d,l}]}return angular.module("pascalprecht.translate").provider("$translatePartialLoader",a),a.displayName="$translatePartialLoader","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -20,4 +36,8 @@ /** | ||
*/ | ||
.factory('$translateStaticFilesLoader', ['$q', '$http', function ($q, $http) { | ||
.factory('$translateStaticFilesLoader', $translateStaticFilesLoader); | ||
function $translateStaticFilesLoader($q, $http) { | ||
'use strict'; | ||
return function (options) { | ||
@@ -28,3 +48,3 @@ | ||
} | ||
if (!options.files) { | ||
@@ -54,3 +74,3 @@ options.files = [{ | ||
deferred.resolve(data); | ||
}).error(function (data) { | ||
}).error(function () { | ||
deferred.reject(options.key); | ||
@@ -91,2 +111,8 @@ }); | ||
}; | ||
}]); | ||
} | ||
$translateStaticFilesLoader.$inject = ['$q', '$http']; | ||
$translateStaticFilesLoader.displayName = '$translateStaticFilesLoader'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",["$q","$http",function(a,b){return function(c){if(!(c&&(angular.isArray(c.files)||angular.isString(c.prefix)&&angular.isString(c.suffix))))throw new Error("Couldn't load static files, no files and prefix or suffix specified!");c.files||(c.files=[{prefix:c.prefix,suffix:c.suffix}]);for(var d=function(d){if(!d||!angular.isString(d.prefix)||!angular.isString(d.suffix))throw new Error("Couldn't load static file, no prefix or suffix specified!");var e=a.defer();return b(angular.extend({url:[d.prefix,c.key,d.suffix].join(""),method:"GET",params:""},c.$http)).success(function(a){e.resolve(a)}).error(function(){e.reject(c.key)}),e.promise},e=a.defer(),f=[],g=c.files.length,h=0;g>h;h++)f.push(d({prefix:c.files[h].prefix,key:c.key,suffix:c.files[h].suffix}));return a.all(f).then(function(a){for(var b=a.length,c={},d=0;b>d;d++)for(var f in a[d])c[f]=a[d][f];e.resolve(c)},function(a){e.reject(a)}),e.promise}}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!(c&&(angular.isArray(c.files)||angular.isString(c.prefix)&&angular.isString(c.suffix))))throw new Error("Couldn't load static files, no files and prefix or suffix specified!");c.files||(c.files=[{prefix:c.prefix,suffix:c.suffix}]);for(var d=function(d){if(!d||!angular.isString(d.prefix)||!angular.isString(d.suffix))throw new Error("Couldn't load static file, no prefix or suffix specified!");var e=a.defer();return b(angular.extend({url:[d.prefix,c.key,d.suffix].join(""),method:"GET",params:""},c.$http)).success(function(a){e.resolve(a)}).error(function(){e.reject(c.key)}),e.promise},e=a.defer(),f=[],g=c.files.length,h=0;g>h;h++)f.push(d({prefix:c.files[h].prefix,key:c.key,suffix:c.files[h].suffix}));return a.all(f).then(function(a){for(var b=a.length,c={},d=0;b>d;d++)for(var f in a[d])c[f]=a[d][f];e.resolve(c)},function(a){e.reject(a)}),e.promise}}return angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",a),a.$inject=["$q","$http"],a.displayName="$translateStaticFilesLoader","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -24,4 +40,8 @@ /** | ||
*/ | ||
.factory('$translateUrlLoader', ['$q', '$http', function ($q, $http) { | ||
.factory('$translateUrlLoader', $translateUrlLoader); | ||
function $translateUrlLoader($q, $http) { | ||
'use strict'; | ||
return function (options) { | ||
@@ -44,3 +64,3 @@ | ||
deferred.resolve(data); | ||
}).error(function (data) { | ||
}).error(function () { | ||
deferred.reject(options.key); | ||
@@ -51,2 +71,8 @@ }); | ||
}; | ||
}]); | ||
} | ||
$translateUrlLoader.$inject = ['$q', '$http']; | ||
$translateUrlLoader.displayName = '$translateUrlLoader'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateUrlLoader",["$q","$http",function(a,b){return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d=a.defer(),e={};return e[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:e,method:"GET"},c.$http)).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d=a.defer(),e={};return e[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:e,method:"GET"},c.$http)).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}return angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.$inject=["$q","$http"],a.displayName="$translateUrlLoader","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -18,4 +34,8 @@ | ||
*/ | ||
.factory('$translateCookieStorage', ['$cookieStore', function ($cookieStore) { | ||
.factory('$translateCookieStorage', $translateCookieStorageFactory); | ||
function $translateCookieStorageFactory($cookieStore) { | ||
'use strict'; | ||
var $translateCookieStorage = { | ||
@@ -72,2 +92,8 @@ | ||
return $translateCookieStorage; | ||
}]); | ||
} | ||
$translateCookieStorageFactory.$inject = ['$cookieStore']; | ||
$translateCookieStorageFactory.displayName = '$translateCookieStorage'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateCookieStorage",["$cookieStore",function(a){var b={get:function(b){return a.get(b)},set:function(b,c){a.put(b,c)},put:function(b,c){a.put(b,c)}};return b}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";var b={get:function(b){return a.get(b)},set:function(b,c){a.put(b,c)},put:function(b,c){a.put(b,c)}};return b}return angular.module("pascalprecht.translate").factory("$translateCookieStorage",a),a.$inject=["$cookieStore"],a.displayName="$translateCookieStorage","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([], function () { | ||
return (factory()); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else { | ||
factory(); | ||
} | ||
}(this, function () { | ||
angular.module('pascalprecht.translate') | ||
@@ -19,4 +35,8 @@ | ||
*/ | ||
.factory('$translateLocalStorage', ['$window', '$translateCookieStorage', function ($window, $translateCookieStorage) { | ||
.factory('$translateLocalStorage', $translateLocalStorageFactory); | ||
function $translateLocalStorageFactory($window, $translateCookieStorage) { | ||
'use strict'; | ||
// Setup adapter | ||
@@ -98,2 +118,8 @@ var localStorageAdapter = (function(){ | ||
return $translateLocalStorage; | ||
}]); | ||
} | ||
$translateLocalStorageFactory.$inject = ['$window', '$translateCookieStorage']; | ||
$translateLocalStorageFactory.displayName = '$translateLocalStorageFactory'; | ||
return 'pascalprecht.translate'; | ||
})); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateLocalStorage",["$window","$translateCookieStorage",function(a,b){var c=function(){var b;return{get:function(c){return b||(b=a.localStorage.getItem(c)),b},set:function(c,d){b=d,a.localStorage.setItem(c,d)},put:function(c,d){b=d,a.localStorage.setItem(c,d)}}}(),d="localStorage"in a;if(d){var e="pascalprecht.translate.storageTest";try{null!==a.localStorage?(a.localStorage.setItem(e,"foo"),a.localStorage.removeItem(e),d=!0):d=!1}catch(f){d=!1}}var g=d?c:b;return g}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";var c=function(){var b;return{get:function(c){return b||(b=a.localStorage.getItem(c)),b},set:function(c,d){b=d,a.localStorage.setItem(c,d)},put:function(c,d){b=d,a.localStorage.setItem(c,d)}}}(),d="localStorage"in a;if(d){var e="pascalprecht.translate.storageTest";try{null!==a.localStorage?(a.localStorage.setItem(e,"foo"),a.localStorage.removeItem(e),d=!0):d=!1}catch(f){d=!1}}var g=d?c:b;return g}return angular.module("pascalprecht.translate").factory("$translateLocalStorage",a),a.$inject=["$window","$translateCookieStorage"],a.displayName="$translateLocalStorageFactory","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.6.1 - 2015-03-01 | ||
* angular-translate - v2.7.0 - 2015-05-02 | ||
* http://github.com/angular-translate/angular-translate | ||
* Copyright (c) 2015 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate",["ng"]).run(["$translate",function(a){var b=a.storageKey(),c=a.storage(),d=function(){var d=a.preferredLanguage();angular.isString(d)?a.use(d):c.put(b,a.use())};c?c.get(b)?a.use(c.get(b))["catch"](d):d():angular.isString(a.preferredLanguage())&&a.use(a.preferredLanguage())}]),angular.module("pascalprecht.translate").provider("$translate",["$STORAGE_KEY","$windowProvider",function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r={},s=[],t=a,u=[],v=!1,w="translate-cloak",x=!1,y=".",z=0,A="2.6.1",B=function(){var a,c,d=b.$get().navigator,e=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(d.languages))for(a=0;a<d.languages.length;a++)if(c=d.languages[a],c&&c.length)return c;for(a=0;a<e.length;a++)if(c=d[e[a]],c&&c.length)return c;return null};B.displayName="angular-translate/service: getFirstBrowserLanguage";var C=function(){return(B()||"").split("-").join("_")};C.displayName="angular-translate/service: getLocale";var D=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},E=function(){return this.replace(/^\s+|\s+$/g,"")},F=function(a){for(var b=[],c=angular.lowercase(a),e=0,f=s.length;f>e;e++)b.push(angular.lowercase(s[e]));if(D(b,c)>-1)return a;if(d){var g;for(var h in d){var i=!1,j=Object.prototype.hasOwnProperty.call(d,h)&&angular.lowercase(h)===angular.lowercase(a);if("*"===h.slice(-1)&&(i=h.slice(0,-1)===a.slice(0,h.length-1)),(j||i)&&(g=d[h],D(b,angular.lowercase(g))>-1))return g}}var k=a.split("_");return k.length>1&&D(b,angular.lowercase(k[0]))>-1?k[0]:a},G=function(a,b){if(!a&&!b)return r;if(a&&!b){if(angular.isString(a))return r[a]}else angular.isObject(r[a])||(r[a]={}),angular.extend(r[a],H(b));return this};this.translations=G,this.cloakClassName=function(a){return a?(w=a,this):w};var H=function(a,b,c,d){var e,f,g,h;b||(b=[]),c||(c={});for(e in a)Object.prototype.hasOwnProperty.call(a,e)&&(h=a[e],angular.isObject(h)?H(h,b.concat(e),c,e):(f=b.length?""+b.join(y)+y+e:e,b.length&&e===d&&(g=""+b.join(y),c[g]="@:"+f),c[f]=h));return c};this.addInterpolation=function(a){return u.push(a),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(a){return l=a,this},this.useSanitizeValueStrategy=function(a){return v=a,this},this.preferredLanguage=function(a){return I(a),this};var I=function(a){return a&&(c=a),c};this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},this.translationNotFoundIndicatorLeft=function(a){return a?(o=a,this):o},this.translationNotFoundIndicatorRight=function(a){return a?(p=a,this):p},this.fallbackLanguage=function(a){return J(a),this};var J=function(a){return a?(angular.isString(a)?(f=!0,e=[a]):angular.isArray(a)&&(f=!1,e=a),angular.isString(c)&&D(e,c)<0&&e.push(c),this):f?e[0]:e};this.use=function(a){if(a){if(!r[a]&&!m)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return g=a,this}return g};var K=function(a){return a?void(t=a):j?j+t:t};this.storageKey=K,this.useUrlLoader=function(a,b){return this.useLoader("$translateUrlLoader",angular.extend({url:a},b))},this.useStaticFilesLoader=function(a){return this.useLoader("$translateStaticFilesLoader",a)},this.useLoader=function(a,b){return m=a,n=b||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(a){return i=a,this},this.storagePrefix=function(a){return a?(j=a,this):a},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(a){return k=a,this},this.usePostCompiling=function(a){return x=!!a,this},this.determinePreferredLanguage=function(a){var b=a&&angular.isFunction(a)?a():C();return c=s.length?F(b):b,this},this.registerAvailableLanguageKeys=function(a,b){return a?(s=a,b&&(d=b),this):s},this.useLoaderCache=function(a){return a===!1?q=void 0:a===!0?q=!0:"undefined"==typeof a?q="$translationCache":a&&(q=a),this},this.directivePriority=function(a){return void 0===a?z:(z=a,this)},this.$get=["$log","$injector","$rootScope","$q",function(a,b,d,j){var s,y,B,C=b.get(l||"$translateDefaultInterpolation"),L=!1,M={},N={},O=function(a,b,d,f){if(angular.isArray(a)){var h=function(a){for(var c={},e=[],g=function(a){var e=j.defer(),g=function(b){c[a]=b,e.resolve([a,b])};return O(a,b,d,f).then(g,g),e.promise},h=0,i=a.length;i>h;h++)e.push(g(a[h]));return j.all(e).then(function(){return c})};return h(a)}var k=j.defer();a&&(a=E.apply(a));var l=function(){var a=c?N[c]:N[g];if(y=0,i&&!a){var b=s.get(t);if(a=N[b],e&&e.length){var d=D(e,b);y=0===d?1:0,D(e,c)<0&&e.push(c)}}return a}();return l?l.then(function(){$(a,b,d,f).then(k.resolve,k.reject)},k.reject):$(a,b,d,f).then(k.resolve,k.reject),k.promise},P=function(a){return o&&(a=[o,a].join(" ")),p&&(a=[a,p].join(" ")),a},Q=function(a){g=a,d.$emit("$translateChangeSuccess",{language:a}),i&&s.put(O.storageKey(),g),C.setLocale(g),angular.forEach(M,function(a,b){M[b].setLocale(g)}),d.$emit("$translateChangeEnd",{language:a})},R=function(a){if(!a)throw"No language key specified for loading.";var c=j.defer();d.$emit("$translateLoadingStart",{language:a}),L=!0;var e=q;"string"==typeof e&&(e=b.get(e));var f=angular.extend({},n,{key:a,$http:angular.extend({},{cache:e},n.$http)});return b.get(m)(f).then(function(b){var e={};d.$emit("$translateLoadingSuccess",{language:a}),angular.isArray(b)?angular.forEach(b,function(a){angular.extend(e,H(a))}):angular.extend(e,H(b)),L=!1,c.resolve({key:a,table:e}),d.$emit("$translateLoadingEnd",{language:a})},function(a){d.$emit("$translateLoadingError",{language:a}),c.reject(a),d.$emit("$translateLoadingEnd",{language:a})}),c.promise};if(i&&(s=b.get(i),!s.get||!s.put))throw new Error("Couldn't use storage '"+i+"', missing get() or put() method!");angular.isFunction(C.useSanitizeValueStrategy)&&C.useSanitizeValueStrategy(v),u.length&&angular.forEach(u,function(a){var d=b.get(a);d.setLocale(c||g),angular.isFunction(d.useSanitizeValueStrategy)&&d.useSanitizeValueStrategy(v),M[d.getInterpolationIdentifier()]=d});var S=function(a){var b=j.defer();return Object.prototype.hasOwnProperty.call(r,a)?b.resolve(r[a]):N[a]?N[a].then(function(a){G(a.key,a.table),b.resolve(a.table)},b.reject):b.reject(),b.promise},T=function(a,b,c,d){var e=j.defer();return S(a).then(function(f){if(Object.prototype.hasOwnProperty.call(f,b)){d.setLocale(a);var h=f[b];"@:"===h.substr(0,2)?T(a,h.substr(2),c,d).then(e.resolve,e.reject):e.resolve(d.interpolate(f[b],c)),d.setLocale(g)}else e.reject()},e.reject),e.promise},U=function(a,b,c,d){var e,f=r[a];if(f&&Object.prototype.hasOwnProperty.call(f,b)){if(d.setLocale(a),e=d.interpolate(f[b],c),"@:"===e.substr(0,2))return U(a,e.substr(2),c,d);d.setLocale(g)}return e},V=function(a){if(k){var c=b.get(k)(a,g);return void 0!==c?c:a}return a},W=function(a,b,c,d,f){var g=j.defer();if(a<e.length){var h=e[a];T(h,b,c,d).then(g.resolve,function(){W(a+1,b,c,d,f).then(g.resolve)})}else g.resolve(f?f:V(b));return g.promise},X=function(a,b,c,d){var f;if(a<e.length){var g=e[a];f=U(g,b,c,d),f||(f=X(a+1,b,c,d))}return f},Y=function(a,b,c,d){return W(B>0?B:y,a,b,c,d)},Z=function(a,b,c){return X(B>0?B:y,a,b,c)},$=function(a,b,c,d){var f=j.defer(),h=g?r[g]:r,i=c?M[c]:C;if(h&&Object.prototype.hasOwnProperty.call(h,a)){var l=h[a];"@:"===l.substr(0,2)?O(l.substr(2),b,c,d).then(f.resolve,f.reject):f.resolve(i.interpolate(l,b))}else{var m;k&&!L&&(m=V(a)),g&&e&&e.length?Y(a,b,i,d).then(function(a){f.resolve(a)},function(a){f.reject(P(a))}):k&&!L&&m?f.resolve(d?d:m):d?f.resolve(d):f.reject(P(a))}return f.promise},_=function(a,b,c){var d,f=g?r[g]:r,h=C;if(M&&Object.prototype.hasOwnProperty.call(M,c)&&(h=M[c]),f&&Object.prototype.hasOwnProperty.call(f,a)){var i=f[a];d="@:"===i.substr(0,2)?_(i.substr(2),b,c):h.interpolate(i,b)}else{var j;k&&!L&&(j=V(a)),g&&e&&e.length?(y=0,d=Z(a,b,h)):d=k&&!L&&j?j:P(a)}return d};if(O.preferredLanguage=function(a){return a&&I(a),c},O.cloakClassName=function(){return w},O.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(J(a),m&&e&&e.length)for(var b=0,c=e.length;c>b;b++)N[e[b]]||(N[e[b]]=R(e[b]));O.use(O.use())}return f?e[0]:e},O.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=D(e,a);b>-1&&(B=b)}else B=0},O.proposedLanguage=function(){return h},O.storage=function(){return s},O.use=function(a){if(!a)return g;var b=j.defer();d.$emit("$translateChangeStart",{language:a});var c=F(a);return c&&(a=c),r[a]||!m||N[a]?(b.resolve(a),Q(a)):(h=a,N[a]=R(a).then(function(c){return G(c.key,c.table),b.resolve(c.key),Q(c.key),h===a&&(h=void 0),c},function(a){h===a&&(h=void 0),d.$emit("$translateChangeError",{language:a}),b.reject(a),d.$emit("$translateChangeEnd",{language:a})})),b.promise},O.storageKey=function(){return K()},O.isPostCompilingEnabled=function(){return x},O.refresh=function(a){function b(){f.resolve(),d.$emit("$translateRefreshEnd",{language:a})}function c(){f.reject(),d.$emit("$translateRefreshEnd",{language:a})}if(!m)throw new Error("Couldn't refresh translation table, no loader registered!");var f=j.defer();if(d.$emit("$translateRefreshStart",{language:a}),a)r[a]?R(a).then(function(c){G(c.key,c.table),a===g&&Q(g),b()},c):c();else{var h=[],i={};if(e&&e.length)for(var k=0,l=e.length;l>k;k++)h.push(R(e[k])),i[e[k]]=!0;g&&!i[g]&&h.push(R(g)),j.all(h).then(function(a){angular.forEach(a,function(a){r[a.key]&&delete r[a.key],G(a.key,a.table)}),g&&Q(g),b()})}return f.promise},O.instant=function(a,b,d){if(null===a||angular.isUndefined(a))return a;if(angular.isArray(a)){for(var f={},h=0,i=a.length;i>h;h++)f[a[h]]=O.instant(a[h],b,d);return f}if(angular.isString(a)&&a.length<1)return a;a&&(a=E.apply(a));var j,l=[];c&&l.push(c),g&&l.push(g),e&&e.length&&(l=l.concat(e));for(var m=0,n=l.length;n>m;m++){var q=l[m];if(r[q]&&("undefined"!=typeof r[q][a]?j=_(a,b,d):(o||p)&&(j=P(a))),"undefined"!=typeof j)break}return j||""===j||(j=C.interpolate(a,b),k&&!L&&(j=V(a))),j},O.versionInfo=function(){return A},O.loaderCache=function(){return q},O.directivePriority=function(){return z},m&&(angular.equals(r,{})&&O.use(O.use()),e&&e.length))for(var ab=function(a){return G(a.key,a.table),d.$emit("$translateChangeEnd",{language:a.key}),a},bb=0,cb=e.length;cb>bb;bb++)N[e[bb]]=R(e[bb]).then(ab);return O}]}]),angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",["$interpolate",function(a){var b,c={},d="default",e=null,f={escaped:function(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=angular.isNumber(a[c])?a[c]:angular.element("<div></div>").text(a[c]).html());return b}},g=function(a){var b;return b=angular.isFunction(f[e])?f[e](a):a};return c.setLocale=function(a){b=a},c.getInterpolationIdentifier=function(){return d},c.useSanitizeValueStrategy=function(a){return e=a,this},c.interpolate=function(b,c){return e&&(c=g(c)),a(b)(c||{})},c}]),angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",["$translate","$q","$interpolate","$compile","$parse","$rootScope",function(a,b,c,d,e,f){var g=function(){return this.replace(/^\s+|\s+$/g,"")};return{restrict:"AE",scope:!0,priority:a.directivePriority(),compile:function(b,h){var i=h.translateValues?h.translateValues:void 0,j=h.translateInterpolation?h.translateInterpolation:void 0,k=b[0].outerHTML.match(/translate-value-+/i),l="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)",m="^(.*)"+c.startSymbol()+"(.*)"+c.endSymbol()+"(.*)";return function(b,n,o){b.interpolateParams={},b.preText="",b.postText="";var p={},q=function(a){if(angular.isFunction(q._unwatchOld)&&(q._unwatchOld(),q._unwatchOld=void 0),angular.equals(a,"")||!angular.isDefined(a)){var d=g.apply(n.text()).match(l);if(angular.isArray(d)){b.preText=d[1],b.postText=d[3],p.translate=c(d[2])(b.$parent);var e=n.text().match(m);angular.isArray(e)&&e[2]&&e[2].length&&(q._unwatchOld=b.$watch(e[2],function(a){p.translate=a,w()}))}else p.translate=n.text().replace(/^\s+|\s+$/g,"")}else p.translate=a;w()},r=function(a){o.$observe(a,function(b){p[a]=b,w()})},s=!0;o.$observe("translate",function(a){"undefined"==typeof a?q(""):""===a&&s||(p.translate=a,w()),s=!1});for(var t in o)o.hasOwnProperty(t)&&"translateAttr"===t.substr(0,13)&&r(t);if(o.$observe("translateDefault",function(a){b.defaultText=a}),i&&o.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),k){var u=function(a){o.$observe(a,function(c){var d=angular.lowercase(a.substr(14,1))+a.substr(15);b.interpolateParams[d]=c})};for(var v in o)Object.prototype.hasOwnProperty.call(o,v)&&"translateValue"===v.substr(0,14)&&"translateValues"!==v&&u(v)}var w=function(){for(var a in p)p.hasOwnProperty(a)&&x(a,p[a],b,b.interpolateParams,b.defaultText)},x=function(b,c,d,e,f){c?a(c,e,j,f).then(function(a){y(a,d,!0,b)},function(a){y(a,d,!1,b)}):y(c,d,!1,b)},y=function(b,c,e,f){if("translate"===f){e||"undefined"==typeof c.defaultText||(b=c.defaultText),n.html(c.preText+b+c.postText);var g=a.isPostCompilingEnabled(),i="undefined"!=typeof h.translateCompile,j=i&&"false"!==h.translateCompile;(g&&!i||j)&&d(n.contents())(c)}else{e||"undefined"==typeof c.defaultText||(b=c.defaultText);var k=o.$attr[f].substr(15);n.attr(k,b)}};b.$watch("interpolateParams",w,!0);var z=f.$on("$translateChangeSuccess",w);n.text().length&&q(""),w(),b.$on("$destroy",z)}}}}]),angular.module("pascalprecht.translate").directive("translateCloak",["$rootScope","$translate",function(a,b){return{compile:function(c){var d=function(){c.addClass(b.cloakClassName())},e=function(){c.removeClass(b.cloakClassName())},f=a.$on("$translateChangeEnd",function(){e(),f(),f=null});return d(),function(a,c,f){f.translateCloak&&f.translateCloak.length&&f.$observe("translateCloak",function(a){b(a).then(e,d)})}}}}]),angular.module("pascalprecht.translate").filter("translate",["$parse","$translate",function(a,b){var c=function(c,d,e){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e)};return c.$stateful=!0,c}]); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";var b=a.storageKey(),c=a.storage(),d=function(){var d=a.preferredLanguage();angular.isString(d)?a.use(d):c.put(b,a.use())};d.displayName="fallbackFromIncorrectStorageValue",c?c.get(b)?a.use(c.get(b))["catch"](d):d():angular.isString(a.preferredLanguage())&&a.use(a.preferredLanguage())}function b(){"use strict";var a,b,c=null,d=!1,e=!1;b={sanitize:function(a,b){return"text"===b&&(a=g(a)),a},escape:function(a,b){return"text"===b&&(a=f(a)),a},sanitizeParameters:function(a,b){return"params"===b&&(a=h(a,g)),a},escapeParameters:function(a,b){return"params"===b&&(a=h(a,f)),a}},b.escaped=b.escapeParameters,this.addStrategy=function(a,c){return b[a]=c,this},this.removeStrategy=function(a){return delete b[a],this},this.useStrategy=function(a){return d=!0,c=a,this},this.$get=["$injector","$log",function(f,g){var h=function(a,c,d){return angular.forEach(d,function(d){if(angular.isFunction(d))a=d(a,c);else{if(!angular.isFunction(b[d]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'");a=b[d](a,c)}}),a},i=function(){d||e||(g.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."),e=!0)};return f.has("$sanitize")&&(a=f.get("$sanitize")),{useStrategy:function(a){return function(b){a.useStrategy(b)}}(this),sanitize:function(a,b,d){if(c||i(),arguments.length<3&&(d=c),!d)return a;var e=angular.isArray(d)?d:[d];return h(a,b,e)}}}];var f=function(a){return angular.element("<div></div>").text(a).html()},g=function(b){if(!a)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'.");return a(b)},h=function(a,b){if(angular.isObject(a)){var c=angular.isArray(a)?[]:{};return angular.forEach(a,function(a,d){c[d]=h(a,b)}),c}return angular.isNumber(a)?a:b(a)}}function c(a,b,c,d){"use strict";var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t={},u=[],v=a,w=[],x="translate-cloak",y=!1,z=".",A=0,B=!0,C="default",D={"default":function(a){return(a||"").split("-").join("_")},java:function(a){var b=(a||"").split("-").join("_"),c=b.split("_");return c.length>1?c[0].toLowerCase()+"_"+c[1].toUpperCase():b},bcp47:function(a){var b=(a||"").split("_").join("-"),c=b.split("-");return c.length>1?c[0].toLowerCase()+"-"+c[1].toUpperCase():b}},E="2.7.0",F=function(){if(angular.isFunction(d.getLocale))return d.getLocale();var a,c,e=b.$get().navigator,f=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(e.languages))for(a=0;a<e.languages.length;a++)if(c=e.languages[a],c&&c.length)return c;for(a=0;a<f.length;a++)if(c=e[f[a]],c&&c.length)return c;return null};F.displayName="angular-translate/service: getFirstBrowserLanguage";var G=function(){var a=F()||"";return D[C]&&(a=D[C](a)),a};G.displayName="angular-translate/service: getLocale";var H=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},I=function(){return this.replace(/^\s+|\s+$/g,"")},J=function(a){for(var b=[],c=angular.lowercase(a),d=0,e=u.length;e>d;d++)b.push(angular.lowercase(u[d]));if(H(b,c)>-1)return a;if(f){var g;for(var h in f){var i=!1,j=Object.prototype.hasOwnProperty.call(f,h)&&angular.lowercase(h)===angular.lowercase(a);if("*"===h.slice(-1)&&(i=h.slice(0,-1)===a.slice(0,h.length-1)),(j||i)&&(g=f[h],H(b,angular.lowercase(g))>-1))return g}}if(a){var k=a.split("_");if(k.length>1&&H(b,angular.lowercase(k[0]))>-1)return k[0]}return a},K=function(a,b){if(!a&&!b)return t;if(a&&!b){if(angular.isString(a))return t[a]}else angular.isObject(t[a])||(t[a]={}),angular.extend(t[a],L(b));return this};this.translations=K,this.cloakClassName=function(a){return a?(x=a,this):x};var L=function(a,b,c,d){var e,f,g,h;b||(b=[]),c||(c={});for(e in a)Object.prototype.hasOwnProperty.call(a,e)&&(h=a[e],angular.isObject(h)?L(h,b.concat(e),c,e):(f=b.length?""+b.join(z)+z+e:e,b.length&&e===d&&(g=""+b.join(z),c[g]="@:"+f),c[f]=h));return c};L.displayName="flatObject",this.addInterpolation=function(a){return w.push(a),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(a){return n=a,this},this.useSanitizeValueStrategy=function(a){return c.useStrategy(a),this},this.preferredLanguage=function(a){return M(a),this};var M=function(a){return a&&(e=a),e};this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},this.translationNotFoundIndicatorLeft=function(a){return a?(q=a,this):q},this.translationNotFoundIndicatorRight=function(a){return a?(r=a,this):r},this.fallbackLanguage=function(a){return N(a),this};var N=function(a){return a?(angular.isString(a)?(h=!0,g=[a]):angular.isArray(a)&&(h=!1,g=a),angular.isString(e)&&H(g,e)<0&&g.push(e),this):h?g[0]:g};this.use=function(a){if(a){if(!t[a]&&!o)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return i=a,this}return i};var O=function(a){return a?void(v=a):l?l+v:v};this.storageKey=O,this.useUrlLoader=function(a,b){return this.useLoader("$translateUrlLoader",angular.extend({url:a},b))},this.useStaticFilesLoader=function(a){return this.useLoader("$translateStaticFilesLoader",a)},this.useLoader=function(a,b){return o=a,p=b||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(a){return k=a,this},this.storagePrefix=function(a){return a?(l=a,this):a},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(a){return m=a,this},this.usePostCompiling=function(a){return y=!!a,this},this.uniformLanguageTag=function(a){return a?angular.isString(a)&&(a={standard:a}):a={},C=a.standard,this},this.determinePreferredLanguage=function(a){var b=a&&angular.isFunction(a)?a():G();return e=u.length?J(b):b,this},this.registerAvailableLanguageKeys=function(a,b){return a?(u=a,b&&(f=b),this):u},this.useLoaderCache=function(a){return a===!1?s=void 0:a===!0?s=!0:"undefined"==typeof a?s="$translationCache":a&&(s=a),this},this.directivePriority=function(a){return void 0===a?A:(A=a,this)},this.statefulFilter=function(a){return void 0===a?B:(B=a,this)},this.$get=["$log","$injector","$rootScope","$q",function(a,b,c,d){var f,l,u,z=b.get(n||"$translateDefaultInterpolation"),C=!1,D={},F={},G=function(a,b,c,h){if(angular.isArray(a)){var j=function(a){for(var e={},f=[],g=function(a){var f=d.defer(),g=function(b){e[a]=b,f.resolve([a,b])};return G(a,b,c,h).then(g,g),f.promise},i=0,j=a.length;j>i;i++)f.push(g(a[i]));return d.all(f).then(function(){return e})};return j(a)}var m=d.defer();a&&(a=I.apply(a));var n=function(){var a=e?F[e]:F[i];if(l=0,k&&!a){var b=f.get(v);if(a=F[b],g&&g.length){var c=H(g,b);l=0===c?1:0,H(g,e)<0&&g.push(e)}}return a}();if(n){var o=function(){_(a,b,c,h).then(m.resolve,m.reject)};o.displayName="promiseResolved",n["finally"](o,m.reject)}else _(a,b,c,h).then(m.resolve,m.reject);return m.promise},P=function(a){return q&&(a=[q,a].join(" ")),r&&(a=[a,r].join(" ")),a},Q=function(a){i=a,c.$emit("$translateChangeSuccess",{language:a}),k&&f.put(G.storageKey(),i),z.setLocale(i);var b=function(a,b){D[b].setLocale(i)};b.displayName="eachInterpolatorLocaleSetter",angular.forEach(D,b),c.$emit("$translateChangeEnd",{language:a})},R=function(a){if(!a)throw"No language key specified for loading.";var e=d.defer();c.$emit("$translateLoadingStart",{language:a}),C=!0;var f=s;"string"==typeof f&&(f=b.get(f));var g=angular.extend({},p,{key:a,$http:angular.extend({},{cache:f},p.$http)}),h=function(b){var d={};c.$emit("$translateLoadingSuccess",{language:a}),angular.isArray(b)?angular.forEach(b,function(a){angular.extend(d,L(a))}):angular.extend(d,L(b)),C=!1,e.resolve({key:a,table:d}),c.$emit("$translateLoadingEnd",{language:a})};h.displayName="onLoaderSuccess";var i=function(a){c.$emit("$translateLoadingError",{language:a}),e.reject(a),c.$emit("$translateLoadingEnd",{language:a})};return i.displayName="onLoaderError",b.get(o)(g).then(h,i),e.promise};if(k&&(f=b.get(k),!f.get||!f.put))throw new Error("Couldn't use storage '"+k+"', missing get() or put() method!");if(w.length){var S=function(a){var c=b.get(a);c.setLocale(e||i),D[c.getInterpolationIdentifier()]=c};S.displayName="interpolationFactoryAdder",angular.forEach(w,S)}var T=function(a){var b=d.defer();if(Object.prototype.hasOwnProperty.call(t,a))b.resolve(t[a]);else if(F[a]){var c=function(a){K(a.key,a.table),b.resolve(a.table)};c.displayName="translationTableResolver",F[a].then(c,b.reject)}else b.reject();return b.promise},U=function(a,b,c,e){var f=d.defer(),g=function(d){if(Object.prototype.hasOwnProperty.call(d,b)){e.setLocale(a);var g=d[b];"@:"===g.substr(0,2)?U(a,g.substr(2),c,e).then(f.resolve,f.reject):f.resolve(e.interpolate(d[b],c)),e.setLocale(i)}else f.reject()};return g.displayName="fallbackTranslationResolver",T(a).then(g,f.reject),f.promise},V=function(a,b,c,d){var e,f=t[a];if(f&&Object.prototype.hasOwnProperty.call(f,b)){if(d.setLocale(a),e=d.interpolate(f[b],c),"@:"===e.substr(0,2))return V(a,e.substr(2),c,d);d.setLocale(i)}return e},W=function(a,c){if(m){var d=b.get(m)(a,i,c);return void 0!==d?d:a}return a},X=function(a,b,c,e,f){var h=d.defer();if(a<g.length){var i=g[a];U(i,b,c,e).then(h.resolve,function(){X(a+1,b,c,e,f).then(h.resolve)})}else h.resolve(f?f:W(b,c));return h.promise},Y=function(a,b,c,d){var e;if(a<g.length){var f=g[a];e=V(f,b,c,d),e||(e=Y(a+1,b,c,d))}return e},Z=function(a,b,c,d){return X(u>0?u:l,a,b,c,d)},$=function(a,b,c){return Y(u>0?u:l,a,b,c)},_=function(a,b,c,e){var f=d.defer(),h=i?t[i]:t,j=c?D[c]:z;if(h&&Object.prototype.hasOwnProperty.call(h,a)){var k=h[a];"@:"===k.substr(0,2)?G(k.substr(2),b,c,e).then(f.resolve,f.reject):f.resolve(j.interpolate(k,b))}else{var l;m&&!C&&(l=W(a,b)),i&&g&&g.length?Z(a,b,j,e).then(function(a){f.resolve(a)},function(a){f.reject(P(a))}):m&&!C&&l?f.resolve(e?e:l):e?f.resolve(e):f.reject(P(a))}return f.promise},ab=function(a,b,c){var d,e=i?t[i]:t,f=z;if(D&&Object.prototype.hasOwnProperty.call(D,c)&&(f=D[c]),e&&Object.prototype.hasOwnProperty.call(e,a)){var h=e[a];d="@:"===h.substr(0,2)?ab(h.substr(2),b,c):f.interpolate(h,b)}else{var j;m&&!C&&(j=W(a,b)),i&&g&&g.length?(l=0,d=$(a,b,f)):d=m&&!C&&j?j:P(a)}return d},bb=function(a){j===a&&(j=void 0),F[a]=void 0};if(G.preferredLanguage=function(a){return a&&M(a),e},G.cloakClassName=function(){return x},G.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(N(a),o&&g&&g.length)for(var b=0,c=g.length;c>b;b++)F[g[b]]||(F[g[b]]=R(g[b]));G.use(G.use())}return h?g[0]:g},G.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=H(g,a);b>-1&&(u=b)}else u=0},G.proposedLanguage=function(){return j},G.storage=function(){return f},G.use=function(a){if(!a)return i;var b=d.defer();c.$emit("$translateChangeStart",{language:a});var e=J(a);return e&&(a=e),t[a]||!o||F[a]?j===a&&F[a]?F[a].then(function(a){return b.resolve(a.key),a},function(a){return b.reject(a),d.reject(a)}):(b.resolve(a),Q(a)):(j=a,F[a]=R(a).then(function(a){return K(a.key,a.table),b.resolve(a.key),Q(a.key),a},function(a){return c.$emit("$translateChangeError",{language:a}),b.reject(a),c.$emit("$translateChangeEnd",{language:a}),d.reject(a)}),F[a]["finally"](function(){bb(a)})),b.promise},G.storageKey=function(){return O()},G.isPostCompilingEnabled=function(){return y},G.refresh=function(a){function b(){f.resolve(),c.$emit("$translateRefreshEnd",{language:a})}function e(){f.reject(),c.$emit("$translateRefreshEnd",{language:a})}if(!o)throw new Error("Couldn't refresh translation table, no loader registered!");var f=d.defer();if(c.$emit("$translateRefreshStart",{language:a}),a)if(t[a]){var h=function(c){K(c.key,c.table),a===i&&Q(i),b()};h.displayName="refreshPostProcessor",R(a).then(h,e)}else e();else{var j=[],k={};if(g&&g.length)for(var l=0,m=g.length;m>l;l++)j.push(R(g[l])),k[g[l]]=!0;i&&!k[i]&&j.push(R(i));var n=function(a){t={},angular.forEach(a,function(a){K(a.key,a.table)}),i&&Q(i),b()};n.displayName="refreshPostProcessor",d.all(j).then(n)}return f.promise},G.instant=function(a,b,c){if(null===a||angular.isUndefined(a))return a;if(angular.isArray(a)){for(var d={},f=0,h=a.length;h>f;f++)d[a[f]]=G.instant(a[f],b,c);return d}if(angular.isString(a)&&a.length<1)return a;a&&(a=I.apply(a));var j,k=[];e&&k.push(e),i&&k.push(i),g&&g.length&&(k=k.concat(g));for(var l=0,n=k.length;n>l;l++){var o=k[l];if(t[o]&&("undefined"!=typeof t[o][a]?j=ab(a,b,c):(q||r)&&(j=P(a))),"undefined"!=typeof j)break}return j||""===j||(j=z.interpolate(a,b),m&&!C&&(j=W(a,b))),j},G.versionInfo=function(){return E},G.loaderCache=function(){return s},G.directivePriority=function(){return A},G.statefulFilter=function(){return B},o&&(angular.equals(t,{})&&G.use(G.use()),g&&g.length))for(var cb=function(a){return K(a.key,a.table),c.$emit("$translateChangeEnd",{language:a.key}),a},db=0,eb=g.length;eb>db;db++){var fb=g[db];t[fb]||(F[fb]=R(fb).then(cb))}return G}]}function d(a,b){"use strict";var c,d={},e="default";return d.setLocale=function(a){c=a},d.getInterpolationIdentifier=function(){return e},d.useSanitizeValueStrategy=function(a){return b.useStrategy(a),this},d.interpolate=function(c,d){d=d||{},d=b.sanitize(d,"params");var e=a(c)(d);return e=b.sanitize(e,"text")},d}function e(a,b,c,d,e,f){"use strict";var g=function(){return this.replace(/^\s+|\s+$/g,"")};return{restrict:"AE",scope:!0,priority:a.directivePriority(),compile:function(b,h){var i=h.translateValues?h.translateValues:void 0,j=h.translateInterpolation?h.translateInterpolation:void 0,k=b[0].outerHTML.match(/translate-value-+/i),l="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)",m="^(.*)"+c.startSymbol()+"(.*)"+c.endSymbol()+"(.*)";return function(b,n,o){b.interpolateParams={},b.preText="",b.postText="";var p={},q=function(a,c,d){if(c.translateValues&&angular.extend(a,e(c.translateValues)(b.$parent)),k)for(var f in d)if(Object.prototype.hasOwnProperty.call(c,f)&&"translateValue"===f.substr(0,14)&&"translateValues"!==f){var g=angular.lowercase(f.substr(14,1))+f.substr(15);a[g]=d[f]}},r=function(a){if(angular.isFunction(r._unwatchOld)&&(r._unwatchOld(),r._unwatchOld=void 0),angular.equals(a,"")||!angular.isDefined(a)){var d=g.apply(n.text()).match(l);if(angular.isArray(d)){b.preText=d[1],b.postText=d[3],p.translate=c(d[2])(b.$parent);var e=n.text().match(m);angular.isArray(e)&&e[2]&&e[2].length&&(r._unwatchOld=b.$watch(e[2],function(a){p.translate=a,x()}))}else p.translate=n.text().replace(/^\s+|\s+$/g,"")}else p.translate=a;x()},s=function(a){o.$observe(a,function(b){p[a]=b,x()})};q(b.interpolateParams,o,h);var t=!0;o.$observe("translate",function(a){"undefined"==typeof a?r(""):""===a&&t||(p.translate=a,x()),t=!1});for(var u in o)o.hasOwnProperty(u)&&"translateAttr"===u.substr(0,13)&&s(u);if(o.$observe("translateDefault",function(a){b.defaultText=a}),i&&o.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),k){var v=function(a){o.$observe(a,function(c){var d=angular.lowercase(a.substr(14,1))+a.substr(15);b.interpolateParams[d]=c})};for(var w in o)Object.prototype.hasOwnProperty.call(o,w)&&"translateValue"===w.substr(0,14)&&"translateValues"!==w&&v(w)}var x=function(){for(var a in p)p.hasOwnProperty(a)&&void 0!==p[a]&&y(a,p[a],b,b.interpolateParams,b.defaultText)},y=function(b,c,d,e,f){c?a(c,e,j,f).then(function(a){z(a,d,!0,b)},function(a){z(a,d,!1,b)}):z(c,d,!1,b)},z=function(b,c,e,f){if("translate"===f){e||"undefined"==typeof c.defaultText||(b=c.defaultText),n.html(c.preText+b+c.postText);var g=a.isPostCompilingEnabled(),i="undefined"!=typeof h.translateCompile,j=i&&"false"!==h.translateCompile;(g&&!i||j)&&d(n.contents())(c)}else{e||"undefined"==typeof c.defaultText||(b=c.defaultText);var k=o.$attr[f];"data-"===k.substr(0,5)&&(k=k.substr(5)),k=k.substr(15),n.attr(k,b)}};(i||k||o.translateDefault)&&b.$watch("interpolateParams",x,!0);var A=f.$on("$translateChangeSuccess",x);n.text().length&&r(o.translate?o.translate:""),x(),b.$on("$destroy",A)}}}}function f(a,b){"use strict";return{compile:function(c){var d=function(){c.addClass(b.cloakClassName())},e=function(){c.removeClass(b.cloakClassName())},f=a.$on("$translateChangeEnd",function(){e(),f(),f=null});return d(),function(a,c,f){f.translateCloak&&f.translateCloak.length&&f.$observe("translateCloak",function(a){b(a).then(e,d)})}}}}function g(a,b){"use strict";var c=function(c,d,e){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e)};return b.statefulFilter()&&(c.$stateful=!0),c}return angular.module("pascalprecht.translate",["ng"]).run(a),a.$inject=["$translate"],a.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",b),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",c),c.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],c.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",d),d.$inject=["$interpolate","$translateSanitization"],d.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",e),e.$inject=["$translate","$q","$interpolate","$compile","$parse","$rootScope"],e.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateCloak",f),f.$inject=["$rootScope","$translate"],f.displayName="translateCloakDirective",angular.module("pascalprecht.translate").filter("translate",g),g.$inject=["$parse","$translate"],g.displayName="translateFilterFactory","pascalprecht.translate"}); |
{ | ||
"name": "angular-translate", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"description": "A translation module for AngularJS", | ||
@@ -42,3 +42,3 @@ "main": "dist/angular-translate.js", | ||
"grunt-contrib-copy": "~0.4.1", | ||
"grunt-contrib-jshint": "~0.4.x", | ||
"grunt-contrib-jshint": "~0.11.x", | ||
"grunt-contrib-uglify": "~0.2.x", | ||
@@ -48,5 +48,7 @@ "grunt-contrib-watch": "~0.4.2", | ||
"grunt-express": "~0.3.3", | ||
"grunt-file-append": "0.0.6", | ||
"grunt-karma": "~0.9.0", | ||
"grunt-ng-annotate": "^0.8.0", | ||
"grunt-ngdocs": "~0.1.11", | ||
"grunt-ngdocs": "~0.2.5", | ||
"grunt-umd": "^2.3.3", | ||
"grunt-version": "~0.3.0", | ||
@@ -53,0 +55,0 @@ "jasmine-core": "^2.1.3", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199685
3594
27