1 line
23 KiB
JavaScript
1 line
23 KiB
JavaScript
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var shared=require("@intlify/shared"),coreBase=require("@intlify/core-base"),vue=require("vue");const VERSION="9.1.10",warnMessages={[6]:"Fall back to {type} '{key}' with root locale.",7:"Not supported 'preserve'.",8:"Not supported 'formatter'.",9:"Not supported 'preserveDirectiveContent'.",10:"Not supported 'getChoiceIndex'.",11:"Component name legacy compatible: '{name}' -> 'i18n'",12:"Not found parent scope. use the global scope."};function getWarnMessage(e,...a){return shared.format(warnMessages[e],...a)}function createI18nError(e,...a){return coreBase.createCompileError(e,null,{messages:errorMessages,args:a})}const errorMessages={[14]:"Unexpected return type in composer",15:"Invalid argument",16:"Must be called at the top of a `setup` function",17:"Need to install with `app.use` function",22:"Unexpected error",18:"Not available in legacy mode",19:"Required in value: {0}",20:"Invalid value",21:"Cannot setup vue-devtools plugin"},DEVTOOLS_META="__INTLIFY_META__",TransrateVNodeSymbol=shared.makeSymbol("__transrateVNode"),DatetimePartsSymbol=shared.makeSymbol("__datetimeParts"),NumberPartsSymbol=shared.makeSymbol("__numberParts"),EnableEmitter=shared.makeSymbol("__enableEmitter"),DisableEmitter=shared.makeSymbol("__disableEmitter"),SetPluralRulesSymbol=shared.makeSymbol("__setPluralRules"),InejctWithOption=(shared.makeSymbol("__intlifyMeta"),shared.makeSymbol("__injectWithOption"));let composerID=0;function defineCoreMissingHandler(s){return(e,a,t,r)=>s(a,t,vue.getCurrentInstance()||void 0,r)}function getLocaleMessages(e,a){const{messages:t,__i18n:r}=a,s=shared.isPlainObject(t)?t:shared.isArray(r)?{}:{[e]:{}};if(shared.isArray(r)&&r.forEach(({locale:e,resource:a})=>{e?(s[e]=s[e]||{},deepCopy(a,s[e])):deepCopy(a,s)}),a.flatJson)for(const n in s)shared.hasOwn(s,n)&&coreBase.handleFlatJson(s[n]);return s}const isNotObjectOrIsArray=e=>!shared.isObject(e)||shared.isArray(e);function deepCopy(e,a){if(isNotObjectOrIsArray(e)||isNotObjectOrIsArray(a))throw createI18nError(20);for(const t in e)shared.hasOwn(e,t)&&(isNotObjectOrIsArray(e[t])||isNotObjectOrIsArray(a[t])?a[t]=e[t]:deepCopy(e[t],a[t]))}const getMetaInfo=()=>{var e=vue.getCurrentInstance();return e&&e.type[DEVTOOLS_META]?{[DEVTOOLS_META]:e.type[DEVTOOLS_META]}:null};function createComposer(e={}){const i=e["__root"],a=void 0===i;let t=!shared.isBoolean(e.inheritLocale)||e.inheritLocale;const c=vue.ref(i&&t?i.locale.value:shared.isString(e.locale)?e.locale:"en-US"),u=vue.ref(i&&t?i.fallbackLocale.value:shared.isString(e.fallbackLocale)||shared.isArray(e.fallbackLocale)||shared.isPlainObject(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:c.value),m=vue.ref(getLocaleMessages(c.value,e)),g=vue.ref(shared.isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[c.value]:{}}),d=vue.ref(shared.isPlainObject(e.numberFormats)?e.numberFormats:{[c.value]:{}});let b=i?i.missingWarn:!shared.isBoolean(e.missingWarn)&&!shared.isRegExp(e.missingWarn)||e.missingWarn,p=i?i.fallbackWarn:!shared.isBoolean(e.fallbackWarn)&&!shared.isRegExp(e.fallbackWarn)||e.fallbackWarn,h=i?i.fallbackRoot:!shared.isBoolean(e.fallbackRoot)||e.fallbackRoot,r=!!e.fallbackFormat,s=shared.isFunction(e.missing)?e.missing:null,n=shared.isFunction(e.missing)?defineCoreMissingHandler(e.missing):null,o=shared.isFunction(e.postTranslation)?e.postTranslation:null,l=!shared.isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,f=!!e.escapeParameter;const _=i?i.modifiers:shared.isPlainObject(e.modifiers)?e.modifiers:{};let v=e.pluralRules||i&&i.pluralRules,y;y=coreBase.createCoreContext({version:VERSION,locale:c.value,fallbackLocale:u.value,messages:m.value,datetimeFormats:g.value,numberFormats:d.value,modifiers:_,pluralRules:v,missing:null===n?void 0:n,missingWarn:b,fallbackWarn:p,fallbackFormat:r,unresolving:!0,postTranslation:null===o?void 0:o,warnHtmlMessage:l,escapeParameter:f,__datetimeFormatters:shared.isPlainObject(y)?y.__datetimeFormatters:void 0,__numberFormatters:shared.isPlainObject(y)?y.__numberFormatters:void 0,__v_emitter:shared.isPla
|