Skip to content

Commit

Permalink
📦 build(dist): generate dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Aug 9, 2019
1 parent acfe385 commit 6c5737b
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 86 deletions.
54 changes: 33 additions & 21 deletions dist/vue-i18n.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-i18n v8.12.0
* vue-i18n v8.13.0
* (c) 2019 kazuya kawaguchi
* Released under the MIT License.
*/
Expand Down Expand Up @@ -1093,7 +1093,7 @@ var VueI18n = function VueI18n (options) {
: !!options.fallbackRoot;
this._silentTranslationWarn = options.silentTranslationWarn === undefined
? false
: !!options.silentTranslationWarn;
: options.silentTranslationWarn;
this._silentFallbackWarn = options.silentFallbackWarn === undefined
? false
: !!options.silentFallbackWarn;
Expand Down Expand Up @@ -1280,7 +1280,7 @@ VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm,
return missingRet
}
} else {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {
warn(
"Cannot translate the value of keypath '" + key + "'. " +
'Use the value of keypath as default.'
Expand All @@ -1294,8 +1294,20 @@ VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) {
return !val && !isNull(this._root) && this._fallbackRoot
};

VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale) {
return this._silentFallbackWarn && (this._isFallbackRoot() || locale !== this.fallbackLocale)
VueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn (key) {
return this._silentFallbackWarn instanceof RegExp
? this._silentFallbackWarn.test(key)
: this._silentFallbackWarn
};

VueI18n.prototype._isSilentFallback = function _isSilentFallback (locale, key) {
return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale)
};

VueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn (key) {
return this._silentTranslationWarn instanceof RegExp
? this._silentTranslationWarn.test(key)
: this._silentTranslationWarn
};

VueI18n.prototype._interpolate = function _interpolate (
Expand All @@ -1318,7 +1330,7 @@ VueI18n.prototype._interpolate = function _interpolate (
if (isPlainObject(message)) {
ret = message[key];
if (typeof ret !== 'string') {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn && !this._isSilentFallback(locale)) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {
warn(("Value of key '" + key + "' is not a string!"));
}
return null
Expand All @@ -1331,7 +1343,7 @@ VueI18n.prototype._interpolate = function _interpolate (
if (typeof pathRet === 'string') {
ret = pathRet;
} else {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn && !this._isSilentFallback(locale)) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {
warn(("Value of key '" + key + "' is not a string!"));
}
return null
Expand Down Expand Up @@ -1392,7 +1404,7 @@ VueI18n.prototype._link = function _link (
);

if (this._isFallbackRoot(translated)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(linkPlaceholder)) {
warn(("Fall back to translate the link placeholder '" + linkPlaceholder + "' with root locale."));
}
/* istanbul ignore if */
Expand Down Expand Up @@ -1448,7 +1460,7 @@ VueI18n.prototype._translate = function _translate (

res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args, [key]);
if (!isNull(res)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn && !this._silentFallbackWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to translate the keypath '" + key + "' with '" + fallback + "' locale."));
}
return res
Expand All @@ -1472,7 +1484,7 @@ VueI18n.prototype._t = function _t (key, _locale, messages, host) {
host, 'string', parsedArgs.params
);
if (this._isFallbackRoot(ret)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn && !this._silentFallbackWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to translate the keypath '" + key + "' with root locale."));
}
/* istanbul ignore if */
Expand All @@ -1495,7 +1507,7 @@ VueI18n.prototype._i = function _i (key, locale, messages, host, values) {
var ret =
this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);
if (this._isFallbackRoot(ret)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {
warn(("Fall back to interpolate the keypath '" + key + "' with root locale."));
}
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1641,8 +1653,8 @@ VueI18n.prototype._localizeDateTime = function _localizeDateTime (

// fallback locale
if (isNull(formats) || isNull(formats[key])) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to '" + fallback + "' datetime formats from '" + locale + " datetime formats."));
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to '" + fallback + "' datetime formats from '" + locale + "' datetime formats."));
}
_locale = fallback;
formats = dateTimeFormats[_locale];
Expand Down Expand Up @@ -1675,8 +1687,8 @@ VueI18n.prototype._d = function _d (value, locale, key) {
var ret =
this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key);
if (this._isFallbackRoot(ret)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to datetime localization of root: key '" + key + "' ."));
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to datetime localization of root: key '" + key + "'."));
}
/* istanbul ignore if */
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1741,8 +1753,8 @@ VueI18n.prototype._getNumberFormatter = function _getNumberFormatter (

// fallback locale
if (isNull(formats) || isNull(formats[key])) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to '" + fallback + "' number formats from '" + locale + " number formats."));
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to '" + fallback + "' number formats from '" + locale + "' number formats."));
}
_locale = fallback;
formats = numberFormats[_locale];
Expand Down Expand Up @@ -1785,8 +1797,8 @@ VueI18n.prototype._n = function _n (value, locale, key, options) {
var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
var ret = formatter && formatter.format(value);
if (this._isFallbackRoot(ret)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to number localization of root: key '" + key + "' ."));
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(("Fall back to number localization of root: key '" + key + "'."));
}
/* istanbul ignore if */
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1854,7 +1866,7 @@ VueI18n.prototype._ntp = function _ntp (value, locale, key, options) {
var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
var ret = formatter && formatter.formatToParts(value);
if (this._isFallbackRoot(ret)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {
warn(("Fall back to format number to parts of root: key '" + key + "' ."));
}
/* istanbul ignore if */
Expand Down Expand Up @@ -1884,6 +1896,6 @@ Object.defineProperty(VueI18n, 'availabilities', {
});

VueI18n.install = install;
VueI18n.version = '8.12.0';
VueI18n.version = '8.13.0';

module.exports = VueI18n;
52 changes: 32 additions & 20 deletions dist/vue-i18n.esm.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ class VueI18n {
: !!options.fallbackRoot;
this._silentTranslationWarn = options.silentTranslationWarn === undefined
? false
: !!options.silentTranslationWarn;
: options.silentTranslationWarn;
this._silentFallbackWarn = options.silentFallbackWarn === undefined
? false
: !!options.silentFallbackWarn;
Expand Down Expand Up @@ -1257,7 +1257,7 @@ class VueI18n {
return missingRet
}
} else {
if (!this._silentTranslationWarn) {
if (!this._isSilentTranslationWarn(key)) {
warn(
`Cannot translate the value of keypath '${key}'. ` +
'Use the value of keypath as default.'
Expand All @@ -1271,8 +1271,20 @@ class VueI18n {
return !val && !isNull(this._root) && this._fallbackRoot
}

_isSilentFallback (locale) {
return this._silentFallbackWarn && (this._isFallbackRoot() || locale !== this.fallbackLocale)
_isSilentFallbackWarn (key) {
return this._silentFallbackWarn instanceof RegExp
? this._silentFallbackWarn.test(key)
: this._silentFallbackWarn
}

_isSilentFallback (locale, key) {
return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale)
}

_isSilentTranslationWarn (key) {
return this._silentTranslationWarn instanceof RegExp
? this._silentTranslationWarn.test(key)
: this._silentTranslationWarn
}

_interpolate (
Expand All @@ -1295,7 +1307,7 @@ class VueI18n {
if (isPlainObject(message)) {
ret = message[key];
if (typeof ret !== 'string') {
if (!this._silentTranslationWarn && !this._isSilentFallback(locale)) {
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {
warn(`Value of key '${key}' is not a string!`);
}
return null
Expand All @@ -1308,7 +1320,7 @@ class VueI18n {
if (typeof pathRet === 'string') {
ret = pathRet;
} else {
if (!this._silentTranslationWarn && !this._isSilentFallback(locale)) {
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {
warn(`Value of key '${key}' is not a string!`);
}
return null
Expand Down Expand Up @@ -1368,7 +1380,7 @@ class VueI18n {
);

if (this._isFallbackRoot(translated)) {
if (!this._silentTranslationWarn) {
if (!this._isSilentTranslationWarn(linkPlaceholder)) {
warn(`Fall back to translate the link placeholder '${linkPlaceholder}' with root locale.`);
}
/* istanbul ignore if */
Expand Down Expand Up @@ -1424,7 +1436,7 @@ class VueI18n {

res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args, [key]);
if (!isNull(res)) {
if (!this._silentTranslationWarn && !this._silentFallbackWarn) {
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to translate the keypath '${key}' with '${fallback}' locale.`);
}
return res
Expand All @@ -1444,7 +1456,7 @@ class VueI18n {
host, 'string', parsedArgs.params
);
if (this._isFallbackRoot(ret)) {
if (!this._silentTranslationWarn && !this._silentFallbackWarn) {
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to translate the keypath '${key}' with root locale.`);
}
/* istanbul ignore if */
Expand All @@ -1463,7 +1475,7 @@ class VueI18n {
const ret =
this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);
if (this._isFallbackRoot(ret)) {
if (!this._silentTranslationWarn) {
if (!this._isSilentTranslationWarn(key)) {
warn(`Fall back to interpolate the keypath '${key}' with root locale.`);
}
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1599,8 +1611,8 @@ class VueI18n {

// fallback locale
if (isNull(formats) || isNull(formats[key])) {
if (!this._silentTranslationWarn) {
warn(`Fall back to '${fallback}' datetime formats from '${locale} datetime formats.`);
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to '${fallback}' datetime formats from '${locale}' datetime formats.`);
}
_locale = fallback;
formats = dateTimeFormats[_locale];
Expand Down Expand Up @@ -1633,8 +1645,8 @@ class VueI18n {
const ret =
this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key);
if (this._isFallbackRoot(ret)) {
if (!this._silentTranslationWarn) {
warn(`Fall back to datetime localization of root: key '${key}' .`);
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to datetime localization of root: key '${key}'.`);
}
/* istanbul ignore if */
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1696,8 +1708,8 @@ class VueI18n {

// fallback locale
if (isNull(formats) || isNull(formats[key])) {
if (!this._silentTranslationWarn) {
warn(`Fall back to '${fallback}' number formats from '${locale} number formats.`);
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to '${fallback}' number formats from '${locale}' number formats.`);
}
_locale = fallback;
formats = numberFormats[_locale];
Expand Down Expand Up @@ -1740,8 +1752,8 @@ class VueI18n {
const formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
const ret = formatter && formatter.format(value);
if (this._isFallbackRoot(ret)) {
if (!this._silentTranslationWarn) {
warn(`Fall back to number localization of root: key '${key}' .`);
if (!this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {
warn(`Fall back to number localization of root: key '${key}'.`);
}
/* istanbul ignore if */
if (!this._root) { throw Error('unexpected error') }
Expand Down Expand Up @@ -1804,7 +1816,7 @@ class VueI18n {
const formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);
const ret = formatter && formatter.formatToParts(value);
if (this._isFallbackRoot(ret)) {
if (!this._silentTranslationWarn) {
if (!this._isSilentTranslationWarn(key)) {
warn(`Fall back to format number to parts of root: key '${key}' .`);
}
/* istanbul ignore if */
Expand Down Expand Up @@ -1833,6 +1845,6 @@ Object.defineProperty(VueI18n, 'availabilities', {
});

VueI18n.install = install;
VueI18n.version = '8.12.0';
VueI18n.version = '8.13.0';

export default VueI18n;
Loading

0 comments on commit 6c5737b

Please sign in to comment.