angular-translate
Advanced tools
Comparing version 2.11.0 to 2.11.1
@@ -0,1 +1,22 @@ | ||
<a name="2.11.1"></a> | ||
## [2.11.1](https://github.com/angular-translate/angular-translate/compare/2.11.0...v2.11.1) (2016-07-17) | ||
### Bug Fixes | ||
* **dependencies:** Update messageformat to ~0.3.1 ([04e11c9](https://github.com/angular-translate/angular-translate/commit/04e11c9)) | ||
* **grunt:** add work-around for uglify preserveComments as expected ([32cdedb](https://github.com/angular-translate/angular-translate/commit/32cdedb)), closes [#1461](https://github.com/angular-translate/angular-translate/issues/1461) | ||
* **service:** allow instant function to also take care of post process configuration ([b7d7907](https://github.com/angular-translate/angular-translate/commit/b7d7907)) | ||
* **service:** avoid sanitizing of functions ([492d8e5](https://github.com/angular-translate/angular-translate/commit/492d8e5)), closes [#1529](https://github.com/angular-translate/angular-translate/issues/1529) | ||
* **service:** Correct descriptive ngdocs to match parameters on the service calls ([91711f7](https://github.com/angular-translate/angular-translate/commit/91711f7)) | ||
* **service:** fix interpolation issue with non-string as input ([fa4a80e](https://github.com/angular-translate/angular-translate/commit/fa4a80e)), closes [#1511](https://github.com/angular-translate/angular-translate/issues/1511) | ||
* **service:** fix lost of data in async loader / error in runtime ([5ee0c3e](https://github.com/angular-translate/angular-translate/commit/5ee0c3e)) | ||
### Features | ||
* **directive:** introduce a global keepContent setting ([2015f79](https://github.com/angular-translate/angular-translate/commit/2015f79)) | ||
<a name="2.11.0"></a> | ||
@@ -2,0 +23,0 @@ # [2.11.0](https://github.com/angular-translate/angular-translate/compare/2.10.0...v2.11.0) (2016-03-20) |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports=b():b()}(this,function(){function a(a){"use strict";return function(b){a.warn("Translation for "+b+" doesn't exist")}}return a.$inject=["$log"],angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",a),a.displayName="$translateMissingTranslationHandlerLog","pascalprecht.translate"}); | ||
!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 a.$inject=["$log"],angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",a),a.displayName="$translateMissingTranslationHandlerLog","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define(["messageformat"],function(a){return b(a)}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports=b(require("messageformat")):b(MessageFormat)}(this,function(a){function b(b,c,d){"use strict";var e={},f=c.get(d), | ||
// instantiate with default locale (which is 'en') | ||
g=new a("en"),h="messageformat"; | ||
// create cache if it doesn't exist already | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#setLocale | ||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation | ||
* | ||
* @description | ||
* Sets current locale (this is currently not use in this interpolation). | ||
* | ||
* @param {string} locale Language key or locale. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#getInterpolationIdentifier | ||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation | ||
* | ||
* @description | ||
* Returns an identifier for this interpolation service. | ||
* | ||
* @returns {string} $identifier | ||
*/ | ||
/** | ||
* @deprecated will be removed in 3.0 | ||
* @see {@link pascalprecht.translate.$translateSanitization} | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#interpolate | ||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation | ||
* | ||
* @description | ||
* Interpolates given string against given interpolate params using MessageFormat.js. | ||
* | ||
* @returns {string} interpolated string. | ||
*/ | ||
return f||(f=c(d)),f.put("en",g),e.setLocale=function(b){g=f.get(b),g||(g=new a(b),f.put(b,g))},e.getInterpolationIdentifier=function(){return h},e.useSanitizeValueStrategy=function(a){return b.useStrategy(a),this},e.interpolate=function(a,c){c=c||{},c=b.sanitize(c,"params");var d=f.get("mf:"+a); | ||
// if given string wasn't compiled yet, we do so now and never have to do it again | ||
if(!d){ | ||
// Ensure explicit type if possible | ||
// MessageFormat checks the actual type (i.e. for amount based conditions) | ||
for(var e in c)if(c.hasOwnProperty(e)){ | ||
// ensure number | ||
var h=parseInt(c[e],10);angular.isNumber(h)&&""+h===c[e]&&(c[e]=h)}d=g.compile(a),f.put("mf:"+a,d)}var i=d(c);return b.sanitize(i,"text")},e}return b.$inject=["$translateSanitization","$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE"],angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").factory("$translateMessageFormatInterpolation",b),b.displayName="$translateMessageFormatInterpolation","pascalprecht.translate"}); | ||
!function(a,b){"function"==typeof define&&define.amd?define(["messageformat"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("messageformat")):b(MessageFormat)}(this,function(a){function b(b,c,d){"use strict";var e={},f=c.get(d),g=new a("en"),h="messageformat";return f||(f=c(d)),f.put("en",g),e.setLocale=function(b){g=f.get(b),g||(g=new a(b),f.put(b,g))},e.getInterpolationIdentifier=function(){return h},e.useSanitizeValueStrategy=function(a){return b.useStrategy(a),this},e.interpolate=function(a,c){c=c||{},c=b.sanitize(c,"params");var d=f.get("mf:"+a);if(!d){for(var e in c)if(c.hasOwnProperty(e)){var h=parseInt(c[e],10);angular.isNumber(h)&&""+h===c[e]&&(c[e]=h)}d=g.compile(a),f.put("mf:"+a,d)}var i=d(c);return b.sanitize(i,"text")},e}return b.$inject=["$translateSanitization","$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE"],angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").factory("$translateMessageFormatInterpolation",b),b.displayName="$translateMessageFormatInterpolation","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports=b():b()}(this,function(){function a(){"use strict";/** | ||
* @constructor | ||
* @name Part | ||
* | ||
* @description | ||
* Represents Part object to add and set parts at runtime. | ||
*/ | ||
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}/** | ||
* @name parseUrl | ||
* @method | ||
* | ||
* @description | ||
* Returns a parsed url template string and replaces given target lang | ||
* and part name it. | ||
* | ||
* @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 | ||
*/ | ||
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){if(this.tables[a])return b.when(this.tables[a]);var g=this;return c(angular.extend({method:"GET",url:this.parseUrl(e,a)},d)).then(function(b){return g.tables[a]=b.data,b.data},function(){return f?f(g.name,a).then(function(b){return g.tables[a]=b,b},function(){return b.reject(g.name)}):b.reject(g.name)})};var g={};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoaderProvider#addPart | ||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider | ||
* | ||
* @description | ||
* Registers a new part of the translation table to be loaded once the | ||
* `angular-translate` gets into runtime phase. It does not actually load any | ||
* translation data, but only registers a part to be loaded in the future. | ||
* | ||
* @param {string} name A name of the part to add | ||
* @param {int} [priority=0] Sets the load priority of this part. | ||
* | ||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param | ||
* of the wrong type. Please, note that the `name` param has to be a | ||
* non-empty **string**. | ||
*/ | ||
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},/** | ||
* @ngdocs function | ||
* @name pascalprecht.translate.$translatePartialLoaderProvider#setPart | ||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider | ||
* | ||
* @description | ||
* Sets a translation table to the specified part. This method does not make the | ||
* specified part available, but only avoids loading this part from the server. | ||
* | ||
* @param {string} lang A language of the given translation table | ||
* @param {string} part A name of the target part | ||
* @param {object} table A translation table to set to the specified part | ||
* | ||
* @return {object} $translatePartialLoaderProvider, so this method is chainable | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass params | ||
* of the wrong type. Please, note that the `lang` and `part` params have to be a | ||
* non-empty **string**s and the `table` param has to be an object. | ||
*/ | ||
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},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoaderProvider#deletePart | ||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider | ||
* | ||
* @description | ||
* Removes the previously added part of the translation data. So, `angular-translate` will not | ||
* load it at the startup. | ||
* | ||
* @param {string} name A name of the part to delete | ||
* | ||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong | ||
* type. Please, note that the `name` param has to be a non-empty **string**. | ||
*/ | ||
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},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoaderProvider#isPartAvailable | ||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider | ||
* | ||
* @description | ||
* Checks if the specific part is available. A part becomes available after it was added by the | ||
* `addPart` method. Available parts would be loaded from the server once the `angular-translate` | ||
* asks the loader to that. | ||
* | ||
* @param {string} name A name of the part to check | ||
* | ||
* @returns {boolean} Returns **true** if the part is available now and **false** if not. | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong | ||
* type. Please, note that the `name` param has to be a non-empty **string**. | ||
*/ | ||
this.isPartAvailable=d,/** | ||
* @ngdoc object | ||
* @name pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @requires $q | ||
* @requires $http | ||
* @requires $injector | ||
* @requires $rootScope | ||
* @requires $translate | ||
* | ||
* @description | ||
* | ||
* @param {object} options Options object | ||
* | ||
* @throws {TypeError} | ||
*/ | ||
this.$get=["$rootScope","$injector","$q","$http",function(h,i,j,k){/** | ||
* @ngdoc event | ||
* @name pascalprecht.translate.$translatePartialLoader#$translatePartialLoaderStructureChanged | ||
* @eventOf pascalprecht.translate.$translatePartialLoader | ||
* @eventType broadcast on root scope | ||
* | ||
* @description | ||
* A $translatePartialLoaderStructureChanged event is called when a state of the loader was | ||
* changed somehow. It could mean either some part is added or some part is deleted. Anyway when | ||
* you get this event the translation table is not longer current and has to be updated. | ||
* | ||
* @param {string} name A name of the part which is a reason why the event was fired | ||
*/ | ||
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=f();return angular.forEach(g,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={};return g=f(),angular.forEach(g,function(c){e(b,c.tables[a.key])}),b},function(){return j.reject(a.key)})};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoader#addPart | ||
* @methodOf pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @description | ||
* Registers a new part of the translation table. This method does not actually perform any xhr | ||
* requests to get translation data. The new parts will be loaded in order of priority from the server next time | ||
* `angular-translate` asks the loader to load translations. | ||
* | ||
* @param {string} name A name of the part to add | ||
* @param {int} [priority=0] Sets the load priority of this part. | ||
* | ||
* @returns {object} $translatePartialLoader, so this method is chainable | ||
* | ||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged | ||
* event would be fired by this method in case the new part affected somehow on the loaders | ||
* state. This way it means that there are a new translation data available to be loaded from | ||
* the server. | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong | ||
* type. Please, note that the `name` param has to be a non-empty **string**. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoader#deletePart | ||
* @methodOf pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @description | ||
* Deletes the previously added part of the translation data. The target part could be deleted | ||
* either logically or physically. When the data is deleted logically it is not actually deleted | ||
* from the browser, but the loader marks it as not active and prevents it from affecting on the | ||
* translations. If the deleted in such way part is added again, the loader will use the | ||
* previously loaded data rather than loading it from the server once more time. But if the data | ||
* is deleted physically, the loader will completely remove all information about it. So in case | ||
* of recycling this part will be loaded from the server again. | ||
* | ||
* @param {string} name A name of the part to delete | ||
* @param {boolean=} [removeData=false] An indicator if the loader has to remove a loaded | ||
* translation data physically. If the `removeData` if set to **false** the loaded data will not be | ||
* deleted physically and might be reused in the future to prevent an additional xhr requests. | ||
* | ||
* @returns {object} $translatePartialLoader, so this method is chainable | ||
* | ||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged | ||
* event would be fired by this method in case a part deletion process affects somehow on the | ||
* loaders state. This way it means that some part of the translation data is now deprecated and | ||
* the translation table has to be recompiled with the remaining translation parts. | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass some param of the | ||
* wrong type. Please, note that the `name` param has to be a non-empty **string** and | ||
* the `removeData` param has to be either **undefined** or **boolean**. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoader#isPartLoaded | ||
* @methodOf pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @description | ||
* Checks if the registered translation part is loaded into the translation table. | ||
* | ||
* @param {string} name A name of the part | ||
* @param {string} lang A key of the language | ||
* | ||
* @returns {boolean} Returns **true** if the translation of the part is loaded to the translation table and **false** if not. | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong | ||
* type. Please, note that the `name` and `lang` params have to be non-empty **string**. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoader#getRegisteredParts | ||
* @methodOf pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @description | ||
* Gets names of the parts that were added with the `addPart`. | ||
* | ||
* @returns {array} Returns array of registered parts, if none were registered then an empty array is returned. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translatePartialLoader#isPartAvailable | ||
* @methodOf pascalprecht.translate.$translatePartialLoader | ||
* | ||
* @description | ||
* Checks if a target translation part is available. The part becomes available just after it was | ||
* added by the `addPart` method. Part's availability does not mean that it was loaded from the | ||
* server, but only that it was added to the loader. The available part might be loaded next | ||
* time the loader is called. | ||
* | ||
* @param {string} name A name of the part to delete | ||
* | ||
* @returns {boolean} Returns **true** if the part is available now and **false** if not. | ||
* | ||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong | ||
* type. Please, note that the `name` param has to be a non-empty **string**. | ||
*/ | ||
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&&( | ||
// getting on-demand instance of loader | ||
j=i.get(j)), | ||
// Purging items from cache... | ||
"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"}); | ||
!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){if(this.tables[a])return b.when(this.tables[a]);var g=this;return c(angular.extend({method:"GET",url:this.parseUrl(e,a)},d)).then(function(b){return g.tables[a]=b.data,b.data},function(){return f?f(g.name,a).then(function(b){return g.tables[a]=b,b},function(){return b.reject(g.name)}):b.reject(g.name)})};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=f();return angular.forEach(g,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={};return g=f(),angular.forEach(g,function(c){e(b,c.tables[a.key])}),b},function(){return j.reject(a.key)})};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.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
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!");return b(angular.extend({url:[d.prefix,c.key,d.suffix].join(""),method:"GET",params:""},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})},e=[],f=c.files.length,g=0;f>g;g++)e.push(d({prefix:c.files[g].prefix,key:c.key,suffix:c.files[g].suffix}));return a.all(e).then(function(a){for(var b=a.length,c={},d=0;b>d;d++)for(var e in a[d])c[e]=a[d][e];return c})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",a),a.displayName="$translateStaticFilesLoader","pascalprecht.translate"}); | ||
!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!");return b(angular.extend({url:[d.prefix,c.key,d.suffix].join(""),method:"GET",params:""},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})},e=[],f=c.files.length,g=0;g<f;g++)e.push(d({prefix:c.files[g].prefix,key:c.key,suffix:c.files[g].suffix}));return a.all(e).then(function(a){for(var b=a.length,c={},d=0;d<b;d++)for(var e in a[d])c[e]=a[d][e];return c})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",a),a.displayName="$translateStaticFilesLoader","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
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={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"}); | ||
!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={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports=b():b()}(this,function(){function a(a){"use strict";var b={/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateCookieStorage#get | ||
* @methodOf pascalprecht.translate.$translateCookieStorage | ||
* | ||
* @description | ||
* Returns an item from cookieStorage by given name. | ||
* | ||
* @param {string} name Item name | ||
* @return {string} Value of item name | ||
*/ | ||
get:function(b){return a.get(b)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateCookieStorage#set | ||
* @methodOf pascalprecht.translate.$translateCookieStorage | ||
* | ||
* @description | ||
* Sets an item in cookieStorage by given name. | ||
* | ||
* @deprecated use #put | ||
* | ||
* @param {string} name Item name | ||
* @param {string} value Item value | ||
*/ | ||
set:function(b,c){a.put(b,c)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateCookieStorage#put | ||
* @methodOf pascalprecht.translate.$translateCookieStorage | ||
* | ||
* @description | ||
* Sets an item in cookieStorage by given name. | ||
* | ||
* @param {string} name Item name | ||
* @param {string} value Item value | ||
*/ | ||
put:function(b,c){a.put(b,c)}};return b}return a.$inject=["$cookieStore"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",a),a.displayName="$translateCookieStorage","pascalprecht.translate"}); | ||
!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 a.$inject=["$cookieStore"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",a),a.displayName="$translateCookieStorage","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports=b():b()}(this,function(){function a(a,b){"use strict"; | ||
// Setup adapter | ||
var c=function(){var b;return{/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateLocalStorage#get | ||
* @methodOf pascalprecht.translate.$translateLocalStorage | ||
* | ||
* @description | ||
* Returns an item from localStorage by given name. | ||
* | ||
* @param {string} name Item name | ||
* @return {string} Value of item name | ||
*/ | ||
get:function(c){return b||(b=a.localStorage.getItem(c)),b},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateLocalStorage#set | ||
* @methodOf pascalprecht.translate.$translateLocalStorage | ||
* | ||
* @description | ||
* Sets an item in localStorage by given name. | ||
* | ||
* @deprecated use #put | ||
* | ||
* @param {string} name Item name | ||
* @param {string} value Item value | ||
*/ | ||
set:function(c,d){b=d,a.localStorage.setItem(c,d)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateLocalStorage#put | ||
* @methodOf pascalprecht.translate.$translateLocalStorage | ||
* | ||
* @description | ||
* Sets an item in localStorage by given name. | ||
* | ||
* @param {string} name Item name | ||
* @param {string} value Item value | ||
*/ | ||
put:function(c,d){b=d,a.localStorage.setItem(c,d)}}}(),d="localStorage"in a;if(d){var e="pascalprecht.translate.storageTest";try{ | ||
// this check have to be wrapped within a try/catch because on | ||
// a SecurityError: Dom Exception 18 on iOS | ||
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 a.$inject=["$window","$translateCookieStorage"],angular.module("pascalprecht.translate").factory("$translateLocalStorage",a),a.displayName="$translateLocalStorageFactory","pascalprecht.translate"}); | ||
!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 a.$inject=["$window","$translateCookieStorage"],angular.module("pascalprecht.translate").factory("$translateLocalStorage",a),a.displayName="$translateLocalStorageFactory","pascalprecht.translate"}); |
/*! | ||
* angular-translate - v2.11.0 - 2016-03-20 | ||
* angular-translate - v2.11.1 - 2016-07-17 | ||
* | ||
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT | ||
*/ | ||
!function(a,b){"function"==typeof define&&define.amd? | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define([],function(){return b()}):"object"==typeof exports? | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
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,// TODO change to either 'sanitize', 'escape' or ['sanitize', 'escapeParameters'] in 3.0. | ||
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={},i=function(a,c,d){return angular.forEach(d,function(d){if(angular.isFunction(d))a=d(a,c);else if(angular.isFunction(b[d]))a=b[d](a,c);else{if(!angular.isString(b[d]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'");if(!h[b[d]])try{h[b[d]]=f.get(b[d])}catch(e){throw h[b[d]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'")}a=h[b[d]](a,c)}}),a},j=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||j(),arguments.length<3&&(d=c),!d)return a;var e=angular.isArray(d)?d:[d];return i(a,b,e)}}}];var f=function(a){var b=angular.element("<div></div>");// not chainable, see #1044 | ||
return b.text(a),b.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,c){if(angular.isObject(a)){var d=angular.isArray(a)?[]:{};if(c){if(c.indexOf(a)>-1)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else c=[];// remove last | ||
return c.push(a),angular.forEach(a,function(a,e){d[e]=h(a,b,c)}),c.splice(-1,1),d}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=[],w=a,x=[],y="translate-cloak",z=!1,A=!1,B=".",C=!1,D=0,E=!0,F="default",G={"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},"iso639-1":function(a){var b=(a||"").split("_").join("-"),c=b.split("-");return c[0].toLowerCase()}},H="2.11.0",I=function(){ | ||
// internal purpose only | ||
if(angular.isFunction(d.getLocale))return d.getLocale();var a,c,e=b.$get().navigator,f=["language","browserLanguage","systemLanguage","userLanguage"]; | ||
// support for HTML 5.1 "navigator.languages" | ||
if(angular.isArray(e.languages))for(a=0;a<e.languages.length;a++)if(c=e.languages[a],c&&c.length)return c; | ||
// support for other well known properties in browsers | ||
for(a=0;a<f.length;a++)if(c=e[f[a]],c&&c.length)return c;return null};I.displayName="angular-translate/service: getFirstBrowserLanguage"; | ||
// tries to determine the browsers locale | ||
var J=function(){var a=I()||"";return G[F]&&(a=G[F](a)),a};J.displayName="angular-translate/service: getLocale";/** | ||
* @name indexOf | ||
* @private | ||
* | ||
* @description | ||
* indexOf polyfill. Kinda sorta. | ||
* | ||
* @param {array} array Array to search in. | ||
* @param {string} searchElement Element to search for. | ||
* | ||
* @returns {int} Index of search element. | ||
*/ | ||
var K=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},L=function(){return this.toString().replace(/^\s+|\s+$/g,"")},M=function(a){if(a){for(var b=[],c=angular.lowercase(a),d=0,e=v.length;e>d;d++)b.push(angular.lowercase(v[d])); | ||
// Check for an exact match in our list of available keys | ||
if(K(b,c)>-1)return a;if(f){var g;for(var h in f)if(f.hasOwnProperty(h)){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],K(b,angular.lowercase(g))>-1))return g}} | ||
// Check for a language code without region | ||
var k=a.split("_");return k.length>1&&K(b,angular.lowercase(k[0]))>-1?k[0]:void 0}},N=function(a,b){if(!a&&!b)return u;if(a&&!b){if(angular.isString(a))return u[a]}else angular.isObject(u[a])||(u[a]={}),angular.extend(u[a],O(b));return this};this.translations=N,/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#cloakClassName | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* | ||
* Let's you change the class name for `translate-cloak` directive. | ||
* Default class name is `translate-cloak`. | ||
* | ||
* @param {string} name translate-cloak class name | ||
*/ | ||
this.cloakClassName=function(a){return a?(y=a,this):y},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#nestedObjectDelimeter | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* | ||
* Let's you change the delimiter for namespaced translations. | ||
* Default delimiter is `.`. | ||
* | ||
* @param {string} delimiter namespace separator | ||
*/ | ||
this.nestedObjectDelimeter=function(a){return a?(B=a,this):B};/** | ||
* @name flatObject | ||
* @private | ||
* | ||
* @description | ||
* Flats an object. This function is used to flatten given translation data with | ||
* namespaces, so they are later accessible via dot notation. | ||
*/ | ||
var O=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)?O(h,b.concat(e),c,e):(f=b.length?""+b.join(B)+B+e:e,b.length&&e===d&&(g=""+b.join(B),c[g]="@:"+f),c[f]=h));return c};O.displayName="flatObject",/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#addInterpolation | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Adds interpolation services to angular-translate, so it can manage them. | ||
* | ||
* @param {object} factory Interpolation service factory | ||
*/ | ||
this.addInterpolation=function(a){return x.push(a),this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useMessageFormatInterpolation | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use interpolation functionality of messageformat.js. | ||
* This is useful when having high level pluralization and gender selection. | ||
*/ | ||
this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useInterpolation | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate which interpolation style to use as default, application-wide. | ||
* Simply pass a factory/service name. The interpolation service has to implement | ||
* the correct interface. | ||
* | ||
* @param {string} factory Interpolation service name. | ||
*/ | ||
this.useInterpolation=function(a){return n=a,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useSanitizeStrategy | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Simply sets a sanitation strategy type. | ||
* | ||
* @param {string} value Strategy type. | ||
*/ | ||
this.useSanitizeValueStrategy=function(a){return c.useStrategy(a),this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#preferredLanguage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells the module which of the registered translation tables to use for translation | ||
* at initial startup by passing a language key. Similar to `$translateProvider#use` | ||
* only that it says which language to **prefer**. | ||
* | ||
* @param {string} langKey A language key. | ||
*/ | ||
this.preferredLanguage=function(a){return a?(P(a),this):e};var P=function(a){return a&&(e=a),e};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#translationNotFoundIndicator | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Sets an indicator which is used when a translation isn't found. E.g. when | ||
* setting the indicator as 'X' and one tries to translate a translation id | ||
* called `NOT_FOUND`, this will result in `X NOT_FOUND X`. | ||
* | ||
* Internally this methods sets a left indicator and a right indicator using | ||
* `$translateProvider.translationNotFoundIndicatorLeft()` and | ||
* `$translateProvider.translationNotFoundIndicatorRight()`. | ||
* | ||
* **Note**: These methods automatically add a whitespace between the indicators | ||
* and the translation id. | ||
* | ||
* @param {string} indicator An indicator, could be any string. | ||
*/ | ||
this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},/** | ||
* ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#translationNotFoundIndicatorLeft | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Sets an indicator which is used when a translation isn't found left to the | ||
* translation id. | ||
* | ||
* @param {string} indicator An indicator. | ||
*/ | ||
this.translationNotFoundIndicatorLeft=function(a){return a?(q=a,this):q},/** | ||
* ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#translationNotFoundIndicatorLeft | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Sets an indicator which is used when a translation isn't found right to the | ||
* translation id. | ||
* | ||
* @param {string} indicator An indicator. | ||
*/ | ||
this.translationNotFoundIndicatorRight=function(a){return a?(r=a,this):r},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#fallbackLanguage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells the module which of the registered translation tables to use when missing translations | ||
* at initial startup by passing a language key. Similar to `$translateProvider#use` | ||
* only that it says which language to **fallback**. | ||
* | ||
* @param {string||array} langKey A language key. | ||
* | ||
*/ | ||
this.fallbackLanguage=function(a){return Q(a),this};var Q=function(a){return a?(angular.isString(a)?(h=!0,g=[a]):angular.isArray(a)&&(h=!1,g=a),angular.isString(e)&&K(g,e)<0&&g.push(e),this):h?g[0]:g};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#use | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Set which translation table to use for translation by given language key. When | ||
* trying to 'use' a language which isn't provided, it'll throw an error. | ||
* | ||
* You actually don't have to use this method since `$translateProvider#preferredLanguage` | ||
* does the job too. | ||
* | ||
* @param {string} langKey A language key. | ||
*/ | ||
this.use=function(a){if(a){if(!u[a]&&!o) | ||
// only throw an error, when not loading translation data asynchronously | ||
throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return i=a,this}return i},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#resolveClientLocale | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* This returns the current browser/client's language key. The result is processed with the configured uniform tag resolver. | ||
* | ||
* @returns {string} the current client/browser language key | ||
*/ | ||
this.resolveClientLocale=function(){return J()};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#storageKey | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells the module which key must represent the choosed language by a user in the storage. | ||
* | ||
* @param {string} key A key for the storage. | ||
*/ | ||
var R=function(a){return a?(w=a,this):l?l+w:w};this.storageKey=R,/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useUrlLoader | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use `$translateUrlLoader` extension service as loader. | ||
* | ||
* @param {string} url Url | ||
* @param {Object=} options Optional configuration object | ||
*/ | ||
this.useUrlLoader=function(a,b){return this.useLoader("$translateUrlLoader",angular.extend({url:a},b))},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useStaticFilesLoader | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use `$translateStaticFilesLoader` extension service as loader. | ||
* | ||
* @param {Object=} options Optional configuration object | ||
*/ | ||
this.useStaticFilesLoader=function(a){return this.useLoader("$translateStaticFilesLoader",a)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useLoader | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use any other service as loader. | ||
* | ||
* @param {string} loaderFactory Factory name to use | ||
* @param {Object=} options Optional configuration object | ||
*/ | ||
this.useLoader=function(a,b){return o=a,p=b||{},this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useLocalStorage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use `$translateLocalStorage` service as storage layer. | ||
* | ||
*/ | ||
this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useCookieStorage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use `$translateCookieStorage` service as storage layer. | ||
*/ | ||
this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useStorage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use custom service as storage layer. | ||
*/ | ||
this.useStorage=function(a){return k=a,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#storagePrefix | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Sets prefix for storage key. | ||
* | ||
* @param {string} prefix Storage key prefix | ||
*/ | ||
this.storagePrefix=function(a){return a?(l=a,this):a},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useMissingTranslationHandlerLog | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to use built-in log handler when trying to translate | ||
* a translation Id which doesn't exist. | ||
* | ||
* This is actually a shortcut method for `useMissingTranslationHandler()`. | ||
* | ||
*/ | ||
this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useMissingTranslationHandler | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Expects a factory name which later gets instantiated with `$injector`. | ||
* This method can be used to tell angular-translate to use a custom | ||
* missingTranslationHandler. Just build a factory which returns a function | ||
* and expects a translation id as argument. | ||
* | ||
* Example: | ||
* <pre> | ||
* app.config(function ($translateProvider) { | ||
* $translateProvider.useMissingTranslationHandler('customHandler'); | ||
* }); | ||
* | ||
* app.factory('customHandler', function (dep1, dep2) { | ||
* return function (translationId) { | ||
* // something with translationId and dep1 and dep2 | ||
* }; | ||
* }); | ||
* </pre> | ||
* | ||
* @param {string} factory Factory name | ||
*/ | ||
this.useMissingTranslationHandler=function(a){return m=a,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#usePostCompiling | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* If post compiling is enabled, all translated values will be processed | ||
* again with AngularJS' $compile. | ||
* | ||
* Example: | ||
* <pre> | ||
* app.config(function ($translateProvider) { | ||
* $translateProvider.usePostCompiling(true); | ||
* }); | ||
* </pre> | ||
* | ||
* @param {string} factory Factory name | ||
*/ | ||
this.usePostCompiling=function(a){return z=!!a,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#forceAsyncReload | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* If force async reload is enabled, async loader will always be called | ||
* even if $translationTable already contains the language key, adding | ||
* possible new entries to the $translationTable. | ||
* | ||
* Example: | ||
* <pre> | ||
* app.config(function ($translateProvider) { | ||
* $translateProvider.forceAsyncReload(true); | ||
* }); | ||
* </pre> | ||
* | ||
* @param {boolean} value - valid values are true or false | ||
*/ | ||
this.forceAsyncReload=function(a){return A=!!a,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#uniformLanguageTag | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate which language tag should be used as a result when determining | ||
* the current browser language. | ||
* | ||
* This setting must be set before invoking {@link pascalprecht.translate.$translateProvider#methods_determinePreferredLanguage determinePreferredLanguage()}. | ||
* | ||
* <pre> | ||
* $translateProvider | ||
* .uniformLanguageTag('bcp47') | ||
* .determinePreferredLanguage() | ||
* </pre> | ||
* | ||
* The resolver currently supports: | ||
* * default | ||
* (traditionally: hyphens will be converted into underscores, i.e. en-US => en_US) | ||
* en-US => en_US | ||
* en_US => en_US | ||
* en-us => en_us | ||
* * java | ||
* like default, but the second part will be always in uppercase | ||
* en-US => en_US | ||
* en_US => en_US | ||
* en-us => en_US | ||
* * BCP 47 (RFC 4646 & 4647) | ||
* en-US => en-US | ||
* en_US => en-US | ||
* en-us => en-US | ||
* | ||
* See also: | ||
* * http://en.wikipedia.org/wiki/IETF_language_tag | ||
* * http://www.w3.org/International/core/langtags/ | ||
* * http://tools.ietf.org/html/bcp47 | ||
* | ||
* @param {string|object} options - options (or standard) | ||
* @param {string} options.standard - valid values are 'default', 'bcp47', 'java' | ||
*/ | ||
this.uniformLanguageTag=function(a){return a?angular.isString(a)&&(a={standard:a}):a={},F=a.standard,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#determinePreferredLanguage | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Tells angular-translate to try to determine on its own which language key | ||
* to set as preferred language. When `fn` is given, angular-translate uses it | ||
* to determine a language key, otherwise it uses the built-in `getLocale()` | ||
* method. | ||
* | ||
* The `getLocale()` returns a language key in the format `[lang]_[country]` or | ||
* `[lang]` depending on what the browser provides. | ||
* | ||
* Use this method at your own risk, since not all browsers return a valid | ||
* locale (see {@link pascalprecht.translate.$translateProvider#methods_uniformLanguageTag uniformLanguageTag()}). | ||
* | ||
* @param {Function=} fn Function to determine a browser's locale | ||
*/ | ||
this.determinePreferredLanguage=function(a){var b=a&&angular.isFunction(a)?a():J();return e=v.length?M(b)||b:b,this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#registerAvailableLanguageKeys | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Registers a set of language keys the app will work with. Use this method in | ||
* combination with | ||
* {@link pascalprecht.translate.$translateProvider#determinePreferredLanguage determinePreferredLanguage}. | ||
* When available languages keys are registered, angular-translate | ||
* tries to find the best fitting language key depending on the browsers locale, | ||
* considering your language key convention. | ||
* | ||
* @param {object} languageKeys Array of language keys the your app will use | ||
* @param {object=} aliases Alias map. | ||
*/ | ||
this.registerAvailableLanguageKeys=function(a,b){return a?(v=a,b&&(f=b),this):v},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#useLoaderCache | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Registers a cache for internal $http based loaders. | ||
* {@link pascalprecht.translate.$translationCache $translationCache}. | ||
* When false the cache will be disabled (default). When true or undefined | ||
* the cache will be a default (see $cacheFactory). When an object it will | ||
* be treat as a cache object itself: the usage is $http({cache: cache}) | ||
* | ||
* @param {object} cache boolean, string or cache-object | ||
*/ | ||
this.useLoaderCache=function(a){ | ||
// disable cache | ||
// enable cache using AJS defaults | ||
// enable cache using default | ||
// enable cache using given one (see $cacheFactory) | ||
return a===!1?s=void 0:a===!0?s=!0:"undefined"==typeof a?s="$translationCache":a&&(s=a),this},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#directivePriority | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Sets the default priority of the translate directive. The standard value is `0`. | ||
* Calling this function without an argument will return the current value. | ||
* | ||
* @param {number} priority for the translate-directive | ||
*/ | ||
this.directivePriority=function(a){ | ||
// setter with chaining | ||
return void 0===a?D:(D=a,this)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#statefulFilter | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* Since AngularJS 1.3, filters which are not stateless (depending at the scope) | ||
* have to explicit define this behavior. | ||
* Sets whether the translate filter should be stateful or stateless. The standard value is `true` | ||
* meaning being stateful. | ||
* Calling this function without an argument will return the current value. | ||
* | ||
* @param {boolean} state - defines the state of the filter | ||
*/ | ||
this.statefulFilter=function(a){ | ||
// setter with chaining | ||
return void 0===a?E:(E=a,this)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateProvider#postProcess | ||
* @methodOf pascalprecht.translate.$translateProvider | ||
* | ||
* @description | ||
* The post processor will be intercept right after the translation result. It can modify the result. | ||
* | ||
* @param {object} fn Function or service name (string) to be called after the translation value has been set / resolved. The function itself will enrich every value being processed and then continue the normal resolver process | ||
*/ | ||
this.postProcess=function(a){return t=a?a:void 0,this},/** | ||
* @ngdoc object | ||
* @name pascalprecht.translate.$translate | ||
* @requires $interpolate | ||
* @requires $log | ||
* @requires $rootScope | ||
* @requires $q | ||
* | ||
* @description | ||
* The `$translate` service is the actual core of angular-translate. It expects a translation id | ||
* and optional interpolate parameters to translate contents. | ||
* | ||
* <pre> | ||
* $translate('HEADLINE_TEXT').then(function (translation) { | ||
* $scope.translatedText = translation; | ||
* }); | ||
* </pre> | ||
* | ||
* @param {string|array} translationId A token which represents a translation id | ||
* This can be optionally an array of translation ids which | ||
* results that the function returns an object where each key | ||
* is the translation id and the value the translation. | ||
* @param {object=} interpolateParams An object hash for dynamic values | ||
* @param {string} interpolationId The id of the interpolation to use | ||
* @param {string} forceLanguage A language to be used instead of the current language | ||
* @returns {object} promise | ||
*/ | ||
this.$get=["$log","$injector","$rootScope","$q",function(a,b,c,d){var f,l,F,G=b.get(n||"$translateDefaultInterpolation"),I=!1,S={},T={},U=function(a,b,c,h,j){!i&&e&&(i=e);var m=j&&j!==i?// we don't want to re-negotiate $uses | ||
M(j)||j:i; | ||
// Duck detection: If the first argument is an array, a bunch of translations was requested. | ||
// The result is an object. | ||
if( | ||
// Check forceLanguage is present | ||
j&&ja(j),angular.isArray(a)){ | ||
// Inspired by Q.allSettled by Kris Kowal | ||
// https://github.com/kriskowal/q/blob/b0fa72980717dc202ffc3cbf03b936e10ebbb9d7/q.js#L1553-1563 | ||
// This transforms all promises regardless resolved or rejected | ||
var n=function(a){for(var e={},f=[],g=function(a){var f=d.defer(),g=function(b){e[a]=b,f.resolve([a,b])}; | ||
// we don't care whether the promise was resolved or rejected; just store the values | ||
return U(a,b,c,h,j).then(g,g),f.promise},i=0,k=a.length;k>i;i++)f.push(g(a[i])); | ||
// wait for all (including storing to results) | ||
return d.all(f).then(function(){ | ||
// return the results | ||
return e})};return n(a)}var o=d.defer(); | ||
// trim off any whitespace | ||
a&&(a=L.apply(a));var p=function(){var a=e?T[e]:T[m];if(l=0,k&&!a){ | ||
// looks like there's no pending promise for $preferredLanguage or | ||
// $uses. Maybe there's one pending for a language that comes from | ||
// storage. | ||
var b=f.get(w);if(a=T[b],g&&g.length){var c=K(g,b); | ||
// maybe the language from storage is also defined as fallback language | ||
// we increase the fallback language index to not search in that language | ||
// as fallback, since it's probably the first used language | ||
// in that case the index starts after the first element | ||
l=0===c?1:0, | ||
// but we can make sure to ALWAYS fallback to preferred language at least | ||
K(g,e)<0&&g.push(e)}}return a}();if(p){var q=function(){ | ||
// $uses may have changed while waiting | ||
j||(m=i),fa(a,b,c,h,m).then(o.resolve,o.reject)};q.displayName="promiseResolved",p["finally"](q)}else | ||
// no promise to wait for? okay. Then there's no loader registered | ||
// nor is a one pending for language that comes from storage. | ||
// We can just translate. | ||
fa(a,b,c,h,m).then(o.resolve,o.reject);return o.promise},V=function(a){ | ||
// applying notFoundIndicators | ||
return q&&(a=[q,a].join(" ")),r&&(a=[a,r].join(" ")),a},W=function(a){i=a,k&&f.put(U.storageKey(),i),c.$emit("$translateChangeSuccess",{language:a}),G.setLocale(i);var b=function(a,b){S[b].setLocale(i)};b.displayName="eachInterpolatorLocaleSetter", | ||
// inform all others too! | ||
angular.forEach(S,b),c.$emit("$translateChangeEnd",{language:a})},X=function(a){if(!a)throw"No language key specified for loading.";var e=d.defer();c.$emit("$translateLoadingStart",{language:a}),I=!0;var f=s;"string"==typeof f&&( | ||
// getting on-demand instance of loader | ||
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,O(a))}):angular.extend(d,O(b)),I=!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 we have additional interpolations that were added via | ||
// $translateProvider.addInterpolation(), we have to map'em | ||
if(x.length){var Y=function(a){var c=b.get(a); | ||
// setting initial locale for each interpolation service | ||
c.setLocale(e||i), | ||
// make'em recognizable through id | ||
S[c.getInterpolationIdentifier()]=c};Y.displayName="interpolationFactoryAdder",angular.forEach(x,Y)}/** | ||
* @name getTranslationTable | ||
* @private | ||
* | ||
* @description | ||
* Returns a promise that resolves to the translation table | ||
* or is rejected if an error occurred. | ||
* | ||
* @param langKey | ||
* @returns {Q.promise} | ||
*/ | ||
var Z=function(a){var b=d.defer();if(Object.prototype.hasOwnProperty.call(u,a))b.resolve(u[a]);else if(T[a]){var c=function(a){N(a.key,a.table),b.resolve(a.table)};c.displayName="translationTableResolver",T[a].then(c,b.reject)}else b.reject();return b.promise},$=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];if("@:"===g.substr(0,2))$(a,g.substr(2),c,e).then(f.resolve,f.reject);else{var h=e.interpolate(d[b],c);h=ia(b,d[b],h,c,a),f.resolve(h)}e.setLocale(i)}else f.reject()};return g.displayName="fallbackTranslationResolver",Z(a).then(g,f.reject),f.promise},_=function(a,b,c,d){var e,f=u[a];if(f&&Object.prototype.hasOwnProperty.call(f,b)){if(d.setLocale(a),e=d.interpolate(f[b],c),"@:"===e.substr(0,2))return _(a,e.substr(2),c,d);d.setLocale(i)}return e},aa=function(a,c,d){ | ||
// If we have a handler factory - we might also call it here to determine if it provides | ||
// a default text for a translationid that can't be found anywhere in our tables | ||
if(m){var e=b.get(m)(a,i,c,d);return void 0!==e?e:a}return a},ba=function(a,b,c,e,f){var h=d.defer();if(a<g.length){var i=g[a];$(i,b,c,e).then(function(a){h.resolve(a)},function(){ | ||
// Look in the next fallback language for a translation. | ||
// It delays the resolving by passing another promise to resolve. | ||
return ba(a+1,b,c,e,f).then(h.resolve,h.reject)})}else | ||
// No translation found in any fallback language | ||
// if a default translation text is set in the directive, then return this as a result | ||
f?h.resolve(f): | ||
// if no default translation is set and an error handler is defined, send it to the handler | ||
// and then return the result | ||
m?h.resolve(aa(b,c)):h.reject(aa(b,c));return h.promise},ca=function(a,b,c,d){var e;if(a<g.length){var f=g[a];e=_(f,b,c,d),e||(e=ca(a+1,b,c,d))}return e},da=function(a,b,c,d){ | ||
// Start with the fallbackLanguage with index 0 | ||
return ba(F>0?F:l,a,b,c,d)},ea=function(a,b,c){ | ||
// Start with the fallbackLanguage with index 0 | ||
return ca(F>0?F:l,a,b,c)},fa=function(a,b,c,e,f){var h=d.defer(),i=f?u[f]:u,j=c?S[c]:G; | ||
// if the translation id exists, we can just interpolate it | ||
if(i&&Object.prototype.hasOwnProperty.call(i,a)){var k=i[a]; | ||
// If using link, rerun $translate with linked translationId and return it | ||
if("@:"===k.substr(0,2))U(k.substr(2),b,c,e,f).then(h.resolve,h.reject);else{ | ||
// | ||
var l=j.interpolate(k,b);l=ia(a,k,l,b,f),h.resolve(l)}}else{var n; | ||
// for logging purposes only (as in $translateMissingTranslationHandlerLog), value is not returned to promise | ||
m&&!I&&(n=aa(a,b,e)), | ||
// since we couldn't translate the inital requested translation id, | ||
// we try it now with one or more fallback languages, if fallback language(s) is | ||
// configured. | ||
f&&g&&g.length?da(a,b,j,e).then(function(a){h.resolve(a)},function(a){h.reject(V(a))}):m&&!I&&n? | ||
// looks like the requested translation id doesn't exists. | ||
// Now, if there is a registered handler for missing translations and no | ||
// asyncLoader is pending, we execute the handler | ||
e?h.resolve(e):h.resolve(n):e?h.resolve(e):h.reject(V(a))}return h.promise},ga=function(a,b,c,d){var e,f=d?u[d]:u,h=G; | ||
// if the translation id exists, we can just interpolate it | ||
if( | ||
// if the interpolation id exists use custom interpolator | ||
S&&Object.prototype.hasOwnProperty.call(S,c)&&(h=S[c]),f&&Object.prototype.hasOwnProperty.call(f,a)){var i=f[a]; | ||
// If using link, rerun $translate with linked translationId and return it | ||
e="@:"===i.substr(0,2)?ga(i.substr(2),b,c,d):h.interpolate(i,b)}else{var j; | ||
// for logging purposes only (as in $translateMissingTranslationHandlerLog), value is not returned to promise | ||
m&&!I&&(j=aa(a,b)), | ||
// since we couldn't translate the inital requested translation id, | ||
// we try it now with one or more fallback languages, if fallback language(s) is | ||
// configured. | ||
d&&g&&g.length?(l=0,e=ea(a,b,h)):e=m&&!I&&j?j:V(a)}return e},ha=function(a){j===a&&(j=void 0),T[a]=void 0},ia=function(a,c,d,e,f){var g=t; | ||
// getting on-demand instance | ||
return g&&("string"==typeof g&&(g=b.get(g)),g)?g(a,c,d,e,f):d},ja=function(a){u[a]||!o||T[a]||(T[a]=X(a).then(function(a){N(a.key,a.table)}))};/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#preferredLanguage | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the language key for the preferred language. | ||
* | ||
* @param {string} langKey language String or Array to be used as preferredLanguage (changing at runtime) | ||
* | ||
* @return {string} preferred language key | ||
*/ | ||
U.preferredLanguage=function(a){return a&&P(a),e},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#cloakClassName | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the configured class name for `translate-cloak` directive. | ||
* | ||
* @return {string} cloakClassName | ||
*/ | ||
U.cloakClassName=function(){return y},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#nestedObjectDelimeter | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the configured delimiter for nested namespaces. | ||
* | ||
* @return {string} nestedObjectDelimeter | ||
*/ | ||
U.nestedObjectDelimeter=function(){return B},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#fallbackLanguage | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the language key for the fallback languages or sets a new fallback stack. | ||
* | ||
* @param {string=} langKey language String or Array of fallback languages to be used (to change stack at runtime) | ||
* | ||
* @return {string||array} fallback language key | ||
*/ | ||
U.fallbackLanguage=function(a){if(void 0!==a&&null!==a){ | ||
// as we might have an async loader initiated and a new translation language might have been defined | ||
// we need to add the promise to the stack also. So - iterate. | ||
if(Q(a),o&&g&&g.length)for(var b=0,c=g.length;c>b;b++)T[g[b]]||(T[g[b]]=X(g[b]));U.use(U.use())}return h?g[0]:g},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#useFallbackLanguage | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Sets the first key of the fallback language stack to be used for translation. | ||
* Therefore all languages in the fallback array BEFORE this key will be skipped! | ||
* | ||
* @param {string=} langKey Contains the langKey the iteration shall start with. Set to false if you want to | ||
* get back to the whole stack | ||
*/ | ||
U.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=K(g,a);b>-1&&(F=b)}else F=0},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#proposedLanguage | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the language key of language that is currently loaded asynchronously. | ||
* | ||
* @return {string} language key | ||
*/ | ||
U.proposedLanguage=function(){return j},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#storage | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns registered storage. | ||
* | ||
* @return {object} Storage | ||
*/ | ||
U.storage=function(){return f},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#negotiateLocale | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns a language key based on available languages and language aliases. If a | ||
* language key cannot be resolved, returns undefined. | ||
* | ||
* If no or a falsy key is given, returns undefined. | ||
* | ||
* @param {string} [key] Language key | ||
* @return {string|undefined} Language key or undefined if no language key is found. | ||
*/ | ||
U.negotiateLocale=M,/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#use | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Tells angular-translate which language to use by given language key. This method is | ||
* used to change language at runtime. It also takes care of storing the language | ||
* key in a configured store to let your app remember the choosed language. | ||
* | ||
* When trying to 'use' a language which isn't available it tries to load it | ||
* asynchronously with registered loaders. | ||
* | ||
* Returns promise object with loaded language file data or string of the currently used language. | ||
* | ||
* If no or a falsy key is given it returns the currently used language key. | ||
* The returned string will be ```undefined``` if setting up $translate hasn't finished. | ||
* @example | ||
* $translate.use("en_US").then(function(data){ | ||
* $scope.text = $translate("HELLO"); | ||
* }); | ||
* | ||
* @param {string} [key] Language key | ||
* @return {object|string} Promise with loaded language data or the language key if a falsy param was given. | ||
*/ | ||
U.use=function(a){if(!a)return i;var b=d.defer();c.$emit("$translateChangeStart",{language:a}); | ||
// Try to get the aliased language key | ||
var e=M(a); | ||
// Ensure only registered language keys will be loaded | ||
// Ensure only registered language keys will be loaded | ||
// if there isn't a translation table for the language we've requested, | ||
// we load it asynchronously | ||
// we are already loading this asynchronously | ||
// resolve our new deferred when the old langPromise is resolved | ||
return v.length>0&&!e?d.reject(a):(e&&(a=e),j=a,!A&&u[a]||!o||T[a]?T[a]?T[a].then(function(a){return j===a.key&&W(a.key),b.resolve(a.key),a},function(a){return!i&&g&&g.length>0?U.use(g[0]).then(b.resolve,b.reject):b.reject(a)}):(b.resolve(a),W(a)):(T[a]=X(a).then(function(c){return N(c.key,c.table),b.resolve(c.key),j===a&&W(c.key),c},function(a){return c.$emit("$translateChangeError",{language:a}),b.reject(a),c.$emit("$translateChangeEnd",{language:a}),d.reject(a)}),T[a]["finally"](function(){ha(a)})),b.promise)},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#resolveClientLocale | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* This returns the current browser/client's language key. The result is processed with the configured uniform tag resolver. | ||
* | ||
* @returns {string} the current client/browser language key | ||
*/ | ||
U.resolveClientLocale=function(){return J()},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#storageKey | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the key for the storage. | ||
* | ||
* @return {string} storage key | ||
*/ | ||
U.storageKey=function(){return R()},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#isPostCompilingEnabled | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns whether post compiling is enabled or not | ||
* | ||
* @return {bool} storage key | ||
*/ | ||
U.isPostCompilingEnabled=function(){return z},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#isForceAsyncReloadEnabled | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns whether force async reload is enabled or not | ||
* | ||
* @return {boolean} forceAsyncReload value | ||
*/ | ||
U.isForceAsyncReloadEnabled=function(){return A},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#refresh | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Refreshes a translation table pointed by the given langKey. If langKey is not specified, | ||
* the module will drop all existent translation tables and load new version of those which | ||
* are currently in use. | ||
* | ||
* Refresh means that the module will drop target translation table and try to load it again. | ||
* | ||
* In case there are no loaders registered the refresh() method will throw an Error. | ||
* | ||
* If the module is able to refresh translation tables refresh() method will broadcast | ||
* $translateRefreshStart and $translateRefreshEnd events. | ||
* | ||
* @example | ||
* // this will drop all currently existent translation tables and reload those which are | ||
* // currently in use | ||
* $translate.refresh(); | ||
* // this will refresh a translation table for the en_US language | ||
* $translate.refresh('en_US'); | ||
* | ||
* @param {string} langKey A language key of the table, which has to be refreshed | ||
* | ||
* @return {promise} Promise, which will be resolved in case a translation tables refreshing | ||
* process is finished successfully, and reject if not. | ||
*/ | ||
U.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(u[a]){var h=function(c){N(c.key,c.table),a===i&&W(i),b()};h.displayName="refreshPostProcessor",X(a).then(h,e)}else e();else{ | ||
// if there's no language key specified we refresh ALL THE THINGS! | ||
var j=[],k={}; | ||
// reload registered fallback languages | ||
if(g&&g.length)for(var l=0,m=g.length;m>l;l++)j.push(X(g[l])),k[g[l]]=!0; | ||
// reload currently used language | ||
i&&!k[i]&&j.push(X(i));var n=function(a){u={},angular.forEach(a,function(a){N(a.key,a.table)}),i&&W(i),b()};n.displayName="refreshPostProcessor",d.all(j).then(n,e)}return f.promise},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#instant | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns a translation instantly from the internal state of loaded translation. All rules | ||
* regarding the current language, the preferred language of even fallback languages will be | ||
* used except any promise handling. If a language was not found, an asynchronous loading | ||
* will be invoked in the background. | ||
* | ||
* @param {string|array} translationId A token which represents a translation id | ||
* This can be optionally an array of translation ids which | ||
* results that the function's promise returns an object where | ||
* each key is the translation id and the value the translation. | ||
* @param {object} interpolateParams Params | ||
* @param {string} interpolationId The id of the interpolation to use | ||
* @param {string} forceLanguage A language to be used instead of the current language | ||
* | ||
* @return {string|object} translation | ||
*/ | ||
U.instant=function(a,b,c,d){ | ||
// we don't want to re-negotiate $uses | ||
var f=d&&d!==i?// we don't want to re-negotiate $uses | ||
M(d)||d:i; | ||
// Detect undefined and null values to shorten the execution and prevent exceptions | ||
if(null===a||angular.isUndefined(a))return a; | ||
// Duck detection: If the first argument is an array, a bunch of translations was requested. | ||
// The result is an object. | ||
if( | ||
// Check forceLanguage is present | ||
d&&ja(d),angular.isArray(a)){for(var h={},j=0,k=a.length;k>j;j++)h[a[j]]=U.instant(a[j],b,c,d);return h} | ||
// We discarded unacceptable values. So we just need to verify if translationId is empty String | ||
if(angular.isString(a)&&a.length<1)return a; | ||
// trim off any whitespace | ||
a&&(a=L.apply(a));var l,n=[];e&&n.push(e),f&&n.push(f),g&&g.length&&(n=n.concat(g));for(var o=0,p=n.length;p>o;o++){var s=n[o];if(u[s]&&"undefined"!=typeof u[s][a]&&(l=ga(a,b,c,f)),"undefined"!=typeof l)break} | ||
// Return translation of default interpolator if not found anything. | ||
return l||""===l||(q||r?l=V(a):(l=G.interpolate(a,b),m&&!I&&(l=aa(a,b)))),l},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#versionInfo | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the current version information for the angular-translate library | ||
* | ||
* @return {string} angular-translate version | ||
*/ | ||
U.versionInfo=function(){return H},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#loaderCache | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns the defined loaderCache. | ||
* | ||
* @return {boolean|string|object} current value of loaderCache | ||
*/ | ||
U.loaderCache=function(){return s}, | ||
// internal purpose only | ||
U.directivePriority=function(){return D}, | ||
// internal purpose only | ||
U.statefulFilter=function(){return E},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#isReady | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns whether the service is "ready" to translate (i.e. loading 1st language). | ||
* | ||
* See also {@link pascalprecht.translate.$translate#methods_onReady onReady()}. | ||
* | ||
* @return {boolean} current value of ready | ||
*/ | ||
U.isReady=function(){return C};var ka=d.defer();ka.promise.then(function(){C=!0}),/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#onReady | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* Returns whether the service is "ready" to translate (i.e. loading 1st language). | ||
* | ||
* See also {@link pascalprecht.translate.$translate#methods_isReady isReady()}. | ||
* | ||
* @param {Function=} fn Function to invoke when service is ready | ||
* @return {object} Promise resolved when service is ready | ||
*/ | ||
U.onReady=function(a){var b=d.defer();return angular.isFunction(a)&&b.promise.then(a),C?b.resolve():ka.promise.then(b.resolve),b.promise},/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translate#getAvailableLanguageKeys | ||
* @methodOf pascalprecht.translate.$translate | ||
* | ||
* @description | ||
* This function simply returns the registered language keys being defined before in the config phase | ||
* With this, an application can use the array to provide a language selection dropdown or similar | ||
* without any additional effort | ||
* | ||
* @returns {object} returns the list of possibly registered language keys and mapping or null if not defined | ||
*/ | ||
U.getAvailableLanguageKeys=function(){return v.length>0?v:null}; | ||
// Whenever $translateReady is being fired, this will ensure the state of $isReady | ||
var la=c.$on("$translateReady",function(){ka.resolve(),la(),// one time only | ||
la=null}),ma=c.$on("$translateChangeEnd",function(){ka.resolve(),ma(),// one time only | ||
ma=null});if(o){ | ||
// Also, if there are any fallback language registered, we start | ||
// loading them asynchronously as soon as we can. | ||
if( | ||
// If at least one async loader is defined and there are no | ||
// (default) translations available we should try to load them. | ||
angular.equals(u,{})&&U.use()&&U.use(U.use()),g&&g.length)for(var na=function(a){return N(a.key,a.table),c.$emit("$translateChangeEnd",{language:a.key}),a},oa=0,pa=g.length;pa>oa;oa++){var qa=g[oa];!A&&u[qa]||(T[qa]=X(qa).then(na))}}else c.$emit("$translateReady",{language:U.use()});return U}]}function d(a,b){"use strict";var c,d={},e="default";/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateDefaultInterpolation#setLocale | ||
* @methodOf pascalprecht.translate.$translateDefaultInterpolation | ||
* | ||
* @description | ||
* Sets current locale (this is currently not use in this interpolation). | ||
* | ||
* @param {string} locale Language key or locale. | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateDefaultInterpolation#getInterpolationIdentifier | ||
* @methodOf pascalprecht.translate.$translateDefaultInterpolation | ||
* | ||
* @description | ||
* Returns an identifier for this interpolation service. | ||
* | ||
* @returns {string} $identifier | ||
*/ | ||
/** | ||
* @deprecated will be removed in 3.0 | ||
* @see {@link pascalprecht.translate.$translateSanitization} | ||
*/ | ||
/** | ||
* @ngdoc function | ||
* @name pascalprecht.translate.$translateDefaultInterpolation#interpolate | ||
* @methodOf pascalprecht.translate.$translateDefaultInterpolation | ||
* | ||
* @description | ||
* Interpolates given string agains given interpolate params using angulars | ||
* `$interpolate` service. | ||
* | ||
* @returns {string} interpolated string. | ||
*/ | ||
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,g){"use strict";/** | ||
* @name trim | ||
* @private | ||
* | ||
* @description | ||
* trim polyfill | ||
* | ||
* @returns {string} The string stripped of whitespace from both ends | ||
*/ | ||
var h=function(){return this.toString().replace(/^\s+|\s+$/g,"")};return{restrict:"AE",scope:!0,priority:a.directivePriority(),compile:function(b,i){var j=i.translateValues?i.translateValues:void 0,k=i.translateInterpolation?i.translateInterpolation:void 0,l=b[0].outerHTML.match(/translate-value-+/i),m="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)",n="^(.*)"+c.startSymbol()+"(.*)"+c.endSymbol()+"(.*)";return function(b,o,p){b.interpolateParams={},b.preText="",b.postText="",b.translateNamespace=f(b);var q={},r=function(a,c,d){ | ||
// initially fetch all attributes if existing and fill the params | ||
if( | ||
// initial setup | ||
c.translateValues&&angular.extend(a,e(c.translateValues)(b.$parent)),l)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]}},s=function(a){if( | ||
// Remove any old watcher | ||
angular.isFunction(s._unwatchOld)&&(s._unwatchOld(),s._unwatchOld=void 0),angular.equals(a,"")||!angular.isDefined(a)){var d=h.apply(o.text()),e=d.match(m); | ||
// Interpolate translation id if required | ||
if(angular.isArray(e)){b.preText=e[1],b.postText=e[3],q.translate=c(e[2])(b.$parent);var f=d.match(n);angular.isArray(f)&&f[2]&&f[2].length&&(s._unwatchOld=b.$watch(f[2],function(a){q.translate=a,y()}))}else | ||
// do not assigne the translation id if it is empty. | ||
q.translate=d?d:void 0}else q.translate=a;y()},t=function(a){p.$observe(a,function(b){q[a]=b,y()})}; | ||
// initial setup with values | ||
r(b.interpolateParams,p,i);var u=!0;p.$observe("translate",function(a){"undefined"==typeof a? | ||
// case of element "<translate>xyz</translate>" | ||
s(""): | ||
// case of regular attribute | ||
""===a&&u||(q.translate=a,y()),u=!1});for(var v in p)p.hasOwnProperty(v)&&"translateAttr"===v.substr(0,13)&&t(v);if(p.$observe("translateDefault",function(a){b.defaultText=a,y()}),j&&p.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),l){var w=function(a){p.$observe(a,function(c){var d=angular.lowercase(a.substr(14,1))+a.substr(15);b.interpolateParams[d]=c})};for(var x in p)Object.prototype.hasOwnProperty.call(p,x)&&"translateValue"===x.substr(0,14)&&"translateValues"!==x&&w(x)} | ||
// Master update function | ||
var y=function(){for(var a in q)q.hasOwnProperty(a)&&void 0!==q[a]&&z(a,q[a],b,b.interpolateParams,b.defaultText,b.translateNamespace)},z=function(b,c,d,e,f,g){c?( | ||
// if translation id starts with '.' and translateNamespace given, prepend namespace | ||
g&&"."===c.charAt(0)&&(c=g+c),a(c,e,k,f,d.translateLanguage).then(function(a){A(a,d,!0,b)},function(a){A(a,d,!1,b)})): | ||
// as an empty string cannot be translated, we can solve this using successful=false | ||
A(c,d,!1,b)},A=function(b,c,e,f){if(e||"undefined"!=typeof c.defaultText&&(b=c.defaultText),"translate"===f){ | ||
// default translate into innerHTML | ||
(e||!e&&"undefined"==typeof p.translateKeepContent)&&o.empty().append(c.preText+b+c.postText);var g=a.isPostCompilingEnabled(),h="undefined"!=typeof i.translateCompile,j=h&&"false"!==i.translateCompile;(g&&!h||j)&&d(o.contents())(c)}else{ | ||
// translate attribute | ||
var k=p.$attr[f];"data-"===k.substr(0,5)&&( | ||
// ensure html5 data prefix is stripped | ||
k=k.substr(5)),k=k.substr(15),o.attr(k,b)}};(j||l||p.translateDefault)&&b.$watch("interpolateParams",y,!0); | ||
// Replaced watcher on translateLanguage with event listener | ||
var B=b.$on("translateLanguageChanged",y),C=g.$on("$translateChangeSuccess",y); | ||
// ensure translation will be looked up at least one | ||
o.text().length?s(p.translate?p.translate:""):p.translate&& | ||
// ensure attribute will be not skipped | ||
s(p.translate),y(),b.$on("$destroy",function(){B(),C()})}}}}/** | ||
* Returns the scope's namespace. | ||
* @private | ||
* @param scope | ||
* @returns {string} | ||
*/ | ||
function f(a){"use strict";return a.translateNamespace?a.translateNamespace:a.$parent?f(a.$parent):void 0}function g(a,b){"use strict";return{compile:function(c){var d=function(){c.addClass(a.cloakClassName())},e=function(){c.removeClass(a.cloakClassName())};return a.onReady(function(){e()}),d(),function(c,f,g){g.translateCloak&&g.translateCloak.length&&( | ||
// Register a watcher for the defined translation allowing a fine tuned cloak | ||
g.$observe("translateCloak",function(b){a(b).then(e,d)}), | ||
// Register for change events as this is being another indicicator revalidating the cloak) | ||
b.$on("$translateChangeSuccess",function(){a(g.translateCloak).then(e,d)}))}}}}function h(){"use strict";return{restrict:"A",scope:!0,compile:function(){return{pre:function(a,b,c){a.translateNamespace=f(a),a.translateNamespace&&"."===c.translateNamespace.charAt(0)?a.translateNamespace+=c.translateNamespace:a.translateNamespace=c.translateNamespace}}}}}/** | ||
* Returns the scope's namespace. | ||
* @private | ||
* @param scope | ||
* @returns {string} | ||
*/ | ||
function f(a){"use strict";return a.translateNamespace?a.translateNamespace:a.$parent?f(a.$parent):void 0}function i(){"use strict";return{restrict:"A",scope:!0,compile:function(){return function(a,b,c){c.$observe("translateLanguage",function(b){a.translateLanguage=b}),a.$watch("translateLanguage",function(){a.$broadcast("translateLanguageChanged")})}}}}function j(a,b){"use strict";var c=function(c,d,e,f){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e,f)};return b.statefulFilter()&&(c.$stateful=!0),c}function k(a){"use strict";return a("translations")}/** | ||
* @ngdoc overview | ||
* @name pascalprecht.translate | ||
* | ||
* @description | ||
* The main module which holds everything together. | ||
*/ | ||
/** | ||
* @ngdoc object | ||
* @name pascalprecht.translate.$translateSanitizationProvider | ||
* | ||
* @description | ||
* | ||
* Configurations for $translateSanitization | ||
*/ | ||
/** | ||
* @ngdoc object | ||
* @name pascalprecht.translate.$translateProvider | ||
* @description | ||
* | ||
* $translateProvider allows developers to register translation-tables, asynchronous loaders | ||
* and similar to configure translation behavior directly inside of a module. | ||
* | ||
*/ | ||
/** | ||
* @ngdoc object | ||
* @name pascalprecht.translate.$translateDefaultInterpolation | ||
* @requires $interpolate | ||
* | ||
* @description | ||
* Uses angular's `$interpolate` services to interpolate strings against some values. | ||
* | ||
* Be aware to configure a proper sanitization strategy. | ||
* | ||
* See also: | ||
* * {@link pascalprecht.translate.$translateSanitization} | ||
* | ||
* @return {object} $translateDefaultInterpolation Interpolator service | ||
*/ | ||
return a.$inject=["$translate"],c.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],d.$inject=["$interpolate","$translateSanitization"],e.$inject=["$translate","$q","$interpolate","$compile","$parse","$rootScope"],g.$inject=["$translate","$rootScope"],j.$inject=["$parse","$translate"],k.$inject=["$cacheFactory"],angular.module("pascalprecht.translate",["ng"]).run(a),a.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",b),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",c),c.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",d),d.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",e),e.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateCloak",g),g.displayName="translateCloakDirective",angular.module("pascalprecht.translate").directive("translateNamespace",h),h.displayName="translateNamespaceDirective",angular.module("pascalprecht.translate").directive("translateLanguage",i),i.displayName="translateLanguageDirective",angular.module("pascalprecht.translate").filter("translate",j),j.displayName="translateFilterFactory",angular.module("pascalprecht.translate").factory("$translationCache",k),k.displayName="$translationCache","pascalprecht.translate"}); | ||
!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={},i=function(a,c,d){return angular.forEach(d,function(d){if(angular.isFunction(d))a=d(a,c);else if(angular.isFunction(b[d]))a=b[d](a,c);else{if(!angular.isString(b[d]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'");if(!h[b[d]])try{h[b[d]]=f.get(b[d])}catch(e){throw h[b[d]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'")}a=h[b[d]](a,c)}}),a},j=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||j(),arguments.length<3&&(d=c),!d)return a;var e=angular.isArray(d)?d:[d];return i(a,b,e)}}}];var f=function(a){var b=angular.element("<div></div>");return b.text(a),b.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,c){if(angular.isObject(a)){var d=angular.isArray(a)?[]:{};if(c){if(c.indexOf(a)>-1)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else c=[];return c.push(a),angular.forEach(a,function(a,e){angular.isFunction(a)||(d[e]=h(a,b,c))}),c.splice(-1,1),d}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=[],w=a,x=[],y="translate-cloak",z=!1,A=!1,B=".",C=!1,D=!1,E=0,F=!0,G="default",H={"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},"iso639-1":function(a){var b=(a||"").split("_").join("-"),c=b.split("-");return c[0].toLowerCase()}},I="2.11.1",J=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};J.displayName="angular-translate/service: getFirstBrowserLanguage";var K=function(){var a=J()||"";return H[G]&&(a=H[G](a)),a};K.displayName="angular-translate/service: getLocale";var L=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},M=function(){return this.toString().replace(/^\s+|\s+$/g,"")},N=function(a){if(a){for(var b=[],c=angular.lowercase(a),d=0,e=v.length;d<e;d++)b.push(angular.lowercase(v[d]));if(L(b,c)>-1)return a;if(f){var g;for(var h in f)if(f.hasOwnProperty(h)){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],L(b,angular.lowercase(g))>-1))return g}}var k=a.split("_");return k.length>1&&L(b,angular.lowercase(k[0]))>-1?k[0]:void 0}},O=function(a,b){if(!a&&!b)return u;if(a&&!b){if(angular.isString(a))return u[a]}else angular.isObject(u[a])||(u[a]={}),angular.extend(u[a],P(b));return this};this.translations=O,this.cloakClassName=function(a){return a?(y=a,this):y},this.nestedObjectDelimeter=function(a){return a?(B=a,this):B};var P=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)?P(h,b.concat(e),c,e):(f=b.length?""+b.join(B)+B+e:e,b.length&&e===d&&(g=""+b.join(B),c[g]="@:"+f),c[f]=h));return c};P.displayName="flatObject",this.addInterpolation=function(a){return x.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 a?(Q(a),this):e};var Q=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 R(a),this};var R=function(a){return a?(angular.isString(a)?(h=!0,g=[a]):angular.isArray(a)&&(h=!1,g=a),angular.isString(e)&&L(g,e)<0&&g.push(e),this):h?g[0]:g};this.use=function(a){if(a){if(!u[a]&&!o)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return i=a,this}return i},this.resolveClientLocale=function(){return K()};var S=function(a){return a?(w=a,this):l?l+w:w};this.storageKey=S,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 z=!!a,this},this.forceAsyncReload=function(a){return A=!!a,this},this.uniformLanguageTag=function(a){return a?angular.isString(a)&&(a={standard:a}):a={},G=a.standard,this},this.determinePreferredLanguage=function(a){var b=a&&angular.isFunction(a)?a():K();return e=v.length?N(b)||b:b,this},this.registerAvailableLanguageKeys=function(a,b){return a?(v=a,b&&(f=b),this):v},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?E:(E=a,this)},this.statefulFilter=function(a){return void 0===a?F:(F=a,this)},this.postProcess=function(a){return t=a?a:void 0,this},this.keepContent=function(a){return D=!!a,this},this.$get=["$log","$injector","$rootScope","$q",function(a,b,c,d){var f,l,G,H=b.get(n||"$translateDefaultInterpolation"),J=!1,T={},U={},V=function(a,b,c,h,j){!i&&e&&(i=e);var m=j&&j!==i?N(j)||j:i;if(j&&ka(j),angular.isArray(a)){var n=function(a){for(var e={},f=[],g=function(a){var f=d.defer(),g=function(b){e[a]=b,f.resolve([a,b])};return V(a,b,c,h,j).then(g,g),f.promise},i=0,k=a.length;i<k;i++)f.push(g(a[i]));return d.all(f).then(function(){return e})};return n(a)}var o=d.defer();a&&(a=M.apply(a));var p=function(){var a=e?U[e]:U[m];if(l=0,k&&!a){var b=f.get(w);if(a=U[b],g&&g.length){var c=L(g,b);l=0===c?1:0,L(g,e)<0&&g.push(e)}}return a}();if(p){var q=function(){j||(m=i),ga(a,b,c,h,m).then(o.resolve,o.reject)};q.displayName="promiseResolved",p["finally"](q)}else ga(a,b,c,h,m).then(o.resolve,o.reject);return o.promise},W=function(a){return q&&(a=[q,a].join(" ")),r&&(a=[a,r].join(" ")),a},X=function(a){i=a,k&&f.put(V.storageKey(),i),c.$emit("$translateChangeSuccess",{language:a}),H.setLocale(i);var b=function(a,b){T[b].setLocale(i)};b.displayName="eachInterpolatorLocaleSetter",angular.forEach(T,b),c.$emit("$translateChangeEnd",{language:a})},Y=function(a){if(!a)throw"No language key specified for loading.";var e=d.defer();c.$emit("$translateLoadingStart",{language:a}),J=!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,P(a))}):angular.extend(d,P(b)),J=!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(x.length){var Z=function(a){var c=b.get(a);c.setLocale(e||i),T[c.getInterpolationIdentifier()]=c};Z.displayName="interpolationFactoryAdder",angular.forEach(x,Z)}var $=function(a){var b=d.defer();if(Object.prototype.hasOwnProperty.call(u,a))b.resolve(u[a]);else if(U[a]){var c=function(a){O(a.key,a.table),b.resolve(a.table)};c.displayName="translationTableResolver",U[a].then(c,b.reject)}else b.reject();return b.promise},_=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];if("@:"===g.substr(0,2))_(a,g.substr(2),c,e).then(f.resolve,f.reject);else{var h=e.interpolate(d[b],c);h=ja(b,d[b],h,c,a),f.resolve(h)}e.setLocale(i)}else f.reject()};return g.displayName="fallbackTranslationResolver",$(a).then(g,f.reject),f.promise},aa=function(a,b,c,d){var e,f=u[a];if(f&&Object.prototype.hasOwnProperty.call(f,b)){if(d.setLocale(a),e=d.interpolate(f[b],c),e=ja(b,f[b],e,c,a),"@:"===e.substr(0,2))return aa(a,e.substr(2),c,d);d.setLocale(i)}return e},ba=function(a,c,d){if(m){var e=b.get(m)(a,i,c,d);return void 0!==e?e:a}return a},ca=function(a,b,c,e,f){var h=d.defer();if(a<g.length){var i=g[a];_(i,b,c,e).then(function(a){h.resolve(a)},function(){return ca(a+1,b,c,e,f).then(h.resolve,h.reject)})}else f?h.resolve(f):m?h.resolve(ba(b,c)):h.reject(ba(b,c));return h.promise},da=function(a,b,c,d){var e;if(a<g.length){var f=g[a];e=aa(f,b,c,d),e||(e=da(a+1,b,c,d))}return e},ea=function(a,b,c,d){return ca(G>0?G:l,a,b,c,d)},fa=function(a,b,c){return da(G>0?G:l,a,b,c)},ga=function(a,b,c,e,f){var h=d.defer(),i=f?u[f]:u,j=c?T[c]:H;if(i&&Object.prototype.hasOwnProperty.call(i,a)){var k=i[a];if("@:"===k.substr(0,2))V(k.substr(2),b,c,e,f).then(h.resolve,h.reject);else{var l=j.interpolate(k,b);l=ja(a,k,l,b,f),h.resolve(l)}}else{var n;m&&!J&&(n=ba(a,b,e)),f&&g&&g.length?ea(a,b,j,e).then(function(a){h.resolve(a)},function(a){h.reject(W(a))}):m&&!J&&n?e?h.resolve(e):h.resolve(n):e?h.resolve(e):h.reject(W(a))}return h.promise},ha=function(a,b,c,d){var e,f=d?u[d]:u,h=H;if(T&&Object.prototype.hasOwnProperty.call(T,c)&&(h=T[c]),f&&Object.prototype.hasOwnProperty.call(f,a)){var i=f[a];"@:"===i.substr(0,2)?e=ha(i.substr(2),b,c,d):(e=h.interpolate(i,b),e=ja(a,i,e,b,d))}else{var j;m&&!J&&(j=ba(a,b)),d&&g&&g.length?(l=0,e=fa(a,b,h)):e=m&&!J&&j?j:W(a)}return e},ia=function(a){j===a&&(j=void 0),U[a]=void 0},ja=function(a,c,d,e,f){var g=t;return g&&("string"==typeof g&&(g=b.get(g)),g)?g(a,c,d,e,f):d},ka=function(a){u[a]||!o||U[a]||(U[a]=Y(a).then(function(a){return O(a.key,a.table),a}))};V.preferredLanguage=function(a){return a&&Q(a),e},V.cloakClassName=function(){return y},V.nestedObjectDelimeter=function(){return B},V.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(R(a),o&&g&&g.length)for(var b=0,c=g.length;b<c;b++)U[g[b]]||(U[g[b]]=Y(g[b]));V.use(V.use())}return h?g[0]:g},V.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=L(g,a);b>-1&&(G=b)}else G=0},V.proposedLanguage=function(){return j},V.storage=function(){return f},V.negotiateLocale=N,V.use=function(a){if(!a)return i;var b=d.defer();c.$emit("$translateChangeStart",{language:a});var e=N(a);return v.length>0&&!e?d.reject(a):(e&&(a=e),j=a,!A&&u[a]||!o||U[a]?U[a]?U[a].then(function(a){return j===a.key&&X(a.key),b.resolve(a.key),a},function(a){return!i&&g&&g.length>0?V.use(g[0]).then(b.resolve,b.reject):b.reject(a)}):(b.resolve(a),X(a)):(U[a]=Y(a).then(function(c){return O(c.key,c.table),b.resolve(c.key),j===a&&X(c.key),c},function(a){return c.$emit("$translateChangeError",{language:a}),b.reject(a),c.$emit("$translateChangeEnd",{language:a}),d.reject(a)}),U[a]["finally"](function(){ia(a)})),b.promise)},V.resolveClientLocale=function(){return K()},V.storageKey=function(){return S()},V.isPostCompilingEnabled=function(){return z},V.isForceAsyncReloadEnabled=function(){return A},V.isKeepContent=function(){return D},V.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(u[a]){var h=function(c){return O(c.key,c.table),a===i&&X(i),b(),c};h.displayName="refreshPostProcessor",Y(a).then(h,e)}else e();else{var j=[],k={};if(g&&g.length)for(var l=0,m=g.length;l<m;l++)j.push(Y(g[l])),k[g[l]]=!0;i&&!k[i]&&j.push(Y(i));var n=function(a){u={},angular.forEach(a,function(a){O(a.key,a.table)}),i&&X(i),b()};n.displayName="refreshPostProcessor",d.all(j).then(n,e)}return f.promise},V.instant=function(a,b,c,d){var f=d&&d!==i?N(d)||d:i;if(null===a||angular.isUndefined(a))return a;if(d&&ka(d),angular.isArray(a)){for(var h={},j=0,k=a.length;j<k;j++)h[a[j]]=V.instant(a[j],b,c,d);return h}if(angular.isString(a)&&a.length<1)return a;a&&(a=M.apply(a));var l,n=[];e&&n.push(e),f&&n.push(f),g&&g.length&&(n=n.concat(g));for(var o=0,p=n.length;o<p;o++){var s=n[o];if(u[s]&&"undefined"!=typeof u[s][a]&&(l=ha(a,b,c,f)),"undefined"!=typeof l)break}return l||""===l||(q||r?l=W(a):(l=H.interpolate(a,b),m&&!J&&(l=ba(a,b)))),l},V.versionInfo=function(){return I},V.loaderCache=function(){return s},V.directivePriority=function(){return E},V.statefulFilter=function(){return F},V.isReady=function(){return C};var la=d.defer();la.promise.then(function(){C=!0}),V.onReady=function(a){var b=d.defer();return angular.isFunction(a)&&b.promise.then(a),C?b.resolve():la.promise.then(b.resolve),b.promise},V.getAvailableLanguageKeys=function(){return v.length>0?v:null};var ma=c.$on("$translateReady",function(){la.resolve(),ma(),ma=null}),na=c.$on("$translateChangeEnd",function(){la.resolve(),na(),na=null});if(o){if(angular.equals(u,{})&&V.use()&&V.use(V.use()),g&&g.length)for(var oa=function(a){return O(a.key,a.table),c.$emit("$translateChangeEnd",{language:a.key}),a},pa=0,qa=g.length;pa<qa;pa++){var ra=g[pa];!A&&u[ra]||(U[ra]=Y(ra).then(oa))}}else c.$emit("$translateReady",{language:V.use()});return V}]}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;return angular.isNumber(c)?e=""+c:angular.isString(c)?(e=a(c)(d),e=b.sanitize(e,"text")):e="",e},d}function e(a,b,c,d,e,g){"use strict";var h=function(){return this.toString().replace(/^\s+|\s+$/g,"")};return{restrict:"AE",scope:!0,priority:a.directivePriority(),compile:function(b,i){var j=i.translateValues?i.translateValues:void 0,k=i.translateInterpolation?i.translateInterpolation:void 0,l=b[0].outerHTML.match(/translate-value-+/i),m="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)",n="^(.*)"+c.startSymbol()+"(.*)"+c.endSymbol()+"(.*)";return function(b,o,p){b.interpolateParams={},b.preText="",b.postText="",b.translateNamespace=f(b);var q={},r=function(a,c,d){if(c.translateValues&&angular.extend(a,e(c.translateValues)(b.$parent)),l)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]}},s=function(a){if(angular.isFunction(s._unwatchOld)&&(s._unwatchOld(),s._unwatchOld=void 0),angular.equals(a,"")||!angular.isDefined(a)){var d=h.apply(o.text()),e=d.match(m);if(angular.isArray(e)){b.preText=e[1],b.postText=e[3],q.translate=c(e[2])(b.$parent);var f=d.match(n);angular.isArray(f)&&f[2]&&f[2].length&&(s._unwatchOld=b.$watch(f[2],function(a){q.translate=a,y()}))}else q.translate=d?d:void 0}else q.translate=a;y()},t=function(a){p.$observe(a,function(b){q[a]=b,y()})};r(b.interpolateParams,p,i);var u=!0;p.$observe("translate",function(a){"undefined"==typeof a?s(""):""===a&&u||(q.translate=a,y()),u=!1});for(var v in p)p.hasOwnProperty(v)&&"translateAttr"===v.substr(0,13)&&t(v);if(p.$observe("translateDefault",function(a){b.defaultText=a,y()}),j&&p.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),l){var w=function(a){p.$observe(a,function(c){var d=angular.lowercase(a.substr(14,1))+a.substr(15);b.interpolateParams[d]=c})};for(var x in p)Object.prototype.hasOwnProperty.call(p,x)&&"translateValue"===x.substr(0,14)&&"translateValues"!==x&&w(x)}var y=function(){for(var a in q)q.hasOwnProperty(a)&&void 0!==q[a]&&z(a,q[a],b,b.interpolateParams,b.defaultText,b.translateNamespace)},z=function(b,c,d,e,f,g){c?(g&&"."===c.charAt(0)&&(c=g+c),a(c,e,k,f,d.translateLanguage).then(function(a){A(a,d,!0,b)},function(a){A(a,d,!1,b)})):A(c,d,!1,b)},A=function(b,c,e,f){if(e||"undefined"!=typeof c.defaultText&&(b=c.defaultText),"translate"===f){(e||!e&&!a.isKeepContent()&&"undefined"==typeof p.translateKeepContent)&&o.empty().append(c.preText+b+c.postText);var g=a.isPostCompilingEnabled(),h="undefined"!=typeof i.translateCompile,j=h&&"false"!==i.translateCompile;(g&&!h||j)&&d(o.contents())(c)}else{var k=p.$attr[f];"data-"===k.substr(0,5)&&(k=k.substr(5)),k=k.substr(15),o.attr(k,b)}};(j||l||p.translateDefault)&&b.$watch("interpolateParams",y,!0);var B=b.$on("translateLanguageChanged",y),C=g.$on("$translateChangeSuccess",y);o.text().length?s(p.translate?p.translate:""):p.translate&&s(p.translate),y(),b.$on("$destroy",function(){B(),C()})}}}}function f(a){"use strict";return a.translateNamespace?a.translateNamespace:a.$parent?f(a.$parent):void 0}function g(a,b){"use strict";return{compile:function(c){var d=function(){c.addClass(a.cloakClassName())},e=function(){c.removeClass(a.cloakClassName())};return a.onReady(function(){e()}),d(),function(c,f,g){g.translateCloak&&g.translateCloak.length&&(g.$observe("translateCloak",function(b){a(b).then(e,d)}),b.$on("$translateChangeSuccess",function(){a(g.translateCloak).then(e,d)}))}}}}function h(){"use strict";return{restrict:"A",scope:!0,compile:function(){return{pre:function(a,b,c){a.translateNamespace=f(a),a.translateNamespace&&"."===c.translateNamespace.charAt(0)?a.translateNamespace+=c.translateNamespace:a.translateNamespace=c.translateNamespace}}}}}function f(a){"use strict";return a.translateNamespace?a.translateNamespace:a.$parent?f(a.$parent):void 0}function i(){"use strict";return{restrict:"A",scope:!0,compile:function(){return function(a,b,c){c.$observe("translateLanguage",function(b){a.translateLanguage=b}),a.$watch("translateLanguage",function(){a.$broadcast("translateLanguageChanged")})}}}}function j(a,b){"use strict";var c=function(c,d,e,f){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e,f)};return b.statefulFilter()&&(c.$stateful=!0),c}function k(a){"use strict";return a("translations")}return a.$inject=["$translate"],c.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],d.$inject=["$interpolate","$translateSanitization"],e.$inject=["$translate","$q","$interpolate","$compile","$parse","$rootScope"],g.$inject=["$translate","$rootScope"],j.$inject=["$parse","$translate"],k.$inject=["$cacheFactory"],angular.module("pascalprecht.translate",["ng"]).run(a),a.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",b),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",c),c.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",d),d.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",e),e.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateCloak",g),g.displayName="translateCloakDirective",angular.module("pascalprecht.translate").directive("translateNamespace",h),h.displayName="translateNamespaceDirective",angular.module("pascalprecht.translate").directive("translateLanguage",i),i.displayName="translateLanguageDirective",angular.module("pascalprecht.translate").filter("translate",j),j.displayName="translateFilterFactory",angular.module("pascalprecht.translate").factory("$translationCache",k),k.displayName="$translationCache","pascalprecht.translate"}); |
{ | ||
"name": "angular-translate", | ||
"version": "2.11.0", | ||
"version": "2.11.1", | ||
"description": "A translation module for AngularJS", | ||
@@ -11,3 +11,3 @@ "main": "dist/angular-translate.js", | ||
"engines": { | ||
"node": ">=4.3" | ||
"node": ">=4.4" | ||
}, | ||
@@ -18,2 +18,3 @@ "scripts": { | ||
"test": "grunt install-test && grunt test", | ||
"test-headless": "grunt test-headless", | ||
"test-scopes": "grunt install-test && for f in test_scopes/*; do TEST_SCOPE=\"`basename $f`\" grunt test; done", | ||
@@ -20,0 +21,0 @@ "clean-test-scopes": "for f in test_scopes/*; do (cd $f; rm -rf bower_components); done", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
253659
4156
2