angular-translate
Advanced tools
Comparing version 2.4.0 to 2.4.1
116
CHANGELOG.md
@@ -1,117 +0,1 @@ | ||
# 2.4.0 (2014-09-22) | ||
## Features | ||
### service | ||
* introduce `versionInfo` function (e37d89c) | ||
* prefer detecting language by `navigator.languages` #722 (2204f4f) | ||
* enrich events with the currently handled language key (73b289d) | ||
* interpolate translationId in case of rejected translation (3efaac5) | ||
### loaders | ||
* introduce loader cache (b685601) | ||
### loader | ||
* apply support for loaderOptions.$http (8613bef) | ||
## Bug fixes | ||
### service | ||
* correctly iterate in fallback languages (fixes #690) (ac2f35c) | ||
* `$nextLang` should be not unset parallel loadings (d1745e4) | ||
* avoid possible doubled requested on refresh() (98d429d) | ||
* avoid possible npe in internal getTranslationTable() (9aaa9a0) | ||
### filter | ||
* mark filter being stateful required since Angular 1.3 rc2 (bffbf04) | ||
* interpolated params w/ scope aren't possible starting AJS1.3 (9465318) | ||
<a name="2.3.0"></a> | ||
## 2.3.0 (2014-09-16) | ||
#### Bug Fixes | ||
* **$translate:** return $missingTranslationHandler result when no translation was found ([7625951d](http://github.com/PascalPrecht/angular-translate/commit/7625951de2474049be78294fa129c32ea46df6a9)) | ||
* **bower.json:** Avoid 'invalid-meta angular-bootstrap-affix is missing "ignore" entry in bower.j ([595501a9](http://github.com/PascalPrecht/angular-translate/commit/595501a9d4882207e3ff510dec80dbe0a553d580)) | ||
* **demo:** fixes wrong method call in demo ([47fc9436](http://github.com/PascalPrecht/angular-translate/commit/47fc9436cfc69347f8a9b7f09cf5c726c0ca1931)) | ||
* **directive:** | ||
* improve the cloak-directive's performance ([acab18ab](http://github.com/PascalPrecht/angular-translate/commit/acab18ab5e6f455db86f6c9dabbbbdbc2f7b7855)) | ||
* change event for listening to `$translateChangeEnd` ([98fe649a](http://github.com/PascalPrecht/angular-translate/commit/98fe649a241b79c245fb32d838b84f0fac319f5a), closes [#658](http://github.com/PascalPrecht/angular-translate/issues/658)) | ||
* **docs:** | ||
* fix example in directive ngdoc-documentation (fixes #678) ([176b3e96](http://github.com/PascalPrecht/angular-translate/commit/176b3e96a78c4590f42817e6dcf44addcc49a13f)) | ||
* Fix typo ([6c2ab307](http://github.com/PascalPrecht/angular-translate/commit/6c2ab307d5b31c0e2e70c2cce0ccbf804db4c540)) | ||
* **package.json:** remove unnecessary relative paths from package.json ([8e5b87e7](http://github.com/PascalPrecht/angular-translate/commit/8e5b87e726562b2fcfdaefb49b35c114e92c66a0)) | ||
* **service:** | ||
* use hasOwnProperty of prototype #638 ([d8a5060b](http://github.com/PascalPrecht/angular-translate/commit/d8a5060b2273f699fa75e32d7a73e5f62aab670c)) | ||
* add shim for indexOf and trim #638 ([b951fd50](http://github.com/PascalPrecht/angular-translate/commit/b951fd50f1f312755de1fd66f51e38bef3f5b882)) | ||
* load fallback languages also for instant and filter ([ed6023a4](http://github.com/PascalPrecht/angular-translate/commit/ed6023a4aa2ebc51ba839b976eb1b8f8e8fa91b6)) | ||
* addition of preferred language to fallback language stack is now preventing dupl ([b2bb1669](http://github.com/PascalPrecht/angular-translate/commit/b2bb166944074aa174f0ed557bf4e2457128b3b8)) | ||
* **storage:** | ||
* fixup 75504cbe ([53a8badb](http://github.com/PascalPrecht/angular-translate/commit/53a8badbd1d8fe82d43ddc17e27eaae1a414ee9b)) | ||
* fix 'DOM Exception 18' at feature detection ([75504cbe](http://github.com/PascalPrecht/angular-translate/commit/75504cbe2ddc0d18e08288b0fa4453356aaafe73)) | ||
* **translateService:** | ||
* fixup/rewrite for b48f6bb (specs) ([45ac14d5](http://github.com/PascalPrecht/angular-translate/commit/45ac14d5bf7d8d9569fa0fff99a0dcb5bc419e68)) | ||
* prevent multiple XHR calls ([b48f6bb4](http://github.com/PascalPrecht/angular-translate/commit/b48f6bb438a193174df569beef24d193d5cd954c)) | ||
#### Features | ||
* **directive:** add possibility to mix translation interpolation with other text in element body ([be621314](http://github.com/PascalPrecht/angular-translate/commit/be6213144a686b34cff3ba29b9a52041924b2c9e), closes [#461](http://github.com/PascalPrecht/angular-translate/issues/461)) | ||
<a name="2.2.0"></a> | ||
## 2.2.0 (2014-06-03) | ||
#### Bug Fixes | ||
* fix npe on empty strings (trim()) ([c69de7b8](http://github.com/PascalPrecht/angular-translate/commit/c69de7b87a0efe05548f03b1f2767968d2dc6aac)) | ||
* **$translate:** | ||
* checks modification ([b91e4ded](http://github.com/PascalPrecht/angular-translate/commit/b91e4ded560a96a815248f116c893e10414296af)) | ||
* if translation exists, use the translated string even if it's empty ([eeb8c2ad](http://github.com/PascalPrecht/angular-translate/commit/eeb8c2ad23f915828e83c840ecb00c840812dfa2)) | ||
* use case-insensitive check for language key aliases ([26ec3088](http://github.com/PascalPrecht/angular-translate/commit/26ec3088bcc50bacb8370e352e556d4e48830b64)) | ||
* **$translateProvider:** | ||
* determinePreferredLanguage was not chainable ([7c29f2fc](http://github.com/PascalPrecht/angular-translate/commit/7c29f2fc5aeea17dd50ecfc40d1fad67ddd93650), closes [#487](http://github.com/PascalPrecht/angular-translate/issues/487)) | ||
* fix comparison in one case of negotiateLocale() ([fe04c72f](http://github.com/PascalPrecht/angular-translate/commit/fe04c72fc1bb2b9ff07ac0d974374e16397d58c7)) | ||
* **demo:** | ||
* use `.instant()` ([6bea1928](http://github.com/PascalPrecht/angular-translate/commit/6bea19281d52f8ae956f6e898616d01c097d8c23)) | ||
* correct demo of `translate-values` ([7de2ae23](http://github.com/PascalPrecht/angular-translate/commit/7de2ae23ee87a10921c3b4883d535fd69ecf2b89)) | ||
* **directive:** Make translate-value-* work inside ng-if and ng-repeat ([e07eea75](http://github.com/PascalPrecht/angular-translate/commit/e07eea757aec8cf3d2342abcd94e97d1fe615c80)) | ||
* **docs:** removes explicit protocol declaration for assets ([eaa9bf7b](http://github.com/PascalPrecht/angular-translate/commit/eaa9bf7b46cf5983e9f9fd97a22a606bf52480dd)) | ||
* **gruntfile:** fix image link ([65fc8be3](http://github.com/PascalPrecht/angular-translate/commit/65fc8be35ddae016438fd627d788317c46bb22f3)) | ||
* **package.json:** fix repository url ([40af7ce7](http://github.com/PascalPrecht/angular-translate/commit/40af7ce79228526068e11f1a3b6cc3f56e30a831)) | ||
* **partialLoader:** fixes deprecated usage of arguments.callee ([1ac3a0a7](http://github.com/PascalPrecht/angular-translate/commit/1ac3a0a7c69f0e765a615a395ea467f9de95f0c9)) | ||
* **service:** | ||
* use the aliased language key if available ([675e9a21](http://github.com/PascalPrecht/angular-translate/commit/675e9a21b6b20b9aa78514deb602954a985a5f83), closes [#530](http://github.com/PascalPrecht/angular-translate/issues/530)) | ||
* docs annotation ([839c4e89](http://github.com/PascalPrecht/angular-translate/commit/839c4e89f1fa062bfceebf43126cc38b699f891c)) | ||
* **storageLocal:** fixes QUOTAEXCEEDEDERROR (safari private browsing) ([59aa2a01](http://github.com/PascalPrecht/angular-translate/commit/59aa2a01dca73b8343eadd77d41dcb294bfad89a)) | ||
* **translateInterpolator:** make it work with 1.3-beta ([97e2241c](http://github.com/PascalPrecht/angular-translate/commit/97e2241c9f612df347863b3fb57acc5416168b07)) | ||
#### Features | ||
* **directive:** | ||
* add option to define a default translation text ([a8026651](http://github.com/PascalPrecht/angular-translate/commit/a8026651b5fdc424c681c03cda1b1f749493ba26)) | ||
* Support for camel casing interpolation variables. ([b3450410](http://github.com/PascalPrecht/angular-translate/commit/b3450410686846291fd068616237586b35beb91e)) | ||
* **messageformat-support:** enhancing for sanitization like default ([ad016861](http://github.com/PascalPrecht/angular-translate/commit/ad016861f6ed4d65a6ee074b8feba3f9911dfc20)) | ||
* **missingFallbackDefaultText:** enables a feature to return a default text for displaying in case of missing tra ([f24b15e8](http://github.com/PascalPrecht/angular-translate/commit/f24b15e8d3ca6231deab64a843d4ca5830176343)) | ||
* **service:** | ||
* allow using wildcards in language aliases ([6f0ae3bf](http://github.com/PascalPrecht/angular-translate/commit/6f0ae3bf6dd873534c9957b2cce398b290c92da7), closes [#426](http://github.com/PascalPrecht/angular-translate/issues/426)) | ||
* add possibility to translate a set of translation ids ([612dc27b](http://github.com/PascalPrecht/angular-translate/commit/612dc27b1382679941061f71920f4ee0bc6f7834)) | ||
# 2.1.0 (2014-04-02) | ||
@@ -118,0 +2,0 @@ |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -19,6 +19,6 @@ * Copyright (c) 2014 ; Licensed MIT | ||
var self = this; | ||
$http(angular.extend({}, $httpOptions, { | ||
$http(angular.extend({ | ||
method: 'GET', | ||
url: this.parseUrl(urlTemplate, lang) | ||
})).success(function (data) { | ||
}, $httpOptions)).success(function (data) { | ||
self.tables[lang] = data; | ||
@@ -25,0 +25,0 @@ deferred.resolve(data); |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
* Copyright (c) 2014 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").provider("$translatePartialLoader",function(){function a(a){this.name=a,this.isActive=!0,this.tables={}}function b(a){return Object.prototype.hasOwnProperty.call(f,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)&&f[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}a.prototype.parseUrl=function(a,b){return a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=b.defer();if(this.tables[a])g.resolve(this.tables[a]);else{var h=this;c(angular.extend({},d,{method:"GET",url:this.parseUrl(e,a)})).success(function(b){h.tables[a]=b,g.resolve(b)}).error(function(){f?f(h.name,a).then(function(b){h.tables[a]=b,g.resolve(b)},function(){g.reject(h.name)}):g.reject(h.name)})}return g.promise};var f={};this.addPart=function(d){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(f[d]=new a(d)),f[d].isActive=!0,this},this.setPart=function(d,e,g){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 g||null===g)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(f[e]=new a(e),f[e].isActive=!1),f[e].tables[d]=g,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(f[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http","$translate",function(g,h,i,j,k){var l=function(a){function d(a){l.push(a)}if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string.");var g=a.loadFailureHandler;if(void 0!==g){if(!angular.isString(g))throw new Error("Unable to load data, a loadFailureHandler is not a string.");g=h.get(g)}var k=[],l=[],m=i.defer();for(var n in f)b(n)&&f[n].isActive&&(k.push(f[n].getTable(a.key,i,j,a.$http,a.urlTemplate,g).then(d)),f[n].urlTemplate=a.urlTemplate);return k.length?i.all(k).then(function(){for(var a={},b=0;b<l.length;b++)e(a,l[b]);m.resolve(a)},function(){m.reject(a.key)}):m.resolve({}),m.promise};return l.addPart=function(d){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?f[d].isActive||(f[d].isActive=!0,g.$emit("$translatePartialLoaderStructureChanged",d)):(f[d]=new a(d),g.$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=f[a].isActive;if(d){var i=k.loaderCache();"string"==typeof i&&(i=h.get(i)),"object"==typeof i&&angular.forEach(f[a].tables,function(b,c){i.remove(f[a].parseUrl(f[a].urlTemplate,c))}),delete f[a]}else f[a].isActive=!1;e&&g.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartAvailable=d,l}]}); | ||
angular.module("pascalprecht.translate").provider("$translatePartialLoader",function(){function a(a){this.name=a,this.isActive=!0,this.tables={}}function b(a){return Object.prototype.hasOwnProperty.call(f,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)&&f[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}a.prototype.parseUrl=function(a,b){return a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=b.defer();if(this.tables[a])g.resolve(this.tables[a]);else{var h=this;c(angular.extend({method:"GET",url:this.parseUrl(e,a)},d)).success(function(b){h.tables[a]=b,g.resolve(b)}).error(function(){f?f(h.name,a).then(function(b){h.tables[a]=b,g.resolve(b)},function(){g.reject(h.name)}):g.reject(h.name)})}return g.promise};var f={};this.addPart=function(d){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(f[d]=new a(d)),f[d].isActive=!0,this},this.setPart=function(d,e,g){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 g||null===g)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(f[e]=new a(e),f[e].isActive=!1),f[e].tables[d]=g,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(f[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http","$translate",function(g,h,i,j,k){var l=function(a){function d(a){l.push(a)}if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string.");var g=a.loadFailureHandler;if(void 0!==g){if(!angular.isString(g))throw new Error("Unable to load data, a loadFailureHandler is not a string.");g=h.get(g)}var k=[],l=[],m=i.defer();for(var n in f)b(n)&&f[n].isActive&&(k.push(f[n].getTable(a.key,i,j,a.$http,a.urlTemplate,g).then(d)),f[n].urlTemplate=a.urlTemplate);return k.length?i.all(k).then(function(){for(var a={},b=0;b<l.length;b++)e(a,l[b]);m.resolve(a)},function(){m.reject(a.key)}):m.resolve({}),m.promise};return l.addPart=function(d){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?f[d].isActive||(f[d].isActive=!0,g.$emit("$translatePartialLoaderStructureChanged",d)):(f[d]=new a(d),g.$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=f[a].isActive;if(d){var i=k.loaderCache();"string"==typeof i&&(i=h.get(i)),"object"==typeof i&&angular.forEach(f[a].tables,function(b,c){i.remove(f[a].parseUrl(f[a].urlTemplate,c))}),delete f[a]}else f[a].isActive=!1;e&&g.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartAvailable=d,l}]}); |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -15,3 +15,3 @@ * Copyright (c) 2014 ; Licensed MIT | ||
var deferred = $q.defer(); | ||
$http(angular.extend({}, options.$http, { | ||
$http(angular.extend({ | ||
url: [ | ||
@@ -24,3 +24,3 @@ options.prefix, | ||
params: '' | ||
})).success(function (data) { | ||
}, options.$http)).success(function (data) { | ||
deferred.resolve(data); | ||
@@ -27,0 +27,0 @@ }).error(function (data) { |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
* Copyright (c) 2014 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",["$q","$http",function(a,b){return function(c){if(!c||!angular.isString(c.prefix)||!angular.isString(c.suffix))throw new Error("Couldn't load static files, no prefix or suffix specified!");var d=a.defer();return b(angular.extend({},c.$http,{url:[c.prefix,c.key,c.suffix].join(""),method:"GET",params:""})).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}]); | ||
angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",["$q","$http",function(a,b){return function(c){if(!c||!angular.isString(c.prefix)||!angular.isString(c.suffix))throw new Error("Couldn't load static files, no prefix or suffix specified!");var d=a.defer();return b(angular.extend({url:[c.prefix,c.key,c.suffix].join(""),method:"GET",params:""},c.$http)).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}]); |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -15,7 +15,7 @@ * Copyright (c) 2014 ; Licensed MIT | ||
var deferred = $q.defer(); | ||
$http(angular.extend({}, options.$http, { | ||
$http(angular.extend({ | ||
url: options.url, | ||
params: { lang: options.key }, | ||
method: 'GET' | ||
})).success(function (data) { | ||
}, options.$http)).success(function (data) { | ||
deferred.resolve(data); | ||
@@ -22,0 +22,0 @@ }).error(function (data) { |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
* Copyright (c) 2014 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate").factory("$translateUrlLoader",["$q","$http",function(a,b){return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d=a.defer();return b(angular.extend({},c.$http,{url:c.url,params:{lang:c.key},method:"GET"})).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}]); | ||
angular.module("pascalprecht.translate").factory("$translateUrlLoader",["$q","$http",function(a,b){return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d=a.defer();return b(angular.extend({url:c.url,params:{lang:c.key},method:"GET"},c.$http)).success(function(a){d.resolve(a)}).error(function(){d.reject(c.key)}),d.promise}}]); |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2014 ; Licensed MIT |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
@@ -29,3 +29,3 @@ * Copyright (c) 2014 ; Licensed MIT | ||
var $translationTable = {}, $preferredLanguage, $availableLanguageKeys = [], $languageKeyAliases, $fallbackLanguage, $fallbackWasString, $uses, $nextLang, $storageFactory, $storageKey = $STORAGE_KEY, $storagePrefix, $missingTranslationHandlerFactory, $interpolationFactory, $interpolatorFactories = [], $interpolationSanitizationStrategy = false, $loaderFactory, $cloakClassName = 'translate-cloak', $loaderOptions, $notFoundIndicatorLeft, $notFoundIndicatorRight, $postCompilingEnabled = false, NESTED_OBJECT_DELIMITER = '.', loaderCache; | ||
var version = '2.4.0'; | ||
var version = '2.4.1'; | ||
var getLocale = function () { | ||
@@ -215,4 +215,4 @@ var nav = window.navigator; | ||
this.storageKey = storageKey; | ||
this.useUrlLoader = function (url) { | ||
return this.useLoader('$translateUrlLoader', { url: url }); | ||
this.useUrlLoader = function (url, options) { | ||
return this.useLoader('$translateUrlLoader', angular.extend({ url: url }, options)); | ||
}; | ||
@@ -386,6 +386,7 @@ this.useStaticFilesLoader = function (options) { | ||
} | ||
$injector.get($loaderFactory)(angular.extend($loaderOptions, { | ||
key: key, | ||
$http: angular.extend({}, $loaderOptions.$http, { cache: cache }) | ||
})).then(function (data) { | ||
var loaderOptions = angular.extend({}, $loaderOptions, { | ||
key: key, | ||
$http: angular.extend({}, { cache: cache }, $loaderOptions.$http) | ||
}); | ||
$injector.get($loaderFactory)(loaderOptions).then(function (data) { | ||
var translationTable = {}; | ||
@@ -758,2 +759,3 @@ $rootScope.$emit('$translateLoadingSuccess', { language: key }); | ||
translations(translation.key, translation.table); | ||
$rootScope.$emit('$translateChangeEnd', { language: translation.key }); | ||
}; | ||
@@ -760,0 +762,0 @@ for (var i = 0, len = $fallbackLanguage.length; i < len; i++) { |
/*! | ||
* angular-translate - v2.4.0 - 2014-09-22 | ||
* angular-translate - v2.4.1 - 2014-10-03 | ||
* http://github.com/PascalPrecht/angular-translate | ||
* Copyright (c) 2014 ; Licensed MIT | ||
*/ | ||
angular.module("pascalprecht.translate",["ng"]).run(["$translate",function(a){var b=a.storageKey(),c=a.storage();c?c.get(b)?a.use(c.get(b)):angular.isString(a.preferredLanguage())?a.use(a.preferredLanguage()):c.set(b,a.use()):angular.isString(a.preferredLanguage())&&a.use(a.preferredLanguage())}]),angular.module("pascalprecht.translate").provider("$translate",["$STORAGE_KEY",function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q={},r=[],s=a,t=[],u=!1,v="translate-cloak",w=!1,x=".",y="2.4.0",z=function(){var a=window.navigator;return((angular.isArray(a.languages)?a.languages[0]:a.language||a.browserLanguage||a.systemLanguage||a.userLanguage)||"").split("-").join("_")},A=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},B=function(){return this.replace(/^\s+|\s+$/g,"")},C=function(a){for(var b=[],d=angular.lowercase(a),e=0,f=r.length;f>e;e++)b.push(angular.lowercase(r[e]));if(A(b,d)>-1)return a;if(c){var g;for(var h in c){var i=!1,j=Object.prototype.hasOwnProperty.call(c,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=c[h],A(b,angular.lowercase(g))>-1))return g}}var k=a.split("_");return k.length>1&&A(b,angular.lowercase(k[0]))>-1?k[0]:a},D=function(a,b){if(!a&&!b)return q;if(a&&!b){if(angular.isString(a))return q[a]}else angular.isObject(q[a])||(q[a]={}),angular.extend(q[a],E(b));return this};this.translations=D,this.cloakClassName=function(a){return a?(v=a,this):v};var E=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)?E(h,b.concat(e),c,e):(f=b.length?""+b.join(x)+x+e:e,b.length&&e===d&&(g=""+b.join(x),c[g]="@:"+f),c[f]=h));return c};this.addInterpolation=function(a){return t.push(a),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(a){return k=a,this},this.useSanitizeValueStrategy=function(a){return u=a,this},this.preferredLanguage=function(a){return F(a),this};var F=function(a){return a&&(b=a),b};this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},this.translationNotFoundIndicatorLeft=function(a){return a?(n=a,this):n},this.translationNotFoundIndicatorRight=function(a){return a?(o=a,this):o},this.fallbackLanguage=function(a){return G(a),this};var G=function(a){return a?(angular.isString(a)?(e=!0,d=[a]):angular.isArray(a)&&(e=!1,d=a),angular.isString(b)&&A(d,b)<0&&d.push(b),this):e?d[0]:d};this.use=function(a){if(a){if(!q[a]&&!l)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return f=a,this}return f};var H=function(a){return a?void(s=a):i?i+s:s};this.storageKey=H,this.useUrlLoader=function(a){return this.useLoader("$translateUrlLoader",{url:a})},this.useStaticFilesLoader=function(a){return this.useLoader("$translateStaticFilesLoader",a)},this.useLoader=function(a,b){return l=a,m=b||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(a){return h=a,this},this.storagePrefix=function(a){return a?(i=a,this):a},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(a){return j=a,this},this.usePostCompiling=function(a){return w=!!a,this},this.determinePreferredLanguage=function(a){var c=a&&angular.isFunction(a)?a():z();return b=r.length?C(c):c,this},this.registerAvailableLanguageKeys=function(a,b){return a?(r=a,b&&(c=b),this):r},this.useLoaderCache=function(a){return a===!1?p=void 0:a===!0?p=!0:"undefined"==typeof a?p="$translationCache":a&&(p=a),this},this.$get=["$log","$injector","$rootScope","$q",function(a,c,i,r){var x,z,I,J=c.get(k||"$translateDefaultInterpolation"),K=!1,L={},M={},N=function(a,c,e){if(angular.isArray(a)){var g=function(a){for(var b={},d=[],f=function(a){var d=r.defer(),f=function(c){b[a]=c,d.resolve([a,c])};return N(a,c,e).then(f,f),d.promise},g=0,h=a.length;h>g;g++)d.push(f(a[g]));return r.all(d).then(function(){return b})};return g(a)}var i=r.defer();a&&(a=B.apply(a));var j=function(){var a=b?M[b]:M[f];if(z=0,h&&!a){var c=x.get(s);if(a=M[c],d&&d.length){var e=A(d,c);z=0===e?1:0,A(d,b)<0&&d.push(b)}}return a}();return j?j.then(function(){Z(a,c,e).then(i.resolve,i.reject)},i.reject):Z(a,c,e).then(i.resolve,i.reject),i.promise},O=function(a){return n&&(a=[n,a].join(" ")),o&&(a=[a,o].join(" ")),a},P=function(a){f=a,i.$emit("$translateChangeSuccess",{language:a}),h&&x.set(N.storageKey(),f),J.setLocale(f),angular.forEach(L,function(a,b){L[b].setLocale(f)}),i.$emit("$translateChangeEnd",{language:a})},Q=function(a){if(!a)throw"No language key specified for loading.";var b=r.defer();i.$emit("$translateLoadingStart",{language:a}),K=!0;var d=p;return"string"==typeof d&&(d=c.get(d)),c.get(l)(angular.extend(m,{key:a,$http:angular.extend({},m.$http,{cache:d})})).then(function(c){var d={};i.$emit("$translateLoadingSuccess",{language:a}),angular.isArray(c)?angular.forEach(c,function(a){angular.extend(d,E(a))}):angular.extend(d,E(c)),K=!1,b.resolve({key:a,table:d}),i.$emit("$translateLoadingEnd",{language:a})},function(a){i.$emit("$translateLoadingError",{language:a}),b.reject(a),i.$emit("$translateLoadingEnd",{language:a})}),b.promise};if(h&&(x=c.get(h),!x.get||!x.set))throw new Error("Couldn't use storage '"+h+"', missing get() or set() method!");angular.isFunction(J.useSanitizeValueStrategy)&&J.useSanitizeValueStrategy(u),t.length&&angular.forEach(t,function(a){var d=c.get(a);d.setLocale(b||f),angular.isFunction(d.useSanitizeValueStrategy)&&d.useSanitizeValueStrategy(u),L[d.getInterpolationIdentifier()]=d});var R=function(a){var b=r.defer();return Object.prototype.hasOwnProperty.call(q,a)?b.resolve(q[a]):M[a]?M[a].then(function(a){D(a.key,a.table),b.resolve(a.table)},b.reject):b.reject(),b.promise},S=function(a,b,c,d){var e=r.defer();return R(a).then(function(g){Object.prototype.hasOwnProperty.call(g,b)?(d.setLocale(a),e.resolve(d.interpolate(g[b],c)),d.setLocale(f)):e.reject()},e.reject),e.promise},T=function(a,b,c,d){var e,g=q[a];return Object.prototype.hasOwnProperty.call(g,b)&&(d.setLocale(a),e=d.interpolate(g[b],c),d.setLocale(f)),e},U=function(a){if(j){var b=c.get(j)(a,f);return void 0!==b?b:a}return a},V=function(a,b,c,e){var f=r.defer();if(a<d.length){var g=d[a];S(g,b,c,e).then(f.resolve,function(){V(a+1,b,c,e).then(f.resolve)})}else f.resolve(U(b));return f.promise},W=function(a,b,c,e){var f;if(a<d.length){var g=d[a];f=T(g,b,c,e),f||(f=W(a+1,b,c,e))}return f},X=function(a,b,c){return V(I>0?I:z,a,b,c)},Y=function(a,b,c){return W(I>0?I:z,a,b,c)},Z=function(a,b,c){var e=r.defer(),g=f?q[f]:q,h=c?L[c]:J;if(g&&Object.prototype.hasOwnProperty.call(g,a)){var i=g[a];"@:"===i.substr(0,2)?N(i.substr(2),b,c).then(e.resolve,e.reject):e.resolve(h.interpolate(i,b))}else{var k;j&&!K&&(k=U(a)),f&&d&&d.length?X(a,b,h).then(function(a){e.resolve(a)},function(a){e.reject(O(a))}):j&&!K&&k?e.resolve(k):e.reject(O(a))}return e.promise},$=function(a,b,c){var e,g=f?q[f]:q,h=c?L[c]:J;if(g&&Object.prototype.hasOwnProperty.call(g,a)){var i=g[a];e="@:"===i.substr(0,2)?$(i.substr(2),b,c):h.interpolate(i,b)}else{var k;j&&!K&&(k=U(a)),f&&d&&d.length?(z=0,e=Y(a,b,h)):e=j&&!K&&k?k:O(a)}return e};if(N.preferredLanguage=function(a){return a&&F(a),b},N.cloakClassName=function(){return v},N.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(G(a),l&&d&&d.length)for(var b=0,c=d.length;c>b;b++)M[d[b]]||(M[d[b]]=Q(d[b]));N.use(N.use())}return e?d[0]:d},N.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=A(d,a);b>-1&&(I=b)}else I=0},N.proposedLanguage=function(){return g},N.storage=function(){return x},N.use=function(a){if(!a)return f;var b=r.defer();i.$emit("$translateChangeStart",{language:a});var c=C(a);return c&&(a=c),q[a]||!l||M[a]?(b.resolve(a),P(a)):(g=a,M[a]=Q(a).then(function(c){D(c.key,c.table),b.resolve(c.key),P(c.key),g===a&&(g=void 0)},function(a){g===a&&(g=void 0),i.$emit("$translateChangeError",{language:a}),b.reject(a),i.$emit("$translateChangeEnd",{language:a})})),b.promise},N.storageKey=function(){return H()},N.isPostCompilingEnabled=function(){return w},N.refresh=function(a){function b(){e.resolve(),i.$emit("$translateRefreshEnd",{language:a})}function c(){e.reject(),i.$emit("$translateRefreshEnd",{language:a})}if(!l)throw new Error("Couldn't refresh translation table, no loader registered!");var e=r.defer();if(i.$emit("$translateRefreshStart",{language:a}),a)q[a]?Q(a).then(function(c){D(c.key,c.table),a===f&&P(f),b()},c):c();else{var g=[],h={};if(d&&d.length)for(var j=0,k=d.length;k>j;j++)g.push(Q(d[j])),h[d[j]]=!0;f&&!h[f]&&g.push(Q(f)),r.all(g).then(function(a){angular.forEach(a,function(a){q[a.key]&&delete q[a.key],D(a.key,a.table)}),f&&P(f),b()})}return e.promise},N.instant=function(a,c,e){if(null===a||angular.isUndefined(a))return a;if(angular.isArray(a)){for(var g={},h=0,i=a.length;i>h;h++)g[a[h]]=N.instant(a[h],c,e);return g}if(angular.isString(a)&&a.length<1)return a;a&&(a=B.apply(a));var k,l=[];b&&l.push(b),f&&l.push(f),d&&d.length&&(l=l.concat(d));for(var m=0,n=l.length;n>m;m++){var o=l[m];if(q[o]&&"undefined"!=typeof q[o][a]&&(k=$(a,c,e)),"undefined"!=typeof k)break}return k||""===k||(k=J.interpolate(a,c),j&&!K&&(k=U(a))),k},N.versionInfo=function(){return y},N.loaderCache=function(){return p},l&&(angular.equals(q,{})&&N.use(N.use()),d&&d.length))for(var _=function(a){D(a.key,a.table)},ab=0,bb=d.length;bb>ab;ab++)M[d[ab]]=Q(d[ab]).then(_);return N}]}]),angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",["$interpolate",function(a){var b,c={},d="default",e=null,f={escaped:function(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=angular.element("<div></div>").text(a[c]).html());return b}},g=function(a){var b;return b=angular.isFunction(f[e])?f[e](a):a};return c.setLocale=function(a){b=a},c.getInterpolationIdentifier=function(){return d},c.useSanitizeValueStrategy=function(a){return e=a,this},c.interpolate=function(b,c){return e&&(c=g(c)),a(b)(c||{})},c}]),angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",["$translate","$q","$interpolate","$compile","$parse","$rootScope",function(a,b,c,d,e,f){return{restrict:"AE",scope:!0,compile:function(b,g){var h=g.translateValues?g.translateValues:void 0,i=g.translateInterpolation?g.translateInterpolation:void 0,j=b[0].outerHTML.match(/translate-value-+/i),k="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)";return function(b,l,m){if(b.interpolateParams={},b.preText="",b.postText="",m.$observe("translate",function(a){if(angular.equals(a,"")||!angular.isDefined(a)){var d=l.text().match(k);angular.isArray(d)?(b.preText=d[1],b.postText=d[3],b.translationId=c(d[2])(b.$parent)):b.translationId=l.text().replace(/^\s+|\s+$/g,"")}else b.translationId=a}),m.$observe("translateDefault",function(a){b.defaultText=a}),h&&m.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),j){var n=function(a){m.$observe(a,function(c){b.interpolateParams[angular.lowercase(a.substr(14,1))+a.substr(15)]=c})};for(var o in m)Object.prototype.hasOwnProperty.call(m,o)&&"translateValue"===o.substr(0,14)&&"translateValues"!==o&&n(o)}var p=function(b,c,e){e||"undefined"==typeof c.defaultText||(b=c.defaultText),l.html(c.preText+b+c.postText);var f=a.isPostCompilingEnabled(),h="undefined"!=typeof g.translateCompile,i=h&&"false"!==g.translateCompile;(f&&!h||i)&&d(l.contents())(c)},q=function(){return h||j?function(){var c=function(){b.translationId&&b.interpolateParams&&a(b.translationId,b.interpolateParams,i).then(function(a){p(a,b,!0)},function(a){p(a,b,!1)})};b.$watch("interpolateParams",c,!0),b.$watch("translationId",c)}:function(){var c=b.$watch("translationId",function(d){b.translationId&&d&&a(d,{},i).then(function(a){p(a,b,!0),c()},function(a){p(a,b,!1),c()})},!0)}}(),r=f.$on("$translateChangeSuccess",q);q(),b.$on("$destroy",r)}}}}]),angular.module("pascalprecht.translate").directive("translateCloak",["$rootScope","$translate",function(a,b){return{compile:function(c){var d=a.$on("$translateChangeEnd",function(){c.removeClass(b.cloakClassName()),d(),d=null});c.addClass(b.cloakClassName())}}}]),angular.module("pascalprecht.translate").filter("translate",["$parse","$translate",function(a,b){var c=function(c,d,e){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e)};return c.$stateful=!0,c}]); | ||
angular.module("pascalprecht.translate",["ng"]).run(["$translate",function(a){var b=a.storageKey(),c=a.storage();c?c.get(b)?a.use(c.get(b)):angular.isString(a.preferredLanguage())?a.use(a.preferredLanguage()):c.set(b,a.use()):angular.isString(a.preferredLanguage())&&a.use(a.preferredLanguage())}]),angular.module("pascalprecht.translate").provider("$translate",["$STORAGE_KEY",function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q={},r=[],s=a,t=[],u=!1,v="translate-cloak",w=!1,x=".",y="2.4.1",z=function(){var a=window.navigator;return((angular.isArray(a.languages)?a.languages[0]:a.language||a.browserLanguage||a.systemLanguage||a.userLanguage)||"").split("-").join("_")},A=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},B=function(){return this.replace(/^\s+|\s+$/g,"")},C=function(a){for(var b=[],d=angular.lowercase(a),e=0,f=r.length;f>e;e++)b.push(angular.lowercase(r[e]));if(A(b,d)>-1)return a;if(c){var g;for(var h in c){var i=!1,j=Object.prototype.hasOwnProperty.call(c,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=c[h],A(b,angular.lowercase(g))>-1))return g}}var k=a.split("_");return k.length>1&&A(b,angular.lowercase(k[0]))>-1?k[0]:a},D=function(a,b){if(!a&&!b)return q;if(a&&!b){if(angular.isString(a))return q[a]}else angular.isObject(q[a])||(q[a]={}),angular.extend(q[a],E(b));return this};this.translations=D,this.cloakClassName=function(a){return a?(v=a,this):v};var E=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)?E(h,b.concat(e),c,e):(f=b.length?""+b.join(x)+x+e:e,b.length&&e===d&&(g=""+b.join(x),c[g]="@:"+f),c[f]=h));return c};this.addInterpolation=function(a){return t.push(a),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(a){return k=a,this},this.useSanitizeValueStrategy=function(a){return u=a,this},this.preferredLanguage=function(a){return F(a),this};var F=function(a){return a&&(b=a),b};this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},this.translationNotFoundIndicatorLeft=function(a){return a?(n=a,this):n},this.translationNotFoundIndicatorRight=function(a){return a?(o=a,this):o},this.fallbackLanguage=function(a){return G(a),this};var G=function(a){return a?(angular.isString(a)?(e=!0,d=[a]):angular.isArray(a)&&(e=!1,d=a),angular.isString(b)&&A(d,b)<0&&d.push(b),this):e?d[0]:d};this.use=function(a){if(a){if(!q[a]&&!l)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return f=a,this}return f};var H=function(a){return a?void(s=a):i?i+s:s};this.storageKey=H,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 l=a,m=b||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(a){return h=a,this},this.storagePrefix=function(a){return a?(i=a,this):a},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(a){return j=a,this},this.usePostCompiling=function(a){return w=!!a,this},this.determinePreferredLanguage=function(a){var c=a&&angular.isFunction(a)?a():z();return b=r.length?C(c):c,this},this.registerAvailableLanguageKeys=function(a,b){return a?(r=a,b&&(c=b),this):r},this.useLoaderCache=function(a){return a===!1?p=void 0:a===!0?p=!0:"undefined"==typeof a?p="$translationCache":a&&(p=a),this},this.$get=["$log","$injector","$rootScope","$q",function(a,c,i,r){var x,z,I,J=c.get(k||"$translateDefaultInterpolation"),K=!1,L={},M={},N=function(a,c,e){if(angular.isArray(a)){var g=function(a){for(var b={},d=[],f=function(a){var d=r.defer(),f=function(c){b[a]=c,d.resolve([a,c])};return N(a,c,e).then(f,f),d.promise},g=0,h=a.length;h>g;g++)d.push(f(a[g]));return r.all(d).then(function(){return b})};return g(a)}var i=r.defer();a&&(a=B.apply(a));var j=function(){var a=b?M[b]:M[f];if(z=0,h&&!a){var c=x.get(s);if(a=M[c],d&&d.length){var e=A(d,c);z=0===e?1:0,A(d,b)<0&&d.push(b)}}return a}();return j?j.then(function(){Z(a,c,e).then(i.resolve,i.reject)},i.reject):Z(a,c,e).then(i.resolve,i.reject),i.promise},O=function(a){return n&&(a=[n,a].join(" ")),o&&(a=[a,o].join(" ")),a},P=function(a){f=a,i.$emit("$translateChangeSuccess",{language:a}),h&&x.set(N.storageKey(),f),J.setLocale(f),angular.forEach(L,function(a,b){L[b].setLocale(f)}),i.$emit("$translateChangeEnd",{language:a})},Q=function(a){if(!a)throw"No language key specified for loading.";var b=r.defer();i.$emit("$translateLoadingStart",{language:a}),K=!0;var d=p;"string"==typeof d&&(d=c.get(d));var e=angular.extend({},m,{key:a,$http:angular.extend({},{cache:d},m.$http)});return c.get(l)(e).then(function(c){var d={};i.$emit("$translateLoadingSuccess",{language:a}),angular.isArray(c)?angular.forEach(c,function(a){angular.extend(d,E(a))}):angular.extend(d,E(c)),K=!1,b.resolve({key:a,table:d}),i.$emit("$translateLoadingEnd",{language:a})},function(a){i.$emit("$translateLoadingError",{language:a}),b.reject(a),i.$emit("$translateLoadingEnd",{language:a})}),b.promise};if(h&&(x=c.get(h),!x.get||!x.set))throw new Error("Couldn't use storage '"+h+"', missing get() or set() method!");angular.isFunction(J.useSanitizeValueStrategy)&&J.useSanitizeValueStrategy(u),t.length&&angular.forEach(t,function(a){var d=c.get(a);d.setLocale(b||f),angular.isFunction(d.useSanitizeValueStrategy)&&d.useSanitizeValueStrategy(u),L[d.getInterpolationIdentifier()]=d});var R=function(a){var b=r.defer();return Object.prototype.hasOwnProperty.call(q,a)?b.resolve(q[a]):M[a]?M[a].then(function(a){D(a.key,a.table),b.resolve(a.table)},b.reject):b.reject(),b.promise},S=function(a,b,c,d){var e=r.defer();return R(a).then(function(g){Object.prototype.hasOwnProperty.call(g,b)?(d.setLocale(a),e.resolve(d.interpolate(g[b],c)),d.setLocale(f)):e.reject()},e.reject),e.promise},T=function(a,b,c,d){var e,g=q[a];return Object.prototype.hasOwnProperty.call(g,b)&&(d.setLocale(a),e=d.interpolate(g[b],c),d.setLocale(f)),e},U=function(a){if(j){var b=c.get(j)(a,f);return void 0!==b?b:a}return a},V=function(a,b,c,e){var f=r.defer();if(a<d.length){var g=d[a];S(g,b,c,e).then(f.resolve,function(){V(a+1,b,c,e).then(f.resolve)})}else f.resolve(U(b));return f.promise},W=function(a,b,c,e){var f;if(a<d.length){var g=d[a];f=T(g,b,c,e),f||(f=W(a+1,b,c,e))}return f},X=function(a,b,c){return V(I>0?I:z,a,b,c)},Y=function(a,b,c){return W(I>0?I:z,a,b,c)},Z=function(a,b,c){var e=r.defer(),g=f?q[f]:q,h=c?L[c]:J;if(g&&Object.prototype.hasOwnProperty.call(g,a)){var i=g[a];"@:"===i.substr(0,2)?N(i.substr(2),b,c).then(e.resolve,e.reject):e.resolve(h.interpolate(i,b))}else{var k;j&&!K&&(k=U(a)),f&&d&&d.length?X(a,b,h).then(function(a){e.resolve(a)},function(a){e.reject(O(a))}):j&&!K&&k?e.resolve(k):e.reject(O(a))}return e.promise},$=function(a,b,c){var e,g=f?q[f]:q,h=c?L[c]:J;if(g&&Object.prototype.hasOwnProperty.call(g,a)){var i=g[a];e="@:"===i.substr(0,2)?$(i.substr(2),b,c):h.interpolate(i,b)}else{var k;j&&!K&&(k=U(a)),f&&d&&d.length?(z=0,e=Y(a,b,h)):e=j&&!K&&k?k:O(a)}return e};if(N.preferredLanguage=function(a){return a&&F(a),b},N.cloakClassName=function(){return v},N.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(G(a),l&&d&&d.length)for(var b=0,c=d.length;c>b;b++)M[d[b]]||(M[d[b]]=Q(d[b]));N.use(N.use())}return e?d[0]:d},N.useFallbackLanguage=function(a){if(void 0!==a&&null!==a)if(a){var b=A(d,a);b>-1&&(I=b)}else I=0},N.proposedLanguage=function(){return g},N.storage=function(){return x},N.use=function(a){if(!a)return f;var b=r.defer();i.$emit("$translateChangeStart",{language:a});var c=C(a);return c&&(a=c),q[a]||!l||M[a]?(b.resolve(a),P(a)):(g=a,M[a]=Q(a).then(function(c){D(c.key,c.table),b.resolve(c.key),P(c.key),g===a&&(g=void 0)},function(a){g===a&&(g=void 0),i.$emit("$translateChangeError",{language:a}),b.reject(a),i.$emit("$translateChangeEnd",{language:a})})),b.promise},N.storageKey=function(){return H()},N.isPostCompilingEnabled=function(){return w},N.refresh=function(a){function b(){e.resolve(),i.$emit("$translateRefreshEnd",{language:a})}function c(){e.reject(),i.$emit("$translateRefreshEnd",{language:a})}if(!l)throw new Error("Couldn't refresh translation table, no loader registered!");var e=r.defer();if(i.$emit("$translateRefreshStart",{language:a}),a)q[a]?Q(a).then(function(c){D(c.key,c.table),a===f&&P(f),b()},c):c();else{var g=[],h={};if(d&&d.length)for(var j=0,k=d.length;k>j;j++)g.push(Q(d[j])),h[d[j]]=!0;f&&!h[f]&&g.push(Q(f)),r.all(g).then(function(a){angular.forEach(a,function(a){q[a.key]&&delete q[a.key],D(a.key,a.table)}),f&&P(f),b()})}return e.promise},N.instant=function(a,c,e){if(null===a||angular.isUndefined(a))return a;if(angular.isArray(a)){for(var g={},h=0,i=a.length;i>h;h++)g[a[h]]=N.instant(a[h],c,e);return g}if(angular.isString(a)&&a.length<1)return a;a&&(a=B.apply(a));var k,l=[];b&&l.push(b),f&&l.push(f),d&&d.length&&(l=l.concat(d));for(var m=0,n=l.length;n>m;m++){var o=l[m];if(q[o]&&"undefined"!=typeof q[o][a]&&(k=$(a,c,e)),"undefined"!=typeof k)break}return k||""===k||(k=J.interpolate(a,c),j&&!K&&(k=U(a))),k},N.versionInfo=function(){return y},N.loaderCache=function(){return p},l&&(angular.equals(q,{})&&N.use(N.use()),d&&d.length))for(var _=function(a){D(a.key,a.table),i.$emit("$translateChangeEnd",{language:a.key})},ab=0,bb=d.length;bb>ab;ab++)M[d[ab]]=Q(d[ab]).then(_);return N}]}]),angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",["$interpolate",function(a){var b,c={},d="default",e=null,f={escaped:function(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=angular.element("<div></div>").text(a[c]).html());return b}},g=function(a){var b;return b=angular.isFunction(f[e])?f[e](a):a};return c.setLocale=function(a){b=a},c.getInterpolationIdentifier=function(){return d},c.useSanitizeValueStrategy=function(a){return e=a,this},c.interpolate=function(b,c){return e&&(c=g(c)),a(b)(c||{})},c}]),angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",["$translate","$q","$interpolate","$compile","$parse","$rootScope",function(a,b,c,d,e,f){return{restrict:"AE",scope:!0,compile:function(b,g){var h=g.translateValues?g.translateValues:void 0,i=g.translateInterpolation?g.translateInterpolation:void 0,j=b[0].outerHTML.match(/translate-value-+/i),k="^(.*)("+c.startSymbol()+".*"+c.endSymbol()+")(.*)";return function(b,l,m){if(b.interpolateParams={},b.preText="",b.postText="",m.$observe("translate",function(a){if(angular.equals(a,"")||!angular.isDefined(a)){var d=l.text().match(k);angular.isArray(d)?(b.preText=d[1],b.postText=d[3],b.translationId=c(d[2])(b.$parent)):b.translationId=l.text().replace(/^\s+|\s+$/g,"")}else b.translationId=a}),m.$observe("translateDefault",function(a){b.defaultText=a}),h&&m.$observe("translateValues",function(a){a&&b.$parent.$watch(function(){angular.extend(b.interpolateParams,e(a)(b.$parent))})}),j){var n=function(a){m.$observe(a,function(c){b.interpolateParams[angular.lowercase(a.substr(14,1))+a.substr(15)]=c})};for(var o in m)Object.prototype.hasOwnProperty.call(m,o)&&"translateValue"===o.substr(0,14)&&"translateValues"!==o&&n(o)}var p=function(b,c,e){e||"undefined"==typeof c.defaultText||(b=c.defaultText),l.html(c.preText+b+c.postText);var f=a.isPostCompilingEnabled(),h="undefined"!=typeof g.translateCompile,i=h&&"false"!==g.translateCompile;(f&&!h||i)&&d(l.contents())(c)},q=function(){return h||j?function(){var c=function(){b.translationId&&b.interpolateParams&&a(b.translationId,b.interpolateParams,i).then(function(a){p(a,b,!0)},function(a){p(a,b,!1)})};b.$watch("interpolateParams",c,!0),b.$watch("translationId",c)}:function(){var c=b.$watch("translationId",function(d){b.translationId&&d&&a(d,{},i).then(function(a){p(a,b,!0),c()},function(a){p(a,b,!1),c()})},!0)}}(),r=f.$on("$translateChangeSuccess",q);q(),b.$on("$destroy",r)}}}}]),angular.module("pascalprecht.translate").directive("translateCloak",["$rootScope","$translate",function(a,b){return{compile:function(c){var d=a.$on("$translateChangeEnd",function(){c.removeClass(b.cloakClassName()),d(),d=null});c.addClass(b.cloakClassName())}}}]),angular.module("pascalprecht.translate").filter("translate",["$parse","$translate",function(a,b){var c=function(c,d,e){return angular.isObject(d)||(d=a(d)(this)),b.instant(c,d,e)};return c.$stateful=!0,c}]); |
{ | ||
"name": "angular-translate", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "A translation module for AngularJS", | ||
@@ -31,2 +31,3 @@ "main": "dist/angular-translate.js", | ||
"grunt-bump": "0.0.2", | ||
"grunt-conventional-changelog": "~1.1.0", | ||
"grunt-express": "~0.3.3", | ||
@@ -39,5 +40,4 @@ "grunt-contrib-copy": "~0.4.1", | ||
"grunt-ngdocs": "~0.1.11", | ||
"grunt-conventional-changelog": "~1.1.0", | ||
"grunt-version": "~0.3.0" | ||
} | ||
} |
@@ -12,8 +12,5 @@ # [![angular-translate](https://raw.github.com/angular-translate/angular-translate/canary/identity/logo/angular-translate-alternative/angular-translate_alternative_medium2.png)](http://angular-translate.github.io) | ||
### Presentation (Dutch AngularJS Meetup 2013) | ||
### Presentation | ||
[![angular-translate Talk](presentation.png)](https://www.youtube.com/watch?v=9CWifOK_Wi8) | ||
### Presentation (Kod.io 2014) | ||
[![angular-translate Talk](presentation2.png)](https://www.youtube.com/watch?v=C7xqaExvaQ4) | ||
### Links | ||
@@ -20,0 +17,0 @@ * Website [http://angular-translate.github.io](http://angular-translate.github.io/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43290
0
86187
21
1374
39