Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
📦 build(dist): generate dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Oct 13, 2018
1 parent 9c6a3f9 commit 288bc19
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 65 deletions.
52 changes: 31 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.1.1
* vue-i18n v8.2.0
* (c) 2018 kazuya kawaguchi
* Released under the MIT License.
*/
Expand Down Expand Up @@ -756,7 +756,6 @@ function getPathCharType (ch) {
case 0x2E: // .
case 0x22: // "
case 0x27: // '
case 0x30: // 0
return ch

case 0x5F: // _
Expand All @@ -775,15 +774,7 @@ function getPathCharType (ch) {
return 'ws'
}

// a-z, A-Z
if ((code >= 0x61 && code <= 0x7A) || (code >= 0x41 && code <= 0x5A)) {
return 'ident'
}

// 1-9
if (code >= 0x31 && code <= 0x39) { return 'number' }

return 'else'
return 'ident'
}

/**
Expand Down Expand Up @@ -976,6 +967,8 @@ var numberFormatKeys = [
'localeMatcher',
'formatMatcher'
];
var linkKeyMatcher = /(@:([\w\-_|.]+|\([\w\-_|.]+\)))/g;
var bracketsMatcher = /[()]/g;

var VueI18n = function VueI18n (options) {
var this$1 = this;
Expand Down Expand Up @@ -1121,7 +1114,8 @@ VueI18n.prototype._interpolate = function _interpolate (
key,
host,
interpolateMode,
values
values,
visitedLinkStack
) {
if (!message) { return null }

Expand Down Expand Up @@ -1156,7 +1150,7 @@ VueI18n.prototype._interpolate = function _interpolate (

// Check for the existance of links within the translated string
if (ret.indexOf('@:') >= 0) {
ret = this._link(locale, message, ret, host, interpolateMode, values);
ret = this._link(locale, message, ret, host, interpolateMode, values, visitedLinkStack);
}

return this._render(ret, interpolateMode, values)
Expand All @@ -1168,7 +1162,8 @@ VueI18n.prototype._link = function _link (
str,
host,
interpolateMode,
values
values,
visitedLinkStack
) {
var this$1 = this;

Expand All @@ -1177,21 +1172,29 @@ VueI18n.prototype._link = function _link (
// Match all the links within the local
// We are going to replace each of
// them with its translation
var matches = ret.match(/(@:[\w\-_|.]+)/g);
var matches = ret.match(linkKeyMatcher);
for (var idx in matches) {
// ie compatible: filter custom array
// prototype method
if (!matches.hasOwnProperty(idx)) {
continue
}
var link = matches[idx];
// Remove the leading @:
var linkPlaceholder = link.substr(2);
// Remove the leading @: and the brackets
var linkPlaceholder = link.substr(2).replace(bracketsMatcher, '');

if (visitedLinkStack.includes(linkPlaceholder)) {
warn(("Circular reference found. \"" + link + "\" is already visited in the chain of " + (visitedLinkStack.reverse().join(' <- '))));
return ret
}
visitedLinkStack.push(linkPlaceholder);

// Translate the link
var translated = this$1._interpolate(
locale, message, linkPlaceholder, host,
interpolateMode === 'raw' ? 'string' : interpolateMode,
interpolateMode === 'raw' ? undefined : values
interpolateMode === 'raw' ? undefined : values,
visitedLinkStack
);

if (this$1._isFallbackRoot(translated)) {
Expand All @@ -1211,6 +1214,8 @@ VueI18n.prototype._link = function _link (
Array.isArray(values) ? values : [values]
);

visitedLinkStack.pop();

// Replace the link with the translated
ret = !translated ? ret : ret.replace(link, translated);
}
Expand All @@ -1235,10 +1240,10 @@ VueI18n.prototype._translate = function _translate (
args
) {
var res =
this._interpolate(locale, messages[locale], key, host, interpolateMode, args);
this._interpolate(locale, messages[locale], key, host, interpolateMode, args, [key]);
if (!isNull(res)) { return res }

res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args);
res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args, [key]);
if (!isNull(res)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to translate the keypath '" + key + "' with '" + fallback + "' locale."));
Expand Down Expand Up @@ -1323,6 +1328,11 @@ VueI18n.prototype._tc = function _tc (
if (choice === undefined) {
choice = 1;
}

var predefined = { 'count': choice, 'n': choice };
var parsedArgs = parseArgs.apply(void 0, values);
parsedArgs.params = Object.assign(predefined, parsedArgs.params);
values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params];
return fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice)
};

Expand Down Expand Up @@ -1583,6 +1593,6 @@ VueI18n.availabilities = {
numberFormat: canUseNumberFormat
};
VueI18n.install = install;
VueI18n.version = '8.1.1';
VueI18n.version = '8.2.0';

module.exports = VueI18n;
52 changes: 31 additions & 21 deletions dist/vue-i18n.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-i18n v8.1.1
* vue-i18n v8.2.0
* (c) 2018 kazuya kawaguchi
* Released under the MIT License.
*/
Expand Down Expand Up @@ -754,7 +754,6 @@ function getPathCharType (ch) {
case 0x2E: // .
case 0x22: // "
case 0x27: // '
case 0x30: // 0
return ch

case 0x5F: // _
Expand All @@ -773,15 +772,7 @@ function getPathCharType (ch) {
return 'ws'
}

// a-z, A-Z
if ((code >= 0x61 && code <= 0x7A) || (code >= 0x41 && code <= 0x5A)) {
return 'ident'
}

// 1-9
if (code >= 0x31 && code <= 0x39) { return 'number' }

return 'else'
return 'ident'
}

/**
Expand Down Expand Up @@ -974,6 +965,8 @@ var numberFormatKeys = [
'localeMatcher',
'formatMatcher'
];
var linkKeyMatcher = /(@:([\w\-_|.]+|\([\w\-_|.]+\)))/g;
var bracketsMatcher = /[()]/g;

var VueI18n = function VueI18n (options) {
var this$1 = this;
Expand Down Expand Up @@ -1119,7 +1112,8 @@ VueI18n.prototype._interpolate = function _interpolate (
key,
host,
interpolateMode,
values
values,
visitedLinkStack
) {
if (!message) { return null }

Expand Down Expand Up @@ -1154,7 +1148,7 @@ VueI18n.prototype._interpolate = function _interpolate (

// Check for the existance of links within the translated string
if (ret.indexOf('@:') >= 0) {
ret = this._link(locale, message, ret, host, interpolateMode, values);
ret = this._link(locale, message, ret, host, interpolateMode, values, visitedLinkStack);
}

return this._render(ret, interpolateMode, values)
Expand All @@ -1166,7 +1160,8 @@ VueI18n.prototype._link = function _link (
str,
host,
interpolateMode,
values
values,
visitedLinkStack
) {
var this$1 = this;

Expand All @@ -1175,21 +1170,29 @@ VueI18n.prototype._link = function _link (
// Match all the links within the local
// We are going to replace each of
// them with its translation
var matches = ret.match(/(@:[\w\-_|.]+)/g);
var matches = ret.match(linkKeyMatcher);
for (var idx in matches) {
// ie compatible: filter custom array
// prototype method
if (!matches.hasOwnProperty(idx)) {
continue
}
var link = matches[idx];
// Remove the leading @:
var linkPlaceholder = link.substr(2);
// Remove the leading @: and the brackets
var linkPlaceholder = link.substr(2).replace(bracketsMatcher, '');

if (visitedLinkStack.includes(linkPlaceholder)) {
warn(("Circular reference found. \"" + link + "\" is already visited in the chain of " + (visitedLinkStack.reverse().join(' <- '))));
return ret
}
visitedLinkStack.push(linkPlaceholder);

// Translate the link
var translated = this$1._interpolate(
locale, message, linkPlaceholder, host,
interpolateMode === 'raw' ? 'string' : interpolateMode,
interpolateMode === 'raw' ? undefined : values
interpolateMode === 'raw' ? undefined : values,
visitedLinkStack
);

if (this$1._isFallbackRoot(translated)) {
Expand All @@ -1209,6 +1212,8 @@ VueI18n.prototype._link = function _link (
Array.isArray(values) ? values : [values]
);

visitedLinkStack.pop();

// Replace the link with the translated
ret = !translated ? ret : ret.replace(link, translated);
}
Expand All @@ -1233,10 +1238,10 @@ VueI18n.prototype._translate = function _translate (
args
) {
var res =
this._interpolate(locale, messages[locale], key, host, interpolateMode, args);
this._interpolate(locale, messages[locale], key, host, interpolateMode, args, [key]);
if (!isNull(res)) { return res }

res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args);
res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args, [key]);
if (!isNull(res)) {
if (process.env.NODE_ENV !== 'production' && !this._silentTranslationWarn) {
warn(("Fall back to translate the keypath '" + key + "' with '" + fallback + "' locale."));
Expand Down Expand Up @@ -1321,6 +1326,11 @@ VueI18n.prototype._tc = function _tc (
if (choice === undefined) {
choice = 1;
}

var predefined = { 'count': choice, 'n': choice };
var parsedArgs = parseArgs.apply(void 0, values);
parsedArgs.params = Object.assign(predefined, parsedArgs.params);
values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params];
return fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice)
};

Expand Down Expand Up @@ -1581,6 +1591,6 @@ VueI18n.availabilities = {
numberFormat: canUseNumberFormat
};
VueI18n.install = install;
VueI18n.version = '8.1.1';
VueI18n.version = '8.2.0';

export default VueI18n;
Loading

0 comments on commit 288bc19

Please sign in to comment.