Comparing version 4.5.0 to 4.6.0
@@ -0,1 +1,11 @@ | ||
<a name="4.6.0"></a> | ||
# [4.6.0](https://github.com/kazupon/vue-i18n/compare/v4.5.0...v4.6.0) (2016-09-24) | ||
### :star: New Features | ||
* **config:** custom message formatter ([#57](https://github.com/kazupon/vue-i18n/issues/57)) by [@jvmccarthy](https://github.com/jvmccarthy) ([2748eb4](https://github.com/kazupon/vue-i18n/commit/2748eb4)) | ||
<a name="4.5.0"></a> | ||
@@ -2,0 +12,0 @@ # [4.5.0](https://github.com/kazupon/vue-i18n/compare/v4.4.1...v4.5.0) (2016-09-15) |
/*! | ||
* vue-i18n v4.5.0 | ||
* vue-i18n v4.6.0 | ||
* (c) 2016 kazuya kawaguchi | ||
@@ -206,2 +206,3 @@ * Released under the MIT License. | ||
var missingHandler = null; // missing handler | ||
var i18nFormatter = null; // custom formatter | ||
@@ -262,2 +263,14 @@ function Config (Vue, langVM, lang) { | ||
}); | ||
// define Vue.config.i18Formatter configration | ||
Object.defineProperty(Vue.config, 'i18nFormatter', { | ||
enumerable: true, | ||
configurable: true, | ||
get: function get() { | ||
return i18nFormatter; | ||
}, | ||
set: function set(val) { | ||
i18nFormatter = val; | ||
} | ||
}); | ||
} | ||
@@ -751,3 +764,3 @@ | ||
return args ? format(val, args) : val; | ||
return !args ? val : Vue.config.i18nFormatter ? Vue.config.i18nFormatter.apply(null, [val].concat(args)) : format(val, args); | ||
} | ||
@@ -949,3 +962,3 @@ | ||
plugin.version = '4.5.0'; | ||
plugin.version = '4.6.0'; | ||
@@ -952,0 +965,0 @@ if (typeof window !== 'undefined' && window.Vue) { |
/*! | ||
* vue-i18n v4.5.0 | ||
* vue-i18n v4.6.0 | ||
* (c) 2016 kazuya kawaguchi | ||
@@ -210,2 +210,3 @@ * Released under the MIT License. | ||
var missingHandler = null; // missing handler | ||
var i18nFormatter = null; // custom formatter | ||
@@ -266,2 +267,14 @@ function Config (Vue, langVM, lang) { | ||
}); | ||
// define Vue.config.i18Formatter configration | ||
Object.defineProperty(Vue.config, 'i18nFormatter', { | ||
enumerable: true, | ||
configurable: true, | ||
get: function get() { | ||
return i18nFormatter; | ||
}, | ||
set: function set(val) { | ||
i18nFormatter = val; | ||
} | ||
}); | ||
} | ||
@@ -755,3 +768,3 @@ | ||
return args ? format(val, args) : val; | ||
return !args ? val : Vue.config.i18nFormatter ? Vue.config.i18nFormatter.apply(null, [val].concat(args)) : format(val, args); | ||
} | ||
@@ -953,3 +966,3 @@ | ||
plugin.version = '4.5.0'; | ||
plugin.version = '4.6.0'; | ||
@@ -956,0 +969,0 @@ if (typeof window !== 'undefined' && window.Vue) { |
/*! | ||
* vue-i18n v4.5.0 | ||
* vue-i18n v4.6.0 | ||
* (c) 2016 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.VueI18n=t()}(this,function(){"use strict";function n(n,t){window.console&&(console.warn("[vue-i18n] "+n),t&&console.warn(t.stack))}function t(t){t.locale=function(t,r,i){return void 0===r?m[t]:void(null===r?(m[t]=void 0,delete m[t]):e(t,r,function(e){e?m[t]=e:n("failed set `"+t+"` locale"),i&&i()}))}}function e(n,t,e){var i=this;"object"===("undefined"==typeof t?"undefined":w["typeof"](t))?e(t):!function(){var n=t.call(i);"function"==typeof n?n.resolved?e(n.resolved):n.requested?n.pendingCallbacks.push(e):!function(){n.requested=!0;var t=n.pendingCallbacks=[e];n(function(e){n.resolved=e;for(var r=0,i=t.length;i>r;r++)t[r](e)},function(){e()})}():r(n)&&n.then(function(n){e(n)},function(){e()})["catch"](function(n){console.error(n),e()})}()}function r(n){return n&&"function"==typeof n.then}function i(n,t,e){function r(n){if(e>1)n.$forceUpdate();else for(var t=n._watchers.length;t--;)n._watchers[t].update(!0)}var i=n.prototype._init;n.prototype._init=function(n){var e=this;i.call(this,n),this.$parent||(this.$lang=t,this._langUnwatch=this.$lang.$watch("lang",function(n,t){r(e)}))};var o=n.prototype._destroy;n.prototype._destroy=function(){!this.$parent&&this._langUnwatch&&(this._langUnwatch(),this._langUnwatch=null,this.$lang=null),o.apply(this,arguments)}}function o(n){if(!_){var t=n.$watch("__watcher__",function(n){});_=n._watchers[0].constructor,t()}return _}function u(n){return A||(A=n._data.__ob__.dep.constructor),A}function a(n,t,e){function r(n,t){var e=new a(t,n,null,{lazy:!0});return function(){return e.dirty&&e.evaluate(),c.target&&e.depend(),e.value}}var i=n.util.bind,a=o(t),c=u(t);Object.defineProperty(n.config,"lang",{enumerable:!0,configurable:!0,get:r(function(){return t.lang},t),set:i(function(n){t.lang=n},t)}),$=e,Object.defineProperty(n.config,"fallbackLang",{enumerable:!0,configurable:!0,get:function(){return $},set:function(n){$=n}}),Object.defineProperty(n.config,"missingHandler",{enumerable:!0,configurable:!0,get:function(){return O},set:function(n){O=n}})}function c(n){function t(n){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return 1===r.length&&"object"===w["typeof"](r[0])&&(r=r[0]),r&&r.hasOwnProperty||(r={}),n.replace(j,function(t,i,o,u){var a=void 0;return"{"===n[u-1]&&"}"===n[u+t.length]?o:(a=e(r,o)?r[o]:null,null===a||void 0===a?"":a)})}var e=n.util.hasOwn;return t}function f(n){return D.test(n)}function l(n){var t=n.charCodeAt(0),e=n.charCodeAt(n.length-1);return t!==e||34!==t&&39!==t?n:n.slice(1,-1)}function s(n){if(void 0===n)return"eof";var t=n.charCodeAt(0);switch(t){case 91:case 93:case 46:case 34:case 39:case 48:return n;case 95:case 36:case 45:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return t>=97&&122>=t||t>=65&&90>=t?"ident":t>=49&&57>=t?"number":"else"}function d(n){var t=n.trim();return"0"===n.charAt(0)&&isNaN(n)?!1:f(t)?l(t):"*"+t}function v(n){function t(){var t=n[r+1];return i===z&&"'"===t||i===L&&'"'===t?(r++,a="\\"+t,g[C](),!0):void 0}var e=[],r=-1,i=x,o=0,u=void 0,a=void 0,c=void 0,f=void 0,l=void 0,v=void 0,p=void 0,g=[];for(g[P]=function(){void 0!==c&&(e.push(c),c=void 0)},g[C]=function(){void 0===c?c=a:c+=a},g[U]=function(){g[C](),o++},g[S]=function(){if(o>0)o--,i=q,g[C]();else{if(o=0,c=d(c),c===!1)return!1;g[P]()}};null!=i;)if(r++,u=n[r],"\\"!==u||!t()){if(f=s(u),p=B[i],l=p[f]||p["else"]||Z,l===Z)return;if(i=l[0],v=g[l[1]],v&&(a=l[2],a=void 0===a?u:a,v()===!1))return;if(i===I)return e.raw=n,e}}function p(n){var t=k[n];return t||(t=v(n),t&&(k[n]=t)),t}function g(n){function t(n){if(null===n||void 0===n)return!0;if(Array.isArray(n)){if(n.length>0)return!1;if(0===n.length)return!0}else if(o(n))for(var t in n)if(u(n,t))return!1;return!0}function e(n,e){if(!i(n))return null;var r=p(e);if(t(r))return null;for(var o=r.length,u=null,a=n,c=0;o>c;){var f=a[r[c]];if(void 0===f){a=null;break}a=f,c++}return u=a}var r=n.util,i=r.isObject,o=r.isPlainObject,u=r.hasOwn;return e}function h(n){function t(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];var i=n.config.lang,o=n.config.fallbackLang;return 1===e.length?l(e[0])||Array.isArray(e[0])?e=e[0]:"string"==typeof e[0]&&(i=e[0]):2===e.length&&("string"==typeof e[0]&&(i=e[0]),(l(e[1])||Array.isArray(e[1]))&&(e=e[1])),{lang:i,fallback:o,params:e}}function e(n,t,r){if(!n)return null;var i=v(n,t)||n[t];if(!i)return null;if(i.indexOf("@:")>=0){var o=i.match(/(@:[\w|\.]+)/g);for(var u in o){var a=o[u],c=a.substr(2),f=e(n,c,r);i=i.replace(a,f)}}return r?d(i,r):i}function r(n,t,r,i,o){var u=null;return(u=e(n(t),i,o))?u:(u=e(n(r),i,o),u?u:null)}function i(t,e,r){return n.config.missingHandler&&n.config.missingHandler.apply(null,[t,e,r]),e}function o(t){return n.locale(t)}function u(n){return this.$options.locales[n]}function a(n,t){if(!n&&"string"!=typeof n)return null;var e=n.split("|");return t-=1,e[t]?e[t].trim():n}var f=n.util,l=f.isObject,s=f.bind,d=c(n),v=g(n);return n.t=function(n){for(var e=arguments.length,u=Array(e>1?e-1:0),a=1;e>a;a++)u[a-1]=arguments[a];if(!n)return"";var c=t.apply(void 0,u),f=c.lang,l=c.fallback,s=c.params;return r(o,f,l,n,s)||i(f,n,null)},n.tc=function(t,e){for(var r=arguments.length,i=Array(r>2?r-2:0),o=2;r>o;o++)i[o-2]=arguments[o];return e||(e=1),a(n.t.apply(n,[t].concat(i)),e)},n.prototype.$t=function(n){if(!n)return"";for(var e=arguments.length,a=Array(e>1?e-1:0),c=1;e>c;c++)a[c-1]=arguments[c];var f=t.apply(void 0,a),l=f.lang,d=f.fallback,v=f.params,p=null;return this.$options.locales&&(p=r(s(u,this),l,d,n,v))?p:r(o,l,d,n,v)||i(l,n,this)},n.prototype.$tc=function(n,t){if("number"!=typeof t&&"undefined"!=typeof t)return n;t||(t=1);for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;e>i;i++)r[i-2]=arguments[i];return a(this.$t.apply(this,[n].concat(r)),t)},n}function y(n){var e=(arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n.version&&Number(n.version.split(".")[0])||-1),r="en";b(n,r),t(n),i(n,E,e),a(n,E,r),h(n)}function b(n,t){var e=n.config.silent;n.config.silent=!0,E||(E=new n({data:{lang:t}})),n.config.silent=e}var w={};w["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol?"symbol":typeof n};var m=Object.create(null),_=void 0,A=void 0,$=void 0,O=null,j=/(%|)\{([0-9a-zA-Z_]+)\}/g,k=Object.create(null),C=0,P=1,U=2,S=3,x=0,H=1,N=2,V=3,q=4,z=5,L=6,I=7,Z=8,B=[];B[x]={ws:[x],ident:[V,C],"[":[q],eof:[I]},B[H]={ws:[H],".":[N],"[":[q],eof:[I]},B[N]={ws:[N],ident:[V,C]},B[V]={ident:[V,C],0:[V,C],number:[V,C],ws:[H,P],".":[N,P],"[":[q,P],eof:[I,P]},B[q]={"'":[z,C],'"':[L,C],"[":[q,U],"]":[H,S],eof:Z,"else":[q,C]},B[z]={"'":[q,C],eof:Z,"else":[z,C]},B[L]={'"':[q,C],eof:Z,"else":[L,C]};var D=/^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/,E=void 0;return y.version="4.5.0","undefined"!=typeof window&&window.Vue&&window.Vue.use(y),y}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.VueI18n=t()}(this,function(){"use strict";function n(n,t){window.console&&(console.warn("[vue-i18n] "+n),t&&console.warn(t.stack))}function t(t){t.locale=function(t,r,i){return void 0===r?m[t]:void(null===r?(m[t]=void 0,delete m[t]):e(t,r,function(e){e?m[t]=e:n("failed set `"+t+"` locale"),i&&i()}))}}function e(n,t,e){var i=this;"object"===("undefined"==typeof t?"undefined":w["typeof"](t))?e(t):!function(){var n=t.call(i);"function"==typeof n?n.resolved?e(n.resolved):n.requested?n.pendingCallbacks.push(e):!function(){n.requested=!0;var t=n.pendingCallbacks=[e];n(function(e){n.resolved=e;for(var r=0,i=t.length;i>r;r++)t[r](e)},function(){e()})}():r(n)&&n.then(function(n){e(n)},function(){e()})["catch"](function(n){console.error(n),e()})}()}function r(n){return n&&"function"==typeof n.then}function i(n,t,e){function r(n){if(e>1)n.$forceUpdate();else for(var t=n._watchers.length;t--;)n._watchers[t].update(!0)}var i=n.prototype._init;n.prototype._init=function(n){var e=this;i.call(this,n),this.$parent||(this.$lang=t,this._langUnwatch=this.$lang.$watch("lang",function(n,t){r(e)}))};var o=n.prototype._destroy;n.prototype._destroy=function(){!this.$parent&&this._langUnwatch&&(this._langUnwatch(),this._langUnwatch=null,this.$lang=null),o.apply(this,arguments)}}function o(n){if(!_){var t=n.$watch("__watcher__",function(n){});_=n._watchers[0].constructor,t()}return _}function u(n){return A||(A=n._data.__ob__.dep.constructor),A}function a(n,t,e){function r(n,t){var e=new a(t,n,null,{lazy:!0});return function(){return e.dirty&&e.evaluate(),c.target&&e.depend(),e.value}}var i=n.util.bind,a=o(t),c=u(t);Object.defineProperty(n.config,"lang",{enumerable:!0,configurable:!0,get:r(function(){return t.lang},t),set:i(function(n){t.lang=n},t)}),$=e,Object.defineProperty(n.config,"fallbackLang",{enumerable:!0,configurable:!0,get:function(){return $},set:function(n){$=n}}),Object.defineProperty(n.config,"missingHandler",{enumerable:!0,configurable:!0,get:function(){return O},set:function(n){O=n}}),Object.defineProperty(n.config,"i18nFormatter",{enumerable:!0,configurable:!0,get:function(){return j},set:function(n){j=n}})}function c(n){function t(n){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return 1===r.length&&"object"===w["typeof"](r[0])&&(r=r[0]),r&&r.hasOwnProperty||(r={}),n.replace(k,function(t,i,o,u){var a=void 0;return"{"===n[u-1]&&"}"===n[u+t.length]?o:(a=e(r,o)?r[o]:null,null===a||void 0===a?"":a)})}var e=n.util.hasOwn;return t}function f(n){return D.test(n)}function l(n){var t=n.charCodeAt(0),e=n.charCodeAt(n.length-1);return t!==e||34!==t&&39!==t?n:n.slice(1,-1)}function s(n){if(void 0===n)return"eof";var t=n.charCodeAt(0);switch(t){case 91:case 93:case 46:case 34:case 39:case 48:return n;case 95:case 36:case 45:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return t>=97&&122>=t||t>=65&&90>=t?"ident":t>=49&&57>=t?"number":"else"}function d(n){var t=n.trim();return"0"===n.charAt(0)&&isNaN(n)?!1:f(t)?l(t):"*"+t}function v(n){function t(){var t=n[r+1];return i===z&&"'"===t||i===L&&'"'===t?(r++,a="\\"+t,g[C](),!0):void 0}var e=[],r=-1,i=F,o=0,u=void 0,a=void 0,c=void 0,f=void 0,l=void 0,v=void 0,p=void 0,g=[];for(g[U]=function(){void 0!==c&&(e.push(c),c=void 0)},g[C]=function(){void 0===c?c=a:c+=a},g[S]=function(){g[C](),o++},g[x]=function(){if(o>0)o--,i=q,g[C]();else{if(o=0,c=d(c),c===!1)return!1;g[U]()}};null!=i;)if(r++,u=n[r],"\\"!==u||!t()){if(f=s(u),p=B[i],l=p[f]||p["else"]||Z,l===Z)return;if(i=l[0],v=g[l[1]],v&&(a=l[2],a=void 0===a?u:a,v()===!1))return;if(i===I)return e.raw=n,e}}function p(n){var t=P[n];return t||(t=v(n),t&&(P[n]=t)),t}function g(n){function t(n){if(null===n||void 0===n)return!0;if(Array.isArray(n)){if(n.length>0)return!1;if(0===n.length)return!0}else if(o(n))for(var t in n)if(u(n,t))return!1;return!0}function e(n,e){if(!i(n))return null;var r=p(e);if(t(r))return null;for(var o=r.length,u=null,a=n,c=0;o>c;){var f=a[r[c]];if(void 0===f){a=null;break}a=f,c++}return u=a}var r=n.util,i=r.isObject,o=r.isPlainObject,u=r.hasOwn;return e}function h(n){function t(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];var i=n.config.lang,o=n.config.fallbackLang;return 1===e.length?l(e[0])||Array.isArray(e[0])?e=e[0]:"string"==typeof e[0]&&(i=e[0]):2===e.length&&("string"==typeof e[0]&&(i=e[0]),(l(e[1])||Array.isArray(e[1]))&&(e=e[1])),{lang:i,fallback:o,params:e}}function e(t,r,i){if(!t)return null;var o=v(t,r)||t[r];if(!o)return null;if(o.indexOf("@:")>=0){var u=o.match(/(@:[\w|\.]+)/g);for(var a in u){var c=u[a],f=c.substr(2),l=e(t,f,i);o=o.replace(c,l)}}return i?n.config.i18nFormatter?n.config.i18nFormatter.apply(null,[o].concat(i)):d(o,i):o}function r(n,t,r,i,o){var u=null;return(u=e(n(t),i,o))?u:(u=e(n(r),i,o),u?u:null)}function i(t,e,r){return n.config.missingHandler&&n.config.missingHandler.apply(null,[t,e,r]),e}function o(t){return n.locale(t)}function u(n){return this.$options.locales[n]}function a(n,t){if(!n&&"string"!=typeof n)return null;var e=n.split("|");return t-=1,e[t]?e[t].trim():n}var f=n.util,l=f.isObject,s=f.bind,d=c(n),v=g(n);return n.t=function(n){for(var e=arguments.length,u=Array(e>1?e-1:0),a=1;e>a;a++)u[a-1]=arguments[a];if(!n)return"";var c=t.apply(void 0,u),f=c.lang,l=c.fallback,s=c.params;return r(o,f,l,n,s)||i(f,n,null)},n.tc=function(t,e){for(var r=arguments.length,i=Array(r>2?r-2:0),o=2;r>o;o++)i[o-2]=arguments[o];return e||(e=1),a(n.t.apply(n,[t].concat(i)),e)},n.prototype.$t=function(n){if(!n)return"";for(var e=arguments.length,a=Array(e>1?e-1:0),c=1;e>c;c++)a[c-1]=arguments[c];var f=t.apply(void 0,a),l=f.lang,d=f.fallback,v=f.params,p=null;return this.$options.locales&&(p=r(s(u,this),l,d,n,v))?p:r(o,l,d,n,v)||i(l,n,this)},n.prototype.$tc=function(n,t){if("number"!=typeof t&&"undefined"!=typeof t)return n;t||(t=1);for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;e>i;i++)r[i-2]=arguments[i];return a(this.$t.apply(this,[n].concat(r)),t)},n}function y(n){var e=(arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n.version&&Number(n.version.split(".")[0])||-1),r="en";b(n,r),t(n),i(n,E,e),a(n,E,r),h(n)}function b(n,t){var e=n.config.silent;n.config.silent=!0,E||(E=new n({data:{lang:t}})),n.config.silent=e}var w={};w["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol?"symbol":typeof n};var m=Object.create(null),_=void 0,A=void 0,$=void 0,O=null,j=null,k=/(%|)\{([0-9a-zA-Z_]+)\}/g,P=Object.create(null),C=0,U=1,S=2,x=3,F=0,H=1,N=2,V=3,q=4,z=5,L=6,I=7,Z=8,B=[];B[F]={ws:[F],ident:[V,C],"[":[q],eof:[I]},B[H]={ws:[H],".":[N],"[":[q],eof:[I]},B[N]={ws:[N],ident:[V,C]},B[V]={ident:[V,C],0:[V,C],number:[V,C],ws:[H,U],".":[N,U],"[":[q,U],eof:[I,U]},B[q]={"'":[z,C],'"':[L,C],"[":[q,S],"]":[H,x],eof:Z,"else":[q,C]},B[z]={"'":[q,C],eof:Z,"else":[z,C]},B[L]={'"':[q,C],eof:Z,"else":[L,C]};var D=/^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/,E=void 0;return y.version="4.6.0","undefined"!=typeof window&&window.Vue&&window.Vue.use(y),y}); |
{ | ||
"name": "vue-i18n", | ||
"description": "Internationalization plugin for Vue.js", | ||
"version": "4.5.0", | ||
"version": "4.6.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "kazuya kawaguchi", |
@@ -5,2 +5,3 @@ import { getWatcher, getDep } from './observer' | ||
let missingHandler = null // missing handler | ||
let i18nFormatter = null // custom formatter | ||
@@ -48,2 +49,10 @@ export default function (Vue, langVM, lang) { | ||
}) | ||
// define Vue.config.i18Formatter configration | ||
Object.defineProperty(Vue.config, 'i18nFormatter', { | ||
enumerable: true, | ||
configurable: true, | ||
get: () => { return i18nFormatter }, | ||
set: val => { i18nFormatter = val } | ||
}) | ||
} |
@@ -63,3 +63,7 @@ import warn from './warn' | ||
return args ? format(val, args) : val | ||
return !args | ||
? val | ||
: Vue.config.i18nFormatter | ||
? Vue.config.i18nFormatter.apply(null, [val].concat(args)) | ||
: format(val, args) | ||
} | ||
@@ -66,0 +70,0 @@ |
@@ -50,3 +50,3 @@ import warn from './warn' | ||
plugin.version = '4.5.0' | ||
plugin.version = '4.6.0' | ||
@@ -53,0 +53,0 @@ export default plugin |
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
82418
2374
53