提交 a7abfb39 编写于 作者: fxy060608's avatar fxy060608

chore: add commments

上级 e815d022
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var shared = require('@intlify/shared');
var coreBase = require('@intlify/core-base');
var vue = require('vue');
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var shared = require('@intlify/shared');
var coreBase = require('@intlify/core-base');
var vue = require('vue');
/**
* Vue I18n Version
*
......@@ -19,10 +19,10 @@ var vue = require('vue');
*
* @VueI18nGeneral
*/
const VERSION = '9.1.9';
const VERSION = '9.1.9';
/**
* 目前暂不支持任何语法
* fixed by xxxxxx 目前暂不支持任何语法
* @param source
* @param _
* @returns
......@@ -31,8 +31,8 @@ function compileToFunction(source, _ = {}) {
return ((ctx) => {
return ctx.normalize([source]);
});
}
}
const warnMessages = {
[6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`,
[7 /* NOT_SUPPORTED_PRESERVE */]: `Not supported 'preserve'.`,
......@@ -44,8 +44,8 @@ const warnMessages = {
};
function getWarnMessage(code, ...args) {
return shared.format(warnMessages[code], ...args);
}
}
function createI18nError(code, ...args) {
return coreBase.createCompileError(code, null, { messages: errorMessages, args } );
}
......@@ -59,8 +59,8 @@ const errorMessages = {
[19 /* REQUIRED_VALUE */]: `Required in value: {0}`,
[20 /* INVALID_VALUE */]: `Invalid value`,
[21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin`
};
};
const DEVTOOLS_META = '__INTLIFY_META__';
const TransrateVNodeSymbol = shared.makeSymbol('__transrateVNode');
const DatetimePartsSymbol = shared.makeSymbol('__datetimeParts');
......@@ -622,8 +622,8 @@ function createComposer(options = {}) {
};
}
return composer;
}
}
/**
* Convert to I18n Composer Options from VueI18n Options
*
......@@ -978,8 +978,8 @@ function createVueI18n(options = {}) {
};
}
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
......@@ -995,8 +995,8 @@ const baseFormatProps = {
i18n: {
type: Object
}
};
};
/**
* Translation Component
*
......@@ -1105,8 +1105,8 @@ function getInterpolateArg({ slots }, keys) {
return arg;
}, {});
}
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
......@@ -1152,8 +1152,8 @@ function renderFormatter(props, context, slotKeys, partFormatter) {
? vue.h(props.tag, assignedAttrs, children)
: vue.h(vue.Fragment, assignedAttrs, children);
};
}
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
......@@ -1208,8 +1208,8 @@ const NumberFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
......@@ -1269,8 +1269,8 @@ const DatetimeFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
};
function getComposer$1(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
......@@ -1329,8 +1329,8 @@ function makeParams(value) {
options.plural = plural;
}
return [path, named, options];
}
}
function apply(app, i18n, ...options) {
const pluginOptions = shared.isPlainObject(options[0])
? options[0]
......@@ -1352,8 +1352,8 @@ function apply(app, i18n, ...options) {
}
// install directive
app.directive('t', vTDirective(i18n));
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
......@@ -1453,8 +1453,8 @@ function mergeToRoot(root, options) {
Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale]));
}
return root;
}
}
/**
* Vue I18n factory
*
......@@ -1806,8 +1806,8 @@ function injectGlobalFields(app, composer) {
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
}
// register message compiler at vue-i18n
coreBase.registerMessageCompiler(compileToFunction);
// NOTE: experimental !!
......@@ -1815,12 +1815,12 @@ coreBase.registerMessageCompiler(compileToFunction);
const target = shared.getGlobalThis();
target.__INTLIFY__ = true;
coreBase.setDevToolsHook(target.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__);
}
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
}
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var coreBase = require('@intlify/core-base');
var vue = require('vue');
var shared = require('@intlify/shared');
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var coreBase = require('@intlify/core-base');
var vue = require('vue');
var shared = require('@intlify/shared');
/**
* Vue I18n Version
*
......@@ -19,10 +19,10 @@ var shared = require('@intlify/shared');
*
* @VueI18nGeneral
*/
const VERSION = '9.1.9';
const VERSION = '9.1.9';
/**
* 目前暂不支持任何语法
* fixed by xxxxxx 目前暂不支持任何语法
* @param source
* @param _
* @returns
......@@ -31,12 +31,12 @@ function compileToFunction(source, _ = {}) {
return ((ctx) => {
return ctx.normalize([source]);
});
}
}
function createI18nError(code, ...args) {
return coreBase.createCompileError(code, null, undefined);
}
}
const TransrateVNodeSymbol = shared.makeSymbol('__transrateVNode');
const DatetimePartsSymbol = shared.makeSymbol('__datetimeParts');
const NumberPartsSymbol = shared.makeSymbol('__numberParts');
......@@ -547,8 +547,8 @@ function createComposer(options = {}) {
[InejctWithOption]: options.__injectWithOption // eslint-disable-line @typescript-eslint/no-explicit-any
};
return composer;
}
}
/**
* Convert to I18n Composer Options from VueI18n Options
*
......@@ -879,8 +879,8 @@ function createVueI18n(options = {}) {
}
};
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
......@@ -896,8 +896,8 @@ const baseFormatProps = {
i18n: {
type: Object
}
};
};
/**
* Translation Component
*
......@@ -1006,8 +1006,8 @@ function getInterpolateArg({ slots }, keys) {
return arg;
}, {});
}
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
......@@ -1053,8 +1053,8 @@ function renderFormatter(props, context, slotKeys, partFormatter) {
? vue.h(props.tag, assignedAttrs, children)
: vue.h(vue.Fragment, assignedAttrs, children);
};
}
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
......@@ -1109,8 +1109,8 @@ const NumberFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
......@@ -1170,8 +1170,8 @@ const DatetimeFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
};
function getComposer$1(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
......@@ -1227,8 +1227,8 @@ function makeParams(value) {
options.plural = plural;
}
return [path, named, options];
}
}
function apply(app, i18n, ...options) {
const pluginOptions = shared.isPlainObject(options[0])
? options[0]
......@@ -1245,8 +1245,8 @@ function apply(app, i18n, ...options) {
}
// install directive
app.directive('t', vTDirective(i18n));
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
......@@ -1346,8 +1346,8 @@ function mergeToRoot(root, options) {
Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale]));
}
return root;
}
}
/**
* Vue I18n factory
*
......@@ -1696,15 +1696,15 @@ function injectGlobalFields(app, composer) {
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
}
// register message compiler at vue-i18n
coreBase.registerMessageCompiler(compileToFunction);
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
coreBase.registerMessageCompiler(compileToFunction);
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue';
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue';
/**
* Original Utilities
* written by kazuya kawaguchi
......@@ -144,8 +144,8 @@ function generateCodeFrame(source, start = 0, end = source.length) {
}
}
return res.join('\n');
}
}
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
......@@ -185,8 +185,8 @@ function createEmitter() {
}
};
return emitter;
}
}
const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
......@@ -464,8 +464,8 @@ function handleFlatJson(obj) {
}
}
return obj;
}
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
......@@ -567,8 +567,8 @@ function createMessageContext(options = {}) {
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
}
/** @internal */
const errorMessages$2 = {
// tokenizer error messages
......@@ -599,13 +599,13 @@ function createCompileError(code, loc, options = {}) {
}
error.domain = domain;
return error;
}
}
const IntlifyDevToolsHooks = {
I18nInit: 'i18n:init',
FunctionTranslate: 'function:translate'
};
};
let devtools = null;
function setDevToolsHook(hook) {
devtools = hook;
......@@ -623,8 +623,8 @@ function initI18nDevTools(i18n, version, meta) {
const translateDevTools = /* #__PURE__*/ createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);
function createDevToolsHook(hook) {
return (payloads) => devtools && devtools.emit(hook, payloads);
}
}
/** @internal */
const warnMessages$1 = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
......@@ -636,8 +636,8 @@ const warnMessages$1 = {
};
function getWarnMessage$1(code, ...args) {
return format(warnMessages$1[code], ...args);
}
}
/**
* Intlify core-base version
* @internal
......@@ -867,8 +867,8 @@ function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
}
function createCoreError(code) {
return createCompileError(code, null, { messages: errorMessages$1 } );
}
......@@ -878,8 +878,8 @@ const errorMessages$1 = {
[15 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[16 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => isFunction(val);
// implementation of `translate` function
......@@ -1245,14 +1245,14 @@ function getMessageContextOptions(context, locale, message, options) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
};
// implementation of `datetime` function
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
......@@ -1386,8 +1386,8 @@ function clearDateTimeFormat(ctx, locale, format) {
}
context.__datetimeFormatters.delete(id);
}
}
}
// implementation of `number` function
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
......@@ -1497,8 +1497,8 @@ function clearNumberFormat(ctx, locale, format) {
}
context.__numberFormatters.delete(id);
}
}
}
/**
* Vue I18n Version
*
......@@ -1519,10 +1519,10 @@ function initDev() {
`Make sure to use the production build (*.prod.js) when deploying for production.`);
}
}
}
}
/**
* 目前暂不支持任何语法
* fixed by xxxxxx 目前暂不支持任何语法
* @param source
* @param _
* @returns
......@@ -1531,8 +1531,8 @@ function compileToFunction(source, _ = {}) {
return ((ctx) => {
return ctx.normalize([source]);
});
}
}
const warnMessages = {
[6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`,
[7 /* NOT_SUPPORTED_PRESERVE */]: `Not supported 'preserve'.`,
......@@ -1544,8 +1544,8 @@ const warnMessages = {
};
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
}
function createI18nError(code, ...args) {
return createCompileError(code, null, { messages: errorMessages, args } );
}
......@@ -1559,8 +1559,8 @@ const errorMessages = {
[19 /* REQUIRED_VALUE */]: `Required in value: {0}`,
[20 /* INVALID_VALUE */]: `Invalid value`,
[21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin`
};
};
const DEVTOOLS_META = '__INTLIFY_META__';
const TransrateVNodeSymbol = makeSymbol('__transrateVNode');
const DatetimePartsSymbol = makeSymbol('__datetimeParts');
......@@ -2121,8 +2121,8 @@ function createComposer(options = {}) {
};
}
return composer;
}
}
/**
* Convert to I18n Composer Options from VueI18n Options
*
......@@ -2477,8 +2477,8 @@ function createVueI18n(options = {}) {
};
}
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
......@@ -2494,8 +2494,8 @@ const baseFormatProps = {
i18n: {
type: Object
}
};
};
/**
* Translation Component
*
......@@ -2604,8 +2604,8 @@ function getInterpolateArg({ slots }, keys) {
return arg;
}, {});
}
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
......@@ -2651,8 +2651,8 @@ function renderFormatter(props, context, slotKeys, partFormatter) {
? h(props.tag, assignedAttrs, children)
: h(Fragment, assignedAttrs, children);
};
}
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
......@@ -2707,8 +2707,8 @@ const NumberFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
......@@ -2768,8 +2768,8 @@ const DatetimeFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
};
function getComposer$2(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
......@@ -2828,8 +2828,8 @@ function makeParams(value) {
options.plural = plural;
}
return [path, named, options];
}
}
function apply(app, i18n, ...options) {
const pluginOptions = isPlainObject(options[0])
? options[0]
......@@ -2851,41 +2851,41 @@ function apply(app, i18n, ...options) {
}
// install directive
app.directive('t', vTDirective(i18n));
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
// @ts-ignore
return typeof navigator !== 'undefined'
? window
: typeof global$1 !== 'undefined'
? global$1
: {};
}
const HOOK_SETUP = 'devtools-plugin:setup';
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const hook = getDevtoolsGlobalHook();
if (hook) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const target = getTarget();
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor,
setupFn
});
}
}
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
// @ts-ignore
return typeof navigator !== 'undefined'
? window
: typeof global$1 !== 'undefined'
? global$1
: {};
}
const HOOK_SETUP = 'devtools-plugin:setup';
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const hook = getDevtoolsGlobalHook();
if (hook) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const target = getTarget();
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor,
setupFn
});
}
}
const VueDevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
......@@ -2896,8 +2896,8 @@ const VueDevToolsPlaceholders = {
};
const VueDevToolsTimelineColors = {
["vue-i18n-timeline" /* TIMELINE */]: 0xffcd19
};
};
const VUE_I18N_COMPONENT_TYPES = 'vue-i18n: composer properties';
let devtoolsApi;
async function enableDevTools(app, i18n) {
......@@ -3225,8 +3225,8 @@ function editScope(payload, i18n) {
composer.inheritLocale = payload.state.value;
}
}
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
......@@ -3344,8 +3344,8 @@ function mergeToRoot(root, options) {
Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale]));
}
return root;
}
}
/**
* Vue I18n factory
*
......@@ -3737,8 +3737,8 @@ function injectGlobalFields(app, composer) {
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
}
// register message compiler at vue-i18n
registerMessageCompiler(compileToFunction);
// NOTE: experimental !!
......@@ -3749,6 +3749,6 @@ registerMessageCompiler(compileToFunction);
}
{
initDev();
}
export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
}
export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { getGlobalThis, format, makeSymbol, isPlainObject, isArray, hasOwn, isObject, isBoolean, isString, isRegExp, isFunction, assign, isNumber, warn, createEmitter, isEmptyObject } from '@intlify/shared';
import { createCompileError, handleFlatJson, createCoreContext, updateFallbackLocale, resolveValue, clearDateTimeFormat, clearNumberFormat, setAdditionalMeta, NOT_REOSLVED, isTranslateFallbackWarn, isTranslateMissingWarn, parseTranslateArgs, translate, MISSING_RESOLVE_VALUE, parseDateTimeArgs, datetime, parseNumberArgs, number, getLocaleChain, registerMessageCompiler, setDevToolsHook } from '@intlify/core-base';
import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue';
import { setupDevtoolsPlugin } from '@vue/devtools-api';
import { VueDevToolsLabels, VueDevToolsPlaceholders, VueDevToolsTimelineColors } from '@intlify/vue-devtools';
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { getGlobalThis, format, makeSymbol, isPlainObject, isArray, hasOwn, isObject, isBoolean, isString, isRegExp, isFunction, assign, isNumber, warn, createEmitter, isEmptyObject } from '@intlify/shared';
import { createCompileError, handleFlatJson, createCoreContext, updateFallbackLocale, resolveValue, clearDateTimeFormat, clearNumberFormat, setAdditionalMeta, NOT_REOSLVED, isTranslateFallbackWarn, isTranslateMissingWarn, parseTranslateArgs, translate, MISSING_RESOLVE_VALUE, parseDateTimeArgs, datetime, parseNumberArgs, number, getLocaleChain, registerMessageCompiler, setDevToolsHook } from '@intlify/core-base';
import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue';
import { setupDevtoolsPlugin } from '@vue/devtools-api';
import { VueDevToolsLabels, VueDevToolsPlaceholders, VueDevToolsTimelineColors } from '@intlify/vue-devtools';
/**
* Vue I18n Version
*
......@@ -47,10 +47,10 @@ function initFeatureFlags() {
`configure your bundler to explicitly replace feature flag globals ` +
`with boolean literals to get proper tree-shaking in the final bundle.`);
}
}
}
/**
* 目前暂不支持任何语法
* fixed by xxxxxx 目前暂不支持任何语法
* @param source
* @param _
* @returns
......@@ -59,8 +59,8 @@ function compileToFunction(source, _ = {}) {
return ((ctx) => {
return ctx.normalize([source]);
});
}
}
const warnMessages = {
[6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`,
[7 /* NOT_SUPPORTED_PRESERVE */]: `Not supported 'preserve'.`,
......@@ -72,8 +72,8 @@ const warnMessages = {
};
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
}
function createI18nError(code, ...args) {
return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages, args } : undefined);
}
......@@ -87,8 +87,8 @@ const errorMessages = {
[19 /* REQUIRED_VALUE */]: `Required in value: {0}`,
[20 /* INVALID_VALUE */]: `Invalid value`,
[21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin`
};
};
const DEVTOOLS_META = '__INTLIFY_META__';
const TransrateVNodeSymbol = makeSymbol('__transrateVNode');
const DatetimePartsSymbol = makeSymbol('__datetimeParts');
......@@ -654,8 +654,8 @@ function createComposer(options = {}) {
};
}
return composer;
}
}
/**
* Convert to I18n Composer Options from VueI18n Options
*
......@@ -1013,8 +1013,8 @@ function createVueI18n(options = {}) {
};
}
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
......@@ -1030,8 +1030,8 @@ const baseFormatProps = {
i18n: {
type: Object
}
};
};
/**
* Translation Component
*
......@@ -1140,8 +1140,8 @@ function getInterpolateArg({ slots }, keys) {
return arg;
}, {});
}
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
......@@ -1187,8 +1187,8 @@ function renderFormatter(props, context, slotKeys, partFormatter) {
? h(props.tag, assignedAttrs, children)
: h(Fragment, assignedAttrs, children);
};
}
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
......@@ -1243,8 +1243,8 @@ const NumberFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
......@@ -1304,8 +1304,8 @@ const DatetimeFormat = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
};
function getComposer$2(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
......@@ -1364,8 +1364,8 @@ function makeParams(value) {
options.plural = plural;
}
return [path, named, options];
}
}
function apply(app, i18n, ...options) {
const pluginOptions = isPlainObject(options[0])
? options[0]
......@@ -1387,8 +1387,8 @@ function apply(app, i18n, ...options) {
}
// install directive
app.directive('t', vTDirective(i18n));
}
}
const VUE_I18N_COMPONENT_TYPES = 'vue-i18n: composer properties';
let devtoolsApi;
async function enableDevTools(app, i18n) {
......@@ -1716,8 +1716,8 @@ function editScope(payload, i18n) {
composer.inheritLocale = payload.state.value;
}
}
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
......@@ -1835,8 +1835,8 @@ function mergeToRoot(root, options) {
Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale]));
}
return root;
}
}
/**
* Vue I18n factory
*
......@@ -2233,8 +2233,8 @@ function injectGlobalFields(app, composer) {
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
}
// register message compiler at vue-i18n
registerMessageCompiler(compileToFunction);
{
......@@ -2246,6 +2246,6 @@ if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {
target.__INTLIFY__ = true;
setDevToolsHook(target.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__);
}
if ((process.env.NODE_ENV !== 'production')) ;
export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
if ((process.env.NODE_ENV !== 'production')) ;
export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
var VueI18n = (function (exports, vue) {
'use strict';
/*!
* vue-i18n v9.1.9
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
var VueI18n = (function (exports, vue) {
'use strict';
/**
* Original Utilities
* written by kazuya kawaguchi
......@@ -145,8 +145,8 @@ var VueI18n = (function (exports, vue) {
}
}
return res.join('\n');
}
}
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
......@@ -186,8 +186,8 @@ var VueI18n = (function (exports, vue) {
}
};
return emitter;
}
}
const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
......@@ -465,8 +465,8 @@ var VueI18n = (function (exports, vue) {
}
}
return obj;
}
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
......@@ -568,8 +568,8 @@ var VueI18n = (function (exports, vue) {
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
}
/** @internal */
const errorMessages$2 = {
// tokenizer error messages
......@@ -600,13 +600,13 @@ var VueI18n = (function (exports, vue) {
}
error.domain = domain;
return error;
}
}
const IntlifyDevToolsHooks = {
I18nInit: 'i18n:init',
FunctionTranslate: 'function:translate'
};
};
let devtools = null;
function setDevToolsHook(hook) {
devtools = hook;
......@@ -624,8 +624,8 @@ var VueI18n = (function (exports, vue) {
const translateDevTools = /* #__PURE__*/ createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);
function createDevToolsHook(hook) {
return (payloads) => devtools && devtools.emit(hook, payloads);
}
}
/** @internal */
const warnMessages$1 = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
......@@ -637,8 +637,8 @@ var VueI18n = (function (exports, vue) {
};
function getWarnMessage$1(code, ...args) {
return format(warnMessages$1[code], ...args);
}
}
/**
* Intlify core-base version
* @internal
......@@ -868,8 +868,8 @@ var VueI18n = (function (exports, vue) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
}
function createCoreError(code) {
return createCompileError(code, null, { messages: errorMessages$1 } );
}
......@@ -879,8 +879,8 @@ var VueI18n = (function (exports, vue) {
[15 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[16 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => isFunction(val);
// implementation of `translate` function
......@@ -1246,14 +1246,14 @@ var VueI18n = (function (exports, vue) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
};
// implementation of `datetime` function
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
......@@ -1387,8 +1387,8 @@ var VueI18n = (function (exports, vue) {
}
context.__datetimeFormatters.delete(id);
}
}
}
// implementation of `number` function
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
......@@ -1498,8 +1498,8 @@ var VueI18n = (function (exports, vue) {
}
context.__numberFormatters.delete(id);
}
}
}
/**
* Vue I18n Version
*
......@@ -1520,10 +1520,10 @@ var VueI18n = (function (exports, vue) {
`Make sure to use the production build (*.prod.js) when deploying for production.`);
}
}
}
}
/**
* 目前暂不支持任何语法
* fixed by xxxxxx 目前暂不支持任何语法
* @param source
* @param _
* @returns
......@@ -1532,8 +1532,8 @@ var VueI18n = (function (exports, vue) {
return ((ctx) => {
return ctx.normalize([source]);
});
}
}
const warnMessages = {
[6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`,
[7 /* NOT_SUPPORTED_PRESERVE */]: `Not supported 'preserve'.`,
......@@ -1545,8 +1545,8 @@ var VueI18n = (function (exports, vue) {
};
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
}
function createI18nError(code, ...args) {
return createCompileError(code, null, { messages: errorMessages, args } );
}
......@@ -1560,8 +1560,8 @@ var VueI18n = (function (exports, vue) {
[19 /* REQUIRED_VALUE */]: `Required in value: {0}`,
[20 /* INVALID_VALUE */]: `Invalid value`,
[21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin`
};
};
const DEVTOOLS_META = '__INTLIFY_META__';
const TransrateVNodeSymbol = makeSymbol('__transrateVNode');
const DatetimePartsSymbol = makeSymbol('__datetimeParts');
......@@ -2122,8 +2122,8 @@ var VueI18n = (function (exports, vue) {
};
}
return composer;
}
}
/**
* Convert to I18n Composer Options from VueI18n Options
*
......@@ -2478,8 +2478,8 @@ var VueI18n = (function (exports, vue) {
};
}
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
......@@ -2495,8 +2495,8 @@ var VueI18n = (function (exports, vue) {
i18n: {
type: Object
}
};
};
/**
* Translation Component
*
......@@ -2605,8 +2605,8 @@ var VueI18n = (function (exports, vue) {
return arg;
}, {});
}
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
......@@ -2652,8 +2652,8 @@ var VueI18n = (function (exports, vue) {
? vue.h(props.tag, assignedAttrs, children)
: vue.h(vue.Fragment, assignedAttrs, children);
};
}
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
......@@ -2708,8 +2708,8 @@ var VueI18n = (function (exports, vue) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
......@@ -2769,8 +2769,8 @@ var VueI18n = (function (exports, vue) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
};
function getComposer$2(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
......@@ -2829,8 +2829,8 @@ var VueI18n = (function (exports, vue) {
options.plural = plural;
}
return [path, named, options];
}
}
function apply(app, i18n, ...options) {
const pluginOptions = isPlainObject(options[0])
? options[0]
......@@ -2852,41 +2852,41 @@ var VueI18n = (function (exports, vue) {
}
// install directive
app.directive('t', vTDirective(i18n));
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
// @ts-ignore
return typeof navigator !== 'undefined'
? window
: typeof global$1 !== 'undefined'
? global$1
: {};
}
const HOOK_SETUP = 'devtools-plugin:setup';
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const hook = getDevtoolsGlobalHook();
if (hook) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const target = getTarget();
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor,
setupFn
});
}
}
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
// @ts-ignore
return typeof navigator !== 'undefined'
? window
: typeof global$1 !== 'undefined'
? global$1
: {};
}
const HOOK_SETUP = 'devtools-plugin:setup';
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const hook = getDevtoolsGlobalHook();
if (hook) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const target = getTarget();
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor,
setupFn
});
}
}
const VueDevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
......@@ -2897,8 +2897,8 @@ var VueI18n = (function (exports, vue) {
};
const VueDevToolsTimelineColors = {
["vue-i18n-timeline" /* TIMELINE */]: 0xffcd19
};
};
const VUE_I18N_COMPONENT_TYPES = 'vue-i18n: composer properties';
let devtoolsApi;
async function enableDevTools(app, i18n) {
......@@ -3226,8 +3226,8 @@ var VueI18n = (function (exports, vue) {
composer.inheritLocale = payload.state.value;
}
}
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
......@@ -3345,8 +3345,8 @@ var VueI18n = (function (exports, vue) {
Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale]));
}
return root;
}
}
/**
* Vue I18n factory
*
......@@ -3738,8 +3738,8 @@ var VueI18n = (function (exports, vue) {
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
}
// register message compiler at vue-i18n
registerMessageCompiler(compileToFunction);
// NOTE: experimental !!
......@@ -3750,18 +3750,18 @@ var VueI18n = (function (exports, vue) {
}
{
initDev();
}
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, Vue));
}
exports.DatetimeFormat = DatetimeFormat;
exports.NumberFormat = NumberFormat;
exports.Translation = Translation;
exports.VERSION = VERSION;
exports.createI18n = createI18n;
exports.useI18n = useI18n;
exports.vTDirective = vTDirective;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, Vue));
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册