Socket
Socket
Sign inDemoInstall

vue-i18n

Package Overview
Dependencies
Maintainers
1
Versions
353
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n - npm Package Compare versions

Comparing version 6.0.0-alpha.4 to 6.0.0-alpha.5

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="6.0.0-alpha.5"></a>
# [6.0.0-alpha.5](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.3...v6.0.0-alpha.5) (2017-03-11)
### :bug: Bug Fixes
* **mixin:** fix cannot create VueI18n instance error for minify production ([7eeb29f](https://github.com/kazupon/vue-i18n/commit/7eeb29f))
<a name="6.0.0-alpha.4"></a>

@@ -2,0 +12,0 @@ # [6.0.0-alpha.4](https://github.com/kazupon/vue-i18n/compare/v6.0.0-alpha.3...v6.0.0-alpha.4) (2017-03-11)

29

dist/vue-i18n.common.js
/*!
* vue-i18n v6.0.0-alpha.4
* vue-i18n v6.0.0-alpha.5
* (c) 2017 kazuya kawaguchi

@@ -40,23 +40,2 @@ * Released under the MIT License.

function funcName (f) {
if (f.name) { return f.name }
var match = /^\s*function\s*([^\(]*)/im.exec(f.toString());
return match ? match[1] : ''
}
function ctorName (obj) {
var str = toString.call(obj).slice(8, -1);
if ((str === 'Object' || str === 'Error') && obj.constructor) {
return funcName(obj.constructor)
}
return str
}
function typeName (val) {
if (val === null) { return 'null' }
var type = typeof val;
if (type === 'object') { return ctorName(val) }
return type
}
function isNull (val) {

@@ -177,7 +156,7 @@ return val === null || val === undefined

if (options.i18n) {
if (typeName(options.i18n) === 'VueI18n') {
if (options.i18n instanceof VueI18n) {
this.$i18n = options.i18n;
} else if (isPlainObject(options.i18n)) {
// component local i18n
if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
options.i18n.root = this.$root.$i18n;

@@ -194,3 +173,3 @@ }

}
} else if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
} else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
// root i18n

@@ -197,0 +176,0 @@ this.$i18n = this.$root.$i18n;

/*!
* vue-i18n v6.0.0-alpha.4
* vue-i18n v6.0.0-alpha.5
* (c) 2017 kazuya kawaguchi

@@ -44,23 +44,2 @@ * Released under the MIT License.

function funcName (f) {
if (f.name) { return f.name }
var match = /^\s*function\s*([^\(]*)/im.exec(f.toString());
return match ? match[1] : ''
}
function ctorName (obj) {
var str = toString.call(obj).slice(8, -1);
if ((str === 'Object' || str === 'Error') && obj.constructor) {
return funcName(obj.constructor)
}
return str
}
function typeName (val) {
if (val === null) { return 'null' }
var type = typeof val;
if (type === 'object') { return ctorName(val) }
return type
}
function isNull (val) {

@@ -181,7 +160,7 @@ return val === null || val === undefined

if (options.i18n) {
if (typeName(options.i18n) === 'VueI18n') {
if (options.i18n instanceof VueI18n) {
this.$i18n = options.i18n;
} else if (isPlainObject(options.i18n)) {
// component local i18n
if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
options.i18n.root = this.$root.$i18n;

@@ -198,3 +177,3 @@ }

}
} else if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
} else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
// root i18n

@@ -868,3 +847,3 @@ this.$i18n = this.$root.$i18n;

VueI18n.install = install;
VueI18n.version = '6.0.0-alpha.4';
VueI18n.version = '6.0.0-alpha.5';

@@ -871,0 +850,0 @@ if (typeof window !== 'undefined' && window.Vue) {

/*!
* vue-i18n v6.0.0-alpha.4
* vue-i18n v6.0.0-alpha.5
* (c) 2017 kazuya kawaguchi
* Released under the MIT License.
*/
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.VueI18n=n()}(this,function(){"use strict";function t(t,n){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),n&&console.warn(n.stack))}function n(t,n){return k.call(t,n)}function e(t){return null!==t&&"object"==typeof t}function r(t){return j.call(t)===A}function i(t){if(t.name)return t.name;var n=/^\s*function\s*([^\(]*)/im.exec(t.toString());return n?n[1]:""}function o(t){var n=j.call(t).slice(8,-1);return"Object"!==n&&"Error"!==n||!t.constructor?n:i(t.constructor)}function a(t){if(null===t)return"null";var n=typeof t;return"object"===n?o(t):n}function s(t){return null===t||void 0===t}function c(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=null,i=null;return 1===t.length?e(t[0])||Array.isArray(t[0])?i=t[0]:"string"==typeof t[0]&&(r=t[0]):2===t.length&&("string"==typeof t[0]&&(r=t[0]),(e(t[1])||Array.isArray(t[1]))&&(i=t[1])),{locale:r,params:i}}function l(t){return t?t>1?1:0:1}function u(t,n){return t=Math.abs(t),2===n?l(t):t?Math.min(t,2):0}function f(t,n){if(!t&&"string"!=typeof t)return null;var e=t.split("|");return n=u(n,e.length),e[n]?e[n].trim():t}function h(t){b=t;b.version&&Number(b.version.split(".")[0])||-1;h.installed=!0,b.mixin(L),V(b)}function p(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return e=1===e.length&&"object"==typeof e[0]?e[0]:{},e&&e.hasOwnProperty||(e={}),t.replace(I,function(r,i,o,a){var c;return"{"===t[a-1]&&"}"===t[a+r.length]?o:(c=n(e,o)?e[o]:r,s(c)?"":c)})}function v(t){return G.test(t)}function _(t){var n=t.charCodeAt(0),e=t.charCodeAt(t.length-1);return n!==e||34!==n&&39!==n?t:t.slice(1,-1)}function m(t){if(void 0===t||null===t)return"eof";var n=t.charCodeAt(0);switch(n){case 91:case 93:case 46:case 34:case 39:case 48:return t;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 n>=97&&n<=122||n>=65&&n<=90?"ident":n>=49&&n<=57?"number":"else"}function g(t){var n=t.trim();return("0"!==t.charAt(0)||!isNaN(t))&&(v(n)?_(n):"*"+n)}function d(t){function n(){var n=t[u+1];if(f===U&&"'"===n||f===z&&'"'===n)return u++,i="\\"+n,p[F](),!0}var e,r,i,o,a,s,c,l=[],u=-1,f=C,h=0,p=[];for(p[M]=function(){void 0!==r&&(l.push(r),r=void 0)},p[F]=function(){void 0===r?r=i:r+=i},p[R]=function(){p[F](),h++},p[S]=function(){if(h>0)h--,f=D,p[F]();else{if(h=0,r=g(r),r===!1)return!1;p[M]()}};null!==f;)if(u++,e=t[u],"\\"!==e||!n()){if(o=m(e),c=B[f],a=c[o]||c.else||q,a===q)return;if(f=a[0],s=p[a[1]],s&&(i=a[2],i=void 0===i?e:i,s()===!1))return;if(f===Z)return l}}function y(t){var n=E[t];return n||(n=d(t),n&&(E[t]=n)),n||[]}function $(t){if(null===t||void 0===t)return!0;if(Array.isArray(t)){if(t.length>0)return!1;if(0===t.length)return!0}else if(r(t))for(var e in t)if(n(t,e))return!1;return!0}function w(t,n){if(!e(t))return null;var r=y(n);if($(r))return null;for(var i=r.length,o=null,a=t,s=0;s<i;){var c=a[r[s]];if(void 0===c){a=null;break}a=c,s++}return o=a}var b,k=Object.prototype.hasOwnProperty,j=Object.prototype.toString,A="[object Object]",L={computed:{$t:function(){var t=this;if(!this.$i18n)throw Error("Failed in $t due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r){for(var i=[],o=arguments.length-1;o-- >0;)i[o]=arguments[o+1];return(a=t.$i18n)._t.apply(a,[r,n,e,t].concat(i));var a}},$tc:function(){var t=this;if(!this.$i18n)throw Error("Failed in $tc due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r,i){for(var o=[],a=arguments.length-2;a-- >0;)o[a]=arguments[a+2];return(s=t.$i18n)._tc.apply(s,[r,n,e,t,i].concat(o));var s}},$te:function(){var t=this;if(!this.$i18n)throw Error("Failed in $te due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r){for(var i=[],o=arguments.length-1;o-- >0;)i[o]=arguments[o+1];return(a=t.$i18n)._te.apply(a,[r,n,e].concat(i));var a}}},beforeCreate:function(){var t=this.$options;t.i18n?"VueI18n"===a(t.i18n)?this.$i18n=t.i18n:r(t.i18n)&&(this.$root&&this.$root.$i18n&&"VueI18n"===a(this.$root.$i18n)&&(t.i18n.root=this.$root.$i18n),this.$i18n=new H(t.i18n),t.i18n.sync&&(this._localeWatcher=this.$i18n.watchLocale())):this.$root&&this.$root.$i18n&&"VueI18n"===a(this.$root.$i18n)&&(this.$i18n=this.$root.$i18n)},destroyed:function(){this._localeWatcher&&(this.$i18n.unwatchLocale(),delete this._localeWatcher),this.$i18n=null}},V=function(t){var n=t.config.optionMergeStrategies;n&&(n.i18n=function(n,e){var r=Object.create(null);if(!e)return n;if(!n)return e;if(!e&!n)return r;t.util.extend(r,n);for(var i in e)r[i]=e[i];return r})},O=function(t){void 0===t&&(t={}),this._options=t},x={options:{}};x.options.get=function(){return this._options},O.prototype.format=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return p.apply(void 0,[t].concat(n))},Object.defineProperties(O.prototype,x);var I=/(%|)\{([0-9a-zA-Z_]+)\}/g,E=Object.create(null),F=0,M=1,R=2,S=3,C=0,P=1,N=2,W=3,D=4,U=5,z=6,Z=7,q=8,B=[];B[C]={ws:[C],ident:[W,F],"[":[D],eof:[Z]},B[P]={ws:[P],".":[N],"[":[D],eof:[Z]},B[N]={ws:[N],ident:[W,F],0:[W,F],number:[W,F]},B[W]={ident:[W,F],0:[W,F],number:[W,F],ws:[P,M],".":[N,M],"[":[D,M],eof:[Z,M]},B[D]={"'":[U,F],'"':[z,F],"[":[D,R],"]":[P,S],eof:q,else:[D,F]},B[U]={"'":[D,F],eof:q,else:[U,F]},B[z]={'"':[D,F],eof:q,else:[z,F]};var G=/^\s?(true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/,H=function(t){void 0===t&&(t={});var n=t.locale||"en-US",e=t.messages||{};this._vm=null,this._fallbackLocale=t.fallbackLocale||"en-US",this._formatter=t.formatter||new O,this._missing=t.missing,this._root=t.root||null,this._sync=t.sync||!1,this._fallbackRoot=t.fallbackRoot||!1,this._exist=function(t,n){return!(!t||!n)&&!s(w(t,n))},this._resetVM({locale:n,messages:e})},J={vm:{},messages:{},locale:{},fallbackLocale:{},missing:{},formatter:{}};return H.prototype._resetVM=function(t){var n=b.config.silent;b.config.silent=!0,this._vm=new b({data:t}),b.config.silent=n},H.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._watcher=this._root.vm.$watch("locale",function(n){t.$set(t,"locale",n)},{immediate:!0}),this._watcher},H.prototype.unwatchLocale=function(){return!(!this._sync||!this._watcher)&&(this._watcher&&(this._watcher(),delete this._watcher),!0)},J.vm.get=function(){return this._vm},J.messages.get=function(){return this._vm.$data.messages},J.messages.set=function(t){this._vm.$set(this._vm,"messages",t)},J.locale.get=function(){return this._vm.$data.locale},J.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},J.fallbackLocale.get=function(){return this._fallbackLocale},J.fallbackLocale.set=function(t){this._fallbackLocale=t},J.missing.get=function(){return this._missing},J.missing.set=function(t){this._missing=t},J.formatter.get=function(){return this._formatter},J.formatter.set=function(t){this._formatter=t},H.prototype._warnDefault=function(t,n,e,r){return s(e)?(this.missing&&this.missing.apply(null,[t,n,r]),n):e},H.prototype._isFallbackRoot=function(t){return!t&&!s(this._root)&&this._fallbackRoot},H.prototype._interpolate=function(n,e,r){var i=this;if(!n)return null;var o=w(n,e);if(Array.isArray(o))return o;if(s(o)&&(o=n[e]),s(o))return null;if("string"!=typeof o)return t("Value of key '"+e+"' is not a string!"),null;if(o.indexOf("@:")>=0){var a=o.match(/(@:[\w|.]+)/g);for(var c in a){var l=a[c],u=l.substr(2),f=i._interpolate(n,u,r);o=o.replace(l,f)}}return r?this._format(o,r):o},H.prototype._format=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this._formatter).format.apply(r,[t].concat(n));var r},H.prototype._translate=function(t,n,e,r,i){var o=null;return o=this._interpolate(t[n],r,i),s(o)?(o=this._interpolate(t[e],r,i),s(o)?null:o):o},H.prototype._t=function(t,n,e,r){for(var i=[],o=arguments.length-4;o-- >0;)i[o]=arguments[o+4];if(!t)return"";var a=c.apply(void 0,i),s=a.locale||n,l=this._translate(e,s,this.fallbackLocale,t,a.params);if(this._isFallbackRoot(l)){if(!this._root)throw Error("unexpected error");return(u=this._root).t.apply(u,[t].concat(i))}return this._warnDefault(s,t,l,r);var u},H.prototype.t=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this)._t.apply(r,[t,this.locale,this.messages,null].concat(n));var r},H.prototype._tc=function(t,n,e,r,i){for(var o=[],a=arguments.length-5;a-- >0;)o[a]=arguments[a+5];return t?void 0!==i?f((s=this)._t.apply(s,[t,n,e,r].concat(o)),i):(c=this)._t.apply(c,[t,n,e,r].concat(o)):"";var s,c},H.prototype.tc=function(t,n){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return(i=this)._tc.apply(i,[t,this.locale,this.messages,null,n].concat(e));var i},H.prototype._te=function(t,n,e){for(var r=[],i=arguments.length-3;i-- >0;)r[i]=arguments[i+3];var o=c.apply(void 0,r).locale||n;return this._exist(e[o],t)},H.prototype.te=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this)._te.apply(r,[t,this.locale,this.messages].concat(n));var r},Object.defineProperties(H.prototype,J),H.install=h,H.version="6.0.0-alpha.4","undefined"!=typeof window&&window.Vue&&window.Vue.use(H),H});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.VueI18n=n()}(this,function(){"use strict";function t(t,n){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),n&&console.warn(n.stack))}function n(t,n){return $.call(t,n)}function e(t){return null!==t&&"object"==typeof t}function r(t){return w.call(t)===b}function i(t){return null===t||void 0===t}function o(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=null,i=null;return 1===t.length?e(t[0])||Array.isArray(t[0])?i=t[0]:"string"==typeof t[0]&&(r=t[0]):2===t.length&&("string"==typeof t[0]&&(r=t[0]),(e(t[1])||Array.isArray(t[1]))&&(i=t[1])),{locale:r,params:i}}function a(t){return t?t>1?1:0:1}function s(t,n){return t=Math.abs(t),2===n?a(t):t?Math.min(t,2):0}function c(t,n){if(!t&&"string"!=typeof t)return null;var e=t.split("|");return n=s(n,e.length),e[n]?e[n].trim():t}function l(t){y=t;y.version&&Number(y.version.split(".")[0])||-1;l.installed=!0,y.mixin(k),A(y)}function u(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];return e=1===e.length&&"object"==typeof e[0]?e[0]:{},e&&e.hasOwnProperty||(e={}),t.replace(O,function(r,o,a,s){var c;return"{"===t[s-1]&&"}"===t[s+r.length]?a:(c=n(e,a)?e[a]:r,i(c)?"":c)})}function f(t){return Z.test(t)}function h(t){var n=t.charCodeAt(0),e=t.charCodeAt(t.length-1);return n!==e||34!==n&&39!==n?t:t.slice(1,-1)}function p(t){if(void 0===t||null===t)return"eof";var n=t.charCodeAt(0);switch(n){case 91:case 93:case 46:case 34:case 39:case 48:return t;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 n>=97&&n<=122||n>=65&&n<=90?"ident":n>=49&&n<=57?"number":"else"}function v(t){var n=t.trim();return("0"!==t.charAt(0)||!isNaN(t))&&(f(n)?h(n):"*"+n)}function _(t){function n(){var n=t[u+1];if(f===N&&"'"===n||f===W&&'"'===n)return u++,i="\\"+n,_[x](),!0}var e,r,i,o,a,s,c,l=[],u=-1,f=C,h=0,_=[];for(_[F]=function(){void 0!==r&&(l.push(r),r=void 0)},_[x]=function(){void 0===r?r=i:r+=i},_[M]=function(){_[x](),h++},_[R]=function(){if(h>0)h--,f=S,_[x]();else{if(h=0,r=v(r),r===!1)return!1;_[F]()}};null!==f;)if(u++,e=t[u],"\\"!==e||!n()){if(o=p(e),c=z[f],a=c[o]||c.else||U,a===U)return;if(f=a[0],s=_[a[1]],s&&(i=a[2],i=void 0===i?e:i,s()===!1))return;if(f===D)return l}}function g(t){var n=V[t];return n||(n=_(t),n&&(V[t]=n)),n||[]}function m(t){if(null===t||void 0===t)return!0;if(Array.isArray(t)){if(t.length>0)return!1;if(0===t.length)return!0}else if(r(t))for(var e in t)if(n(t,e))return!1;return!0}function d(t,n){if(!e(t))return null;var r=g(n);if(m(r))return null;for(var i=r.length,o=null,a=t,s=0;s<i;){var c=a[r[s]];if(void 0===c){a=null;break}a=c,s++}return o=a}var y,$=Object.prototype.hasOwnProperty,w=Object.prototype.toString,b="[object Object]",k={computed:{$t:function(){var t=this;if(!this.$i18n)throw Error("Failed in $t due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r){for(var i=[],o=arguments.length-1;o-- >0;)i[o]=arguments[o+1];return(a=t.$i18n)._t.apply(a,[r,n,e,t].concat(i));var a}},$tc:function(){var t=this;if(!this.$i18n)throw Error("Failed in $tc due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r,i){for(var o=[],a=arguments.length-2;a-- >0;)o[a]=arguments[a+2];return(s=t.$i18n)._tc.apply(s,[r,n,e,t,i].concat(o));var s}},$te:function(){var t=this;if(!this.$i18n)throw Error("Failed in $te due to not find VueI18n instance");var n=this.$i18n.locale,e=this.$i18n.messages;return function(r){for(var i=[],o=arguments.length-1;o-- >0;)i[o]=arguments[o+1];return(a=t.$i18n)._te.apply(a,[r,n,e].concat(i));var a}}},beforeCreate:function(){var t=this.$options;t.i18n?t.i18n instanceof q?this.$i18n=t.i18n:r(t.i18n)&&(this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof q&&(t.i18n.root=this.$root.$i18n),this.$i18n=new q(t.i18n),t.i18n.sync&&(this._localeWatcher=this.$i18n.watchLocale())):this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof q&&(this.$i18n=this.$root.$i18n)},destroyed:function(){this._localeWatcher&&(this.$i18n.unwatchLocale(),delete this._localeWatcher),this.$i18n=null}},A=function(t){var n=t.config.optionMergeStrategies;n&&(n.i18n=function(n,e){var r=Object.create(null);if(!e)return n;if(!n)return e;if(!e&!n)return r;t.util.extend(r,n);for(var i in e)r[i]=e[i];return r})},L=function(t){void 0===t&&(t={}),this._options=t},j={options:{}};j.options.get=function(){return this._options},L.prototype.format=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return u.apply(void 0,[t].concat(n))},Object.defineProperties(L.prototype,j);var O=/(%|)\{([0-9a-zA-Z_]+)\}/g,V=Object.create(null),x=0,F=1,M=2,R=3,C=0,E=1,I=2,P=3,S=4,N=5,W=6,D=7,U=8,z=[];z[C]={ws:[C],ident:[P,x],"[":[S],eof:[D]},z[E]={ws:[E],".":[I],"[":[S],eof:[D]},z[I]={ws:[I],ident:[P,x],0:[P,x],number:[P,x]},z[P]={ident:[P,x],0:[P,x],number:[P,x],ws:[E,F],".":[I,F],"[":[S,F],eof:[D,F]},z[S]={"'":[N,x],'"':[W,x],"[":[S,M],"]":[E,R],eof:U,else:[S,x]},z[N]={"'":[S,x],eof:U,else:[N,x]},z[W]={'"':[S,x],eof:U,else:[W,x]};var Z=/^\s?(true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/,q=function(t){void 0===t&&(t={});var n=t.locale||"en-US",e=t.messages||{};this._vm=null,this._fallbackLocale=t.fallbackLocale||"en-US",this._formatter=t.formatter||new L,this._missing=t.missing,this._root=t.root||null,this._sync=t.sync||!1,this._fallbackRoot=t.fallbackRoot||!1,this._exist=function(t,n){return!(!t||!n)&&!i(d(t,n))},this._resetVM({locale:n,messages:e})},B={vm:{},messages:{},locale:{},fallbackLocale:{},missing:{},formatter:{}};return q.prototype._resetVM=function(t){var n=y.config.silent;y.config.silent=!0,this._vm=new y({data:t}),y.config.silent=n},q.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._watcher=this._root.vm.$watch("locale",function(n){t.$set(t,"locale",n)},{immediate:!0}),this._watcher},q.prototype.unwatchLocale=function(){return!(!this._sync||!this._watcher)&&(this._watcher&&(this._watcher(),delete this._watcher),!0)},B.vm.get=function(){return this._vm},B.messages.get=function(){return this._vm.$data.messages},B.messages.set=function(t){this._vm.$set(this._vm,"messages",t)},B.locale.get=function(){return this._vm.$data.locale},B.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},B.fallbackLocale.get=function(){return this._fallbackLocale},B.fallbackLocale.set=function(t){this._fallbackLocale=t},B.missing.get=function(){return this._missing},B.missing.set=function(t){this._missing=t},B.formatter.get=function(){return this._formatter},B.formatter.set=function(t){this._formatter=t},q.prototype._warnDefault=function(t,n,e,r){return i(e)?(this.missing&&this.missing.apply(null,[t,n,r]),n):e},q.prototype._isFallbackRoot=function(t){return!t&&!i(this._root)&&this._fallbackRoot},q.prototype._interpolate=function(n,e,r){var o=this;if(!n)return null;var a=d(n,e);if(Array.isArray(a))return a;if(i(a)&&(a=n[e]),i(a))return null;if("string"!=typeof a)return t("Value of key '"+e+"' is not a string!"),null;if(a.indexOf("@:")>=0){var s=a.match(/(@:[\w|.]+)/g);for(var c in s){var l=s[c],u=l.substr(2),f=o._interpolate(n,u,r);a=a.replace(l,f)}}return r?this._format(a,r):a},q.prototype._format=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this._formatter).format.apply(r,[t].concat(n));var r},q.prototype._translate=function(t,n,e,r,o){var a=null;return a=this._interpolate(t[n],r,o),i(a)?(a=this._interpolate(t[e],r,o),i(a)?null:a):a},q.prototype._t=function(t,n,e,r){for(var i=[],a=arguments.length-4;a-- >0;)i[a]=arguments[a+4];if(!t)return"";var s=o.apply(void 0,i),c=s.locale||n,l=this._translate(e,c,this.fallbackLocale,t,s.params);if(this._isFallbackRoot(l)){if(!this._root)throw Error("unexpected error");return(u=this._root).t.apply(u,[t].concat(i))}return this._warnDefault(c,t,l,r);var u},q.prototype.t=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this)._t.apply(r,[t,this.locale,this.messages,null].concat(n));var r},q.prototype._tc=function(t,n,e,r,i){for(var o=[],a=arguments.length-5;a-- >0;)o[a]=arguments[a+5];return t?void 0!==i?c((s=this)._t.apply(s,[t,n,e,r].concat(o)),i):(l=this)._t.apply(l,[t,n,e,r].concat(o)):"";var s,l},q.prototype.tc=function(t,n){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return(i=this)._tc.apply(i,[t,this.locale,this.messages,null,n].concat(e));var i},q.prototype._te=function(t,n,e){for(var r=[],i=arguments.length-3;i-- >0;)r[i]=arguments[i+3];var a=o.apply(void 0,r).locale||n;return this._exist(e[a],t)},q.prototype.te=function(t){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return(r=this)._te.apply(r,[t,this.locale,this.messages].concat(n));var r},Object.defineProperties(q.prototype,B),q.install=l,q.version="6.0.0-alpha.5","undefined"!=typeof window&&window.Vue&&window.Vue.use(q),q});
{
"name": "vue-i18n",
"description": "Internationalization plugin for Vue.js",
"version": "6.0.0-alpha.4",
"version": "6.0.0-alpha.5",
"author": {

@@ -6,0 +6,0 @@ "name": "kazuya kawaguchi",

/* @flow */
import VueI18n from './index'
import { typeName, isPlainObject, warn } from './util'
import { isPlainObject, warn } from './util'

@@ -48,7 +48,7 @@ export default {

if (options.i18n) {
if (typeName(options.i18n) === 'VueI18n') {
if (options.i18n instanceof VueI18n) {
this.$i18n = options.i18n
} else if (isPlainObject(options.i18n)) {
// component local i18n
if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
options.i18n.root = this.$root.$i18n

@@ -65,3 +65,3 @@ }

}
} else if (this.$root && this.$root.$i18n && typeName(this.$root.$i18n) === 'VueI18n') {
} else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
// root i18n

@@ -68,0 +68,0 @@ this.$i18n = this.$root.$i18n

@@ -45,23 +45,2 @@ /* @flow */

function funcName (f: Function): string {
if (f.name) { return f.name }
const match = /^\s*function\s*([^\(]*)/im.exec(f.toString())
return match ? match[1] : ''
}
function ctorName (obj: any): string {
const str = toString.call(obj).slice(8, -1)
if ((str === 'Object' || str === 'Error') && obj.constructor) {
return funcName(obj.constructor)
}
return str
}
export function typeName (val: mixed): string {
if (val === null) { return 'null' }
const type: string = typeof val
if (type === 'object') { return ctorName(val) }
return type
}
export function isNull (val: mixed): boolean {

@@ -68,0 +47,0 @@ return val === null || val === undefined

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc