123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296 |
- import type { App } from 'vue';
- import type { ComponentInternalInstance } from 'vue';
- import type { ComputedRef } from 'vue';
- import { DateTimeOptions } from '@intlify/core-base';
- import { FallbackLocale } from '@intlify/core-base';
- import type { FallbackLocales } from '@intlify/core-base';
- import { InjectionKey } from 'vue';
- import { DateTimeFormat as IntlDateTimeFormat } from '@intlify/core-base';
- import { DateTimeFormats as IntlDateTimeFormats } from '@intlify/core-base';
- import { FormatMatcher as IntlFormatMatcher } from '@intlify/core-base';
- import { LocaleMatcher as IntlLocaleMatcher } from '@intlify/core-base';
- import { NumberFormat as IntlNumberFormat } from '@intlify/core-base';
- import { NumberFormats as IntlNumberFormats } from '@intlify/core-base';
- import { IsEmptyObject } from '@intlify/core-base';
- import { IsNever } from '@intlify/core-base';
- import { LinkedModifiers } from '@intlify/core-base';
- import { Locale } from '@intlify/core-base';
- import type { LocaleMessage } from '@intlify/core-base';
- import { LocaleMessageDictionary } from '@intlify/core-base';
- import { LocaleMessages } from '@intlify/core-base';
- import { LocaleMessageType } from '@intlify/core-base';
- import { LocaleMessageValue } from '@intlify/core-base';
- import type { LocaleParams } from '@intlify/core-base';
- import { MessageFunction } from '@intlify/core-base';
- import { MessageFunctions } from '@intlify/core-base';
- import type { MessageResolver } from '@intlify/core-base';
- import { NamedValue } from '@intlify/core-base';
- import { NumberOptions } from '@intlify/core-base';
- import type { ObjectDirective } from 'vue';
- import { Path } from '@intlify/core-base';
- import { PathValue } from '@intlify/core-base';
- import type { PickupFormatKeys } from '@intlify/core-base';
- import { PickupFormatPathKeys } from '@intlify/core-base';
- import { PickupKeys } from '@intlify/core-base';
- import type { PickupLocales } from '@intlify/core-base';
- import { PickupPaths } from '@intlify/core-base';
- import { PluralizationRule } from '@intlify/core-base';
- import type { PluralizationRules } from '@intlify/core-base';
- import { PostTranslationHandler } from '@intlify/core-base';
- import type { RemoveIndexSignature } from '@intlify/core-base';
- import type { ResourcePath } from '@intlify/core-base';
- import type { ResourceValue } from '@intlify/core-base';
- import type { SchemaParams } from '@intlify/core-base';
- import { TranslateOptions } from '@intlify/core-base';
- import type { VNode } from 'vue';
- import type { WritableComputedRef } from 'vue';
- /**
- * BaseFormat Props for Components that is offered Vue I18n
- *
- * @remarks
- * The interface definitions of the underlying props of components such as Translation, DatetimeFormat, and NumberFormat.
- *
- * @VueI18nComponent
- */
- export declare interface BaseFormatProps {
- /**
- * @remarks
- * Used to wrap the content that is distribute in the slot. If omitted, the slot content is treated as Fragments.
- *
- * You can specify a string-based tag name, such as `p`, or the object for which the component is defined.
- */
- tag?: string | object;
- /**
- * @remarks
- * Specifies the locale to be used for the component.
- *
- * If specified, the global scope or the locale of the parent scope of the target component will not be overridden and the specified locale will be used.
- */
- locale?: Locale;
- /**
- * @remarks
- * Specifies the scope to be used in the target component.
- *
- * You can specify either `global` or `parent`.
- *
- * If `global` is specified, global scope is used, else then `parent` is specified, the scope of the parent of the target component is used.
- *
- * If the parent is a global scope, the global scope is used, if it's a local scope, the local scope is used.
- */
- scope?: ComponetI18nScope;
- /**
- * @remarks
- * A composer instance with an existing scope.
- *
- * This option takes precedence over the `scope` option.
- */
- i18n?: Composer;
- }
- /**
- * Cast to VueI18n legacy compatible type
- *
- * @remarks
- * This API is provided only with [vue-i18n-bridge](https://vue-i18n.intlify.dev/guide/migration/ways.html#what-is-vue-i18n-bridge).
- *
- * The purpose of this function is to convert an {@link I18n} instance created with {@link createI18n | createI18n(legacy: true)} into a `vue-i18n@v8.x` compatible instance of `new VueI18n` in a TypeScript environment.
- *
- * @param i18n - An instance of {@link I18n}
- * @returns A i18n instance which is casted to {@link VueI18n} type
- *
- * @VueI18nTip
- * :new: provided by **vue-i18n-bridge only**
- *
- * @VueI18nGeneral
- */
- export declare const castToVueI18n: (i18n: I18n) => VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>> & {
- install: (Vue: any, options?: any) => void;
- };
- export declare type Choice = number;
- export declare type ComponentInstanceCreatedListener = <Messages>(target: VueI18n<Messages>, global: VueI18n<Messages>) => void;
- export declare type ComponetI18nScope = Exclude<I18nScope, 'local'>;
- /**
- * Composer interfaces
- *
- * @remarks
- * This is the interface for being used for Vue 3 Composition API.
- *
- * @VueI18nComposition
- */
- export declare interface Composer<Messages = {}, DateTimeFormats = {}, NumberFormats = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = OptionLocale extends Locale ? [ResourceLocales] extends [never] ? Locale : ResourceLocales : OptionLocale | ResourceLocales> extends ComposerCustom {
- /**
- * @remarks
- * Instance ID.
- */
- id: number;
- /**
- * @remarks
- * The current locale this Composer instance is using.
- *
- * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- */
- locale: WritableComputedRef<Locales>;
- /**
- * @remarks
- * The current fallback locales this Composer instance is using.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- fallbackLocale: WritableComputedRef<FallbackLocales<Locales>>;
- /**
- * @remarks
- * Whether inherit the root level locale to the component localization locale.
- *
- * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
- */
- inheritLocale: boolean;
- /**
- * @remarks
- * The list of available locales in `messages` in lexical order.
- */
- readonly availableLocales: Locales[];
- /**
- * @remarks
- * The locale messages of localization.
- *
- * @VueI18nSee [Getting Started](../guide/)
- */
- readonly messages: ComputedRef<{
- [K in keyof Messages]: Messages[K];
- }>;
- /**
- * @remarks
- * The datetime formats of localization.
- *
- * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
- */
- readonly datetimeFormats: ComputedRef<{
- [K in keyof DateTimeFormats]: DateTimeFormats[K];
- }>;
- /**
- * @remarks
- * The number formats of localization.
- *
- * @VueI18nSee [Number Formatting](../guide/essentials/number)
- */
- readonly numberFormats: ComputedRef<{
- [K in keyof NumberFormats]: NumberFormats[K];
- }>;
- /**
- * @remarks
- * Custom Modifiers for linked messages.
- *
- * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
- */
- readonly modifiers: LinkedModifiers<VueMessageType>;
- /**
- * @remarks
- * A set of rules for word pluralization
- *
- * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
- */
- readonly pluralRules: PluralizationRules;
- /**
- * @remarks
- * Whether this composer instance is global or not
- */
- readonly isGlobal: boolean;
- /**
- * @remarks
- * Whether suppress warnings outputted when localization fails.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- missingWarn: boolean | RegExp;
- /**
- * @remarks
- * Whether suppress fall back warnings when localization fails.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- fallbackWarn: boolean | RegExp;
- /**
- * @remarks
- * Whether to fall back to root level (global scope) localization when localization fails.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- fallbackRoot: boolean;
- /**
- * @remarks
- * Whether suppress warnings when falling back to either `fallbackLocale` or root.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- fallbackFormat: boolean;
- /**
- * @remarks
- * Whether to allow the use locale messages of HTML formatting.
- *
- * If you set `false`, will check the locale messages on the Composer instance.
- *
- * If you are specified `true`, a warning will be output at console.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
- */
- warnHtmlMessage: boolean;
- /**
- * @remarks
- * Whether interpolation parameters are escaped before the message is translated.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- */
- escapeParameter: boolean;
- /**
- * Locale message translation
- *
- * @remarks
- * About details functions, See the {@link ComposerTranslation}
- */
- t: ComposerTranslation<Messages, Locales, RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }>>;
- /**
- * Resolve locale message translation
- *
- * @remarks
- * About details functions, See the {@link ComposerResolveLocaleMessageTranslation}
- */
- rt: ComposerResolveLocaleMessageTranslation<Locales>;
- /**
- * Datetime formatting
- *
- * @remarks
- * About details functions, See the {@link ComposerDateTimeFormatting}
- */
- d: ComposerDateTimeFormatting<DateTimeFormats, Locales, RemoveIndexSignature<{
- [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
- }>>;
- /**
- * Number Formatting
- *
- * @remarks
- * About details functions, See the {@link ComposerNumberFormatting}
- */
- n: ComposerNumberFormatting<NumberFormats, Locales, RemoveIndexSignature<{
- [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
- }>>;
- /**
- * Translation locale message exist
- *
- * @remarks
- * whether do exist locale message on Composer instance [messages](composition#messages).
- *
- * If you specified `locale`, check the locale messages of `locale`.
- *
- * @param key - A target locale message key
- * @param locale - A locale, it will be used over than global scope or local scope
- *
- * @returns If found locale message, `true`, else `false`
- */
- te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
- /**
- * Locale messages getter
- *
- * @remarks
- * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
- *
- * Based on the current `locale`, locale messages will be returned from Composer instance messages.
- *
- * If you change the `locale`, the locale messages returned will also correspond to the locale.
- *
- * If there are no locale messages for the given `key` in the composer instance messages, they will be returned with [fallbacking](../guide/essentials/fallback).
- *
- * @VueI18nWarning
- * You need to use `rt` for the locale message returned by `tm`. see the [rt](composition#rt-message) details.
- *
- * @example
- * template block:
- * ```html
- * <div class="container">
- * <template v-for="content in tm('contents')">
- * <h2>{{ rt(content.title) }}</h2>
- * <p v-for="paragraph in content.paragraphs">
- * {{ rt(paragraph) }}
- * </p>
- * </template>
- * </div>
- * ```
- * script block:
- * ```js
- * import { defineComponent } from 'vue
- * import { useI18n } from 'vue-i18n'
- *
- * export default defineComponent({
- * setup() {
- * const { rt, tm } = useI18n({
- * messages: {
- * en: {
- * contents: [
- * {
- * title: 'Title1',
- * // ...
- * paragraphs: [
- * // ...
- * ]
- * }
- * ]
- * }
- * }
- * // ...
- * })
- * // ...
- * return { ... , rt, tm }
- * }
- * })
- * ```
- *
- * @param key - A target locale message key
- *
- * @return Locale messages
- */
- tm<Key extends string, ResourceKeys extends PickupKeys<Messages> = PickupKeys<Messages>, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Target = IsEmptyObject<Messages> extends false ? NonNullable<Messages>[Locale] : RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }>, Return = ResourceKeys extends ResourcePath<Target> ? ResourceValue<Target, ResourceKeys> : Record<string, any>>(key: Key | ResourceKeys): Return;
- /**
- * Get locale message
- *
- * @remarks
- * get locale message from Composer instance [messages](composition#messages).
- *
- * @param locale - A target locale
- *
- * @typeParam MessageSchema - The locale message schema, default `never`
- *
- * @returns Locale messages
- */
- getLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Return = IsNever<MessageSchema> extends true ? IsEmptyObject<Messages> extends true ? RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }> : NonNullable<Messages>[Locale] : MessageSchema>(locale: LocaleSchema | Locale): Return;
- /**
- * Set locale message
- *
- * @remarks
- * Set locale message to Composer instance [messages](composition#messages).
- *
- * @param locale - A target locale
- * @param message - A message
- *
- * @typeParam MessageSchema - The locale message schema, default `never`
- */
- setLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, MessageType = IsNever<MessageSchema> extends true ? IsEmptyObject<Messages> extends true ? RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }> : NonNullable<Messages>[Locale] : MessageSchema, Message extends MessageType = MessageType>(locale: LocaleSchema | Locale, message: Message): void;
- /**
- * Merge locale message
- *
- * @remarks
- * Merge locale message to Composer instance [messages](composition#messages).
- *
- * @param locale - A target locale
- * @param message - A message
- *
- * @typeParam MessageSchema - The locale message schema, default `never`
- */
- mergeLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Message = IsNever<MessageSchema> extends true ? Record<string, any> : MessageSchema>(locale: LocaleSchema | Locale, message: Message): void;
- /**
- * Get datetime format
- *
- * @remarks
- * get datetime format from Composer instance [datetimeFormats](composition#datetimeformats).
- *
- * @param locale - A target locale
- *
- * @typeParam DateTimeSchema - The datetime format schema, default `never`
- *
- * @returns Datetime format
- */
- getDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, Return = IsNever<DateTimeSchema> extends true ? IsEmptyObject<DateTimeFormats> extends true ? RemoveIndexSignature<{
- [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
- }> : NonNullable<DateTimeFormats>[Locale] : DateTimeSchema>(locale: LocaleSchema | Locale): Return;
- /**
- * Set datetime format
- *
- * @remarks
- * Set datetime format to Composer instance [datetimeFormats](composition#datetimeformats).
- *
- * @param locale - A target locale
- * @param format - A target datetime format
- *
- * @typeParam DateTimeSchema - The datetime format schema, default `never`
- */
- setDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, FormatsType = IsNever<DateTimeSchema> extends true ? IsEmptyObject<DateTimeFormats> extends true ? RemoveIndexSignature<{
- [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
- }> : NonNullable<DateTimeFormats>[Locale] : DateTimeSchema, Formats extends FormatsType = FormatsType>(locale: LocaleSchema | Locale, format: Formats): void;
- /**
- * Merge datetime format
- *
- * @remarks
- * Merge datetime format to Composer instance [datetimeFormats](composition#datetimeformats).
- *
- * @param locale - A target locale
- * @param format - A target datetime format
- *
- * @typeParam DateTimeSchema - The datetime format schema, default `never`
- */
- mergeDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, Formats = IsNever<DateTimeSchema> extends true ? Record<string, any> : DateTimeSchema>(locale: LocaleSchema | Locale, format: Formats): void;
- /**
- * Get number format
- *
- * @remarks
- * get number format from Composer instance [numberFormats](composition#numberFormats).
- *
- * @param locale - A target locale
- *
- * @typeParam NumberSchema - The number format schema, default `never`
- *
- * @returns Number format
- */
- getNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, Return = IsNever<NumberSchema> extends true ? IsEmptyObject<NumberFormats> extends true ? RemoveIndexSignature<{
- [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
- }> : NonNullable<NumberFormats>[Locale] : NumberSchema>(locale: LocaleSchema | Locale): Return;
- /**
- * Set number format
- *
- * @remarks
- * Set number format to Composer instance [numberFormats](composition#numberFormats).
- *
- * @param locale - A target locale
- * @param format - A target number format
- *
- * @typeParam NumberSchema - The number format schema, default `never`
- */
- setNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, FormatsType = IsNever<NumberSchema> extends true ? IsEmptyObject<NumberFormats> extends true ? RemoveIndexSignature<{
- [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
- }> : NonNullable<NumberFormats>[Locale] : NumberSchema, Formats extends FormatsType = FormatsType>(locale: LocaleSchema | Locale, format: Formats): void;
- /**
- * Merge number format
- *
- * @remarks
- * Merge number format to Composer instance [numberFormats](composition#numberFormats).
- *
- * @param locale - A target locale
- * @param format - A target number format
- *
- * @typeParam NumberSchema - The number format schema, default `never`
- */
- mergeNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, Formats = IsNever<NumberSchema> extends true ? Record<string, any> : NumberSchema>(locale: LocaleSchema | Locale, format: Formats): void;
- /**
- * Get post translation handler
- *
- * @returns {@link PostTranslationHandler}
- *
- * @VueI18nSee [missing](composition#posttranslation)
- */
- getPostTranslationHandler(): PostTranslationHandler<VueMessageType> | null;
- /**
- * Set post translation handler
- *
- * @param handler - A {@link PostTranslationHandler}
- *
- * @VueI18nSee [missing](composition#posttranslation)
- */
- setPostTranslationHandler(handler: PostTranslationHandler<VueMessageType> | null): void;
- /**
- * Get missing handler
- *
- * @returns {@link MissingHandler}
- *
- * @VueI18nSee [missing](composition#missing)
- */
- getMissingHandler(): MissingHandler | null;
- /**
- * Set missing handler
- *
- * @param handler - A {@link MissingHandler}
- *
- * @VueI18nSee [missing](composition#missing)
- */
- setMissingHandler(handler: MissingHandler | null): void;
- }
- /**
- * Composer additional options for `useI18n`
- *
- * @remarks
- * `ComposerAdditionalOptions` is extend for {@link ComposerOptions}, so you can specify these options.
- *
- * @VueI18nSee [useI18n](composition#usei18n)
- *
- * @VueI18nComposition
- */
- export declare interface ComposerAdditionalOptions {
- useScope?: I18nScope;
- }
- /**
- * The type custom definition of Composer
- *
- * @remarks
- *
- * The interface that can extend Composer.
- *
- * The type defined by 3rd party (e.g. nuxt/i18n)
- *
- * @example
- * ```ts
- * // vue-i18n.d.ts (`.d.ts` file at your app)
- *
- * declare module 'vue-i18n' {
- * interface ComposerCustom {
- * localeCodes: string[]
- * }
- * }
- * ```
- *
- * @VueI18nComposition
- */
- export declare interface ComposerCustom {
- }
- /**
- * Datetime formatting functions
- *
- * @remarks
- * This is the interface for {@link Composer}
- *
- * @VueI18nComposition
- */
- export declare interface ComposerDateTimeFormatting<DateTimeFormats = {}, Locales = 'en-US', DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>, C = IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K];
- }> : never, M = IsEmptyObject<DateTimeFormats> extends false ? PickupFormatKeys<DateTimeFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Datetime formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
- *
- * If not, then it’s formatted with global scope datetime formats.
- *
- * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
- *
- * @returns Formatted value
- *
- * @VueI18nSee [Datetime formatting](../guide/essentials/datetime)
- */
- (value: number | Date | string): string;
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `d`. About details, see the [call signature](composition#value-number-date-string-string) details.
- *
- * In this overloaded `d`, format in datetime format for a key registered in datetime formats.
- *
- * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
- * @param keyOrOptions - A key of datetime formats, or additional {@link DateTimeOptions | options} for datetime formatting
- *
- * @returns Formatted value
- */
- <Value extends number | Date | string = number, Key extends string = string>(value: Value, keyOrOptions: Key | ResourceKeys | DateTimeOptions<Key | ResourceKeys, Locales>): string;
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `d`. About details, see the [call signature](composition#value-number-date-string-string) details.
- *
- * In this overloaded `d`, format in datetime format for a key registered in datetime formats at target locale
- *
- * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
- * @param keyOrOptions - A key of datetime formats, or additional {@link DateTimeOptions | options} for datetime formatting
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Formatted value
- */
- <Value extends number | Date | string = number, Key extends string = string>(value: Value, keyOrOptions: Key | ResourceKeys | DateTimeOptions<Key | ResourceKeys, Locales>, locale: Locales): string;
- }
- /**
- * Number formatting functions
- *
- * @remarks
- * This is the interface for {@link Composer}
- *
- * @VueI18nComposition
- */
- export declare interface ComposerNumberFormatting<NumberFormats = {}, Locales = 'en-US', DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> = RemovedIndexResources<DefineNumberFormat>, C = IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K];
- }> : never, M = IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Number Formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
- *
- * If not, then it’s formatted with global scope number formats.
- *
- * @param value - A number value
- *
- * @returns Formatted value
- *
- * @VueI18nSee [Number formatting](../guide/essentials/number)
- */
- (value: number): string;
- /**
- * Number Formatting
- *
- * @remarks
- * Overloaded `n`. About details, see the [call signature](composition#value-number-string) details.
- *
- * In this overloaded `n`, format in number format for a key registered in number formats.
- *
- * @param value - A number value
- * @param keyOrOptions - A key of number formats, or additional {@link NumberOptions | options} for number formatting
- *
- * @returns Formatted value
- */
- <Key extends string = string>(value: number, keyOrOptions: Key | ResourceKeys | NumberOptions<Key | ResourceKeys, Locales>): string;
- /**
- * Number Formatting
- *
- * @remarks
- * Overloaded `n`. About details, see the [call signature](composition#value-number-string) details.
- *
- * In this overloaded `n`, format in number format for a key registered in number formats at target locale.
- *
- * @param value - A number value
- * @param keyOrOptions - A key of number formats, or additional {@link NumberOptions | options} for number formatting
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Formatted value
- */
- <Key extends string = string>(value: number, keyOrOptions: Key | ResourceKeys | NumberOptions<Key | ResourceKeys, Locales>, locale: Locales): string;
- }
- /**
- * Composer Options
- *
- * @remarks
- * This is options to create composer.
- *
- * @VueI18nComposition
- */
- export declare interface ComposerOptions<Schema extends {
- message?: unknown;
- datetime?: unknown;
- number?: unknown;
- } = {
- message: DefaultLocaleMessageSchema;
- datetime: DefaultDateTimeFormatSchema;
- number: DefaultNumberFormatSchema;
- }, Locales extends {
- messages: unknown;
- datetimeFormats: unknown;
- numberFormats: unknown;
- } | string = Locale, MessagesLocales = Locales extends {
- messages: infer M;
- } ? M : Locales extends string ? Locales : Locale, DateTimeFormatsLocales = Locales extends {
- datetimeFormats: infer D;
- } ? D : Locales extends string ? Locales : Locale, NumberFormatsLocales = Locales extends {
- numberFormats: infer N;
- } ? N : Locales extends string ? Locales : Locale, MessageSchema = Schema extends {
- message: infer M;
- } ? M : DefaultLocaleMessageSchema, DateTimeSchema = Schema extends {
- datetime: infer D;
- } ? D : DefaultDateTimeFormatSchema, NumberSchema = Schema extends {
- number: infer N;
- } ? N : DefaultNumberFormatSchema, _Messages extends LocaleMessages<MessageSchema, MessagesLocales, VueMessageType> = LocaleMessages<MessageSchema, MessagesLocales, VueMessageType>, _DateTimeFormats extends IntlDateTimeFormats<DateTimeSchema, DateTimeFormatsLocales> = IntlDateTimeFormats<DateTimeSchema, DateTimeFormatsLocales>, _NumberFormats extends IntlNumberFormats<NumberSchema, NumberFormatsLocales> = IntlNumberFormats<NumberSchema, NumberFormatsLocales>> {
- /**
- * @remarks
- * The locale of localization.
- *
- * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- *
- * @defaultValue `'en-US'`
- */
- locale?: Locale;
- /**
- * @remarks
- * The locale of fallback localization.
- *
- * For more complex fallback definitions see fallback.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue The default `'en-US'` for the `locale` if it's not specified, or it's `locale` value
- */
- fallbackLocale?: FallbackLocale;
- /**
- * @remarks
- * Whether inheritance the root level locale to the component localization locale.
- *
- * If `false`, regardless of the root level locale, localize for each component locale.
- *
- * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
- *
- * @defaultValue `true`
- */
- inheritLocale?: boolean;
- /**
- * @remarks
- * The locale messages of localization.
- *
- * @VueI18nSee [Getting Started](../guide/)
- *
- * @defaultValue `{}`
- */
- messages?: {
- [K in keyof _Messages]: MessageSchema;
- };
- /**
- * @remarks
- * Allow use flat json messages or not
- *
- * @defaultValue `false`
- */
- flatJson?: boolean;
- /**
- * @remarks
- * The datetime formats of localization.
- *
- * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
- *
- * @defaultValue `{}`
- */
- datetimeFormats?: {
- [K in keyof _DateTimeFormats]: DateTimeSchema;
- };
- /**
- * @remarks
- * The number formats of localization.
- *
- * @VueI18nSee [Number Formatting](../guide/essentials/number)
- *
- * @defaultValue `{}`
- */
- numberFormats?: {
- [K in keyof _NumberFormats]: NumberSchema;
- };
- /**
- * @remarks
- * Custom Modifiers for linked messages.
- *
- * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
- */
- modifiers?: LinkedModifiers<VueMessageType>;
- /**
- * @remarks
- * A set of rules for word pluralization
- *
- * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
- *
- * @defaultValue `{}`
- */
- pluralRules?: PluralizationRules;
- /**
- * @remarks
- * A handler for localization missing.
- *
- * The handler gets called with the localization target locale, localization path key, the Vue instance and values.
- *
- * If missing handler is assigned, and occurred localization missing, it's not warned.
- *
- * @defaultValue `null`
- */
- missing?: MissingHandler;
- /**
- * @remarks
- * Whether suppress warnings outputted when localization fails.
- *
- * If `false`, suppress localization fail warnings.
- *
- * If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `true`
- */
- missingWarn?: boolean | RegExp;
- /**
- * @remarks
- * Whether suppress warnings when falling back to either `fallbackLocale` or root.
- *
- * If `false`, suppress fall back warnings.
- *
- * If you use regular expression, you can suppress fallback warnings that it match with translation key (e.g. `t`).
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `true`
- */
- fallbackWarn?: boolean | RegExp;
- /**
- * @remarks
- * In the component localization, whether to fallback to root level (global scope) localization when localization fails.
- *
- * If `false`, it's not fallback to root.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `true`
- */
- fallbackRoot?: boolean;
- /**
- * @remarks
- * Whether do template interpolation on translation keys when your language lacks a translation for a key.
- *
- * If `true`, skip writing templates for your "base" language; the keys are your templates.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `false`
- */
- fallbackFormat?: boolean;
- /**
- * @remarks
- * A handler for post processing of translation.
- *
- * The handler gets after being called with the `t`.
- *
- * This handler is useful if you want to filter on translated text such as space trimming.
- *
- * @defaultValue `null`
- */
- postTranslation?: PostTranslationHandler<VueMessageType>;
- /**
- * @remarks
- * Whether to allow the use locale messages of HTML formatting.
- *
- * See the warnHtmlMessage property.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
- *
- * @defaultValue `'off'`
- */
- warnHtmlMessage?: boolean;
- /**
- * @remarks
- * If `escapeParameter` is configured as true then interpolation parameters are escaped before the message is translated.
- *
- * This is useful when translation output is used in `v-html` and the translation resource contains html markup (e.g. <b> around a user provided value).
- *
- * This usage pattern mostly occurs when passing precomputed text strings into UI components.
- *
- * The escape process involves replacing the following symbols with their respective HTML character entities: `<`, `>`, `"`, `'`.
- *
- * Setting `escapeParameter` as true should not break existing functionality but provides a safeguard against a subtle type of XSS attack vectors.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- *
- * @defaultValue `false`
- */
- escapeParameter?: boolean;
- /**
- * @remarks
- * A message resolver to resolve [`messages`](composition#messages).
- *
- * If not specified, the vue-i18n internal message resolver will be used by default.
- *
- * You need to implement a message resolver yourself that supports the following requirements:
- *
- * - Resolve the message using the locale message of [`locale`](composition#locale) passed as the first argument of the message resolver, and the path passed as the second argument.
- *
- * - If the message could not be resolved, you need to return `null`.
- *
- * - If you will be returned `null`, the message resolver will also be called on fallback if [`fallbackLocale`](composition#fallbacklocale-2) is enabled, so the message will need to be resolved as well.
- *
- * The message resolver is called indirectly by the following APIs:
- *
- * - [`t`](composition#t-key)
- *
- * - [`te`](composition#te-key-locale)
- *
- * - [`tm`](composition#tm-key)
- *
- * - [Translation component](component#translation)
- *
- * @example
- * Here is an example of how to set it up using your `createI18n`:
- * ```js
- * import { createI18n } from 'vue-i18n'
- *
- * // your message resolver
- * function messageResolver(obj, path) {
- * // simple message resolving!
- * const msg = obj[path]
- * return msg != null ? msg : null
- * }
- *
- * // call with I18n option
- * const i18n = createI18n({
- * legacy: false,
- * locale: 'ja',
- * messageResolver, // set your message resolver
- * messages: {
- * en: { ... },
- * ja: { ... }
- * }
- * })
- *
- * // the below your something to do ...
- * // ...
- * ```
- *
- * @VueI18nTip
- * :new: v9.2+
- *
- * @VueI18nWarning
- * If you use the message resolver, the [`flatJson`](composition#flatjson) setting will be ignored. That is, you need to resolve the flat JSON by yourself.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `undefined`
- */
- messageResolver?: MessageResolver;
- }
- /**
- * Resolve locale message translation functions
- *
- * @remarks
- * This is the interface for {@link Composer}
- *
- * @VueI18nComposition
- */
- export declare interface ComposerResolveLocaleMessageTranslation<Locales = 'en-US'> {
- /**
- * Resolve locale message translation
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
- *
- * If not, then it’s translated with global scope locale messages.
- *
- * @VueI18nTip
- * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
- *
- * @VueI18nWarning
- * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
- *
- * @returns Translated message
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- */
- (message: MessageFunction<VueMessageType> | VueMessageType): string;
- /**
- * Resolve locale message translation for plurals
- *
- * @remarks
- * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
- *
- * In this overloaded `rt`, return a pluralized translation message.
- *
- * @VueI18nTip
- * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
- *
- * @VueI18nWarning
- * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
- * @param plural - Which plural string to get. 1 returns the first one.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- */
- (message: MessageFunction<VueMessageType> | VueMessageType, plural: number, options?: TranslateOptions<Locales>): string;
- /**
- * Resolve locale message translation for list interpolations
- *
- * @remarks
- * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
- *
- * In this overloaded `rt`, return a pluralized translation message.
- *
- * @VueI18nTip
- * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
- *
- * @VueI18nWarning
- * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
- * @param list - A values of list interpolation.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- (message: MessageFunction<VueMessageType> | VueMessageType, list: unknown[], options?: TranslateOptions<Locales>): string;
- /**
- * Resolve locale message translation for named interpolations
- *
- * @remarks
- * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
- *
- * In this overloaded `rt`, for each placeholder x, the locale messages should contain a `{x}` token.
- *
- * @VueI18nTip
- * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
- *
- * @VueI18nWarning
- * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
- * @param named - A values of named interpolation.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- (message: MessageFunction<VueMessageType> | VueMessageType, named: NamedValue, options?: TranslateOptions<Locales>): string;
- }
- /**
- * Locale message translation functions
- *
- * @remarks
- * This is the interface for {@link Composer}
- *
- * @VueI18nComposition
- */
- export declare interface ComposerTranslation<Messages = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
- }> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Locale message translation
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
- *
- * If not, then it’s translated with global scope locale messages.
- *
- * @param key - A target locale message key
- *
- * @returns Translated message
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- */
- <Key extends string>(key: Key | ResourceKeys | number): string;
- /**
- * Locale message translation for plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, return a pluralized translation message.
- *
- * You can also suppress the warning, when the translation missing according to the options.
- *
- * About details of options, see the {@link TranslateOptions}.
- *
- * @param key - A target locale message key
- * @param plural - Which plural string to get. 1 returns the first one.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- */
- <Key extends string>(key: Key | ResourceKeys | number, plural: number, options?: TranslateOptions<Locales>): string;
- /**
- * Locale message translation for missing default message
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, if no translation was found, return a default message.
- *
- * You can also suppress the warning, when the translation missing according to the options.
- *
- * About details of options, see the {@link TranslateOptions}.
- *
- * @param key - A target locale message key
- * @param defaultMsg - A default message to return if no translation was found
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- */
- <Key extends string>(key: Key | ResourceKeys | number, defaultMsg: string, options?: TranslateOptions<Locales>): string;
- /**
- * Locale message translation for list interpolations
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list.
- *
- * You can also suppress the warning, when the translation missing according to the options.
- *
- * About details of options, see the {@link TranslateOptions}.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], options?: TranslateOptions<Locales>): string;
- /**
- * Locale message translation for list interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list, and return a pluralized translation message.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param plural - Which plural string to get. 1 returns the first one.
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], plural: number): string;
- /**
- * Locale message translation for list interpolations and missing default message
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list, and if no translation was found, return a default message.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns Translated message
- *
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], defaultMsg: string): string;
- /**
- * Locale message translation for named interpolations
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token.
- *
- * You can also suppress the warning, when the translation missing according to the options.
- *
- * About details of options, see the {@link TranslateOptions}.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, options?: TranslateOptions<Locales>): string;
- /**
- * Locale message translation for named interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token, and return a pluralized translation message.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param plural - Which plural string to get. 1 returns the first one.
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, plural: number): string;
- /**
- * Locale message translation for named interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
- *
- * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token, and if no translation was found, return a default message.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns Translated message
- *
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, defaultMsg: string): string;
- }
- export declare function createI18n<Legacy extends boolean = true, Options extends I18nOptions = I18nOptions, Messages = Options['messages'] extends object ? Options['messages'] : {}, DateTimeFormats = Options['datetimeFormats'] extends object ? Options['datetimeFormats'] : {}, NumberFormats = Options['numberFormats'] extends object ? Options['numberFormats'] : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options, LegacyVueI18n?: any): typeof options['legacy'] extends true ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, true> : typeof options['legacy'] extends false ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, false> : I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
- /**
- * Vue I18n factory
- *
- * @param options - An options, see the {@link I18nOptions}
- *
- * @typeParam Schema - The i18n resources (messages, datetimeFormats, numberFormats) schema, default {@link LocaleMessage}
- * @typeParam Locales - The locales of i18n resource schema, default `en-US`
- * @typeParam Legacy - Whether legacy mode is enabled or disabled, default `true`
- *
- * @returns {@link I18n} instance
- *
- * @remarks
- * If you use Legacy API mode, you need toto specify {@link VueI18nOptions} and `legacy: true` option.
- *
- * If you use composition API mode, you need to specify {@link ComposerOptions}.
- *
- * @VueI18nSee [Getting Started](../guide/)
- * @VueI18nSee [Composition API](../guide/advanced/composition)
- *
- * @example
- * case: for Legacy API
- * ```js
- * import { createApp } from 'vue'
- * import { createI18n } from 'vue-i18n'
- *
- * // call with I18n option
- * const i18n = createI18n({
- * locale: 'ja',
- * messages: {
- * en: { ... },
- * ja: { ... }
- * }
- * })
- *
- * const App = {
- * // ...
- * }
- *
- * const app = createApp(App)
- *
- * // install!
- * app.use(i18n)
- * app.mount('#app')
- * ```
- *
- * @example
- * case: for composition API
- * ```js
- * import { createApp } from 'vue'
- * import { createI18n, useI18n } from 'vue-i18n'
- *
- * // call with I18n option
- * const i18n = createI18n({
- * legacy: false, // you must specify 'legacy: false' option
- * locale: 'ja',
- * messages: {
- * en: { ... },
- * ja: { ... }
- * }
- * })
- *
- * const App = {
- * setup() {
- * // ...
- * const { t } = useI18n({ ... })
- * return { ... , t }
- * }
- * }
- *
- * const app = createApp(App)
- *
- * // install!
- * app.use(i18n)
- * app.mount('#app')
- * ```
- *
- * @VueI18nGeneral
- */
- export declare function createI18n<Schema extends object = DefaultLocaleMessageSchema, Locales extends string | object = 'en-US', Legacy extends boolean = true, Options extends I18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>> = I18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>>, Messages = Options['messages'] extends object ? Options['messages'] : {}, DateTimeFormats = Options['datetimeFormats'] extends object ? Options['datetimeFormats'] : {}, NumberFormats = Options['numberFormats'] extends object ? Options['numberFormats'] : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options, LegacyVueI18n?: any): typeof options['legacy'] extends true ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, true> : typeof options['legacy'] extends false ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, false> : I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
- export declare interface CustomBlock<Message = VueMessageType> {
- locale: Locale;
- resource: LocaleMessages<Message>;
- }
- export declare type CustomBlocks<Message = VueMessageType> = Array<CustomBlock<Message>>;
- /**
- * Datetime Format Component
- *
- * @remarks
- * See the following items for property about details
- *
- * @VueI18nSee [FormattableProps](component#formattableprops)
- * @VueI18nSee [BaseFormatProps](component#baseformatprops)
- * @VueI18nSee [Custom Formatting](../guide/essentials/datetime#custom-formatting)
- *
- * @VueI18nDanger
- * Not supported IE, due to no support `Intl.DateTimeFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
- *
- * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-datetimeformat)
- *
- * @VueI18nComponent
- */
- export declare const DatetimeFormat: {
- name: string;
- props: {
- value: {
- type: (NumberConstructor | DateConstructor)[];
- required: boolean;
- };
- format: {
- type: (ObjectConstructor | StringConstructor)[];
- };
- } & {
- tag: {
- type: (ObjectConstructor | StringConstructor)[];
- };
- locale: {
- type: StringConstructor;
- };
- scope: {
- type: StringConstructor;
- validator: (val: "parent" | "global") => boolean;
- default: "parent" | "global";
- };
- i18n: {
- type: ObjectConstructor;
- };
- };
- setup(props: any, context: any): any;
- };
- /**
- * DatetimeFormat Component Props
- *
- * @VueI18nComponent
- */
- export declare type DatetimeFormatProps = FormattableProps<number | Date, Intl.DateTimeFormatOptions>;
- /** @VueI18nLegacy */
- export declare type DateTimeFormatResult = string;
- export { DateTimeOptions }
- export declare type DefaultDateTimeFormatSchema<Schema = RemoveIndexSignature<{
- [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
- }>> = IsEmptyObject<Schema> extends true ? IntlDateTimeFormat : Schema;
- export declare type DefaultLocaleMessageSchema<Schema = RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }>> = IsEmptyObject<Schema> extends true ? LocaleMessage<VueMessageType> : Schema;
- export declare type DefaultNumberFormatSchema<Schema = RemoveIndexSignature<{
- [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
- }>> = IsEmptyObject<Schema> extends true ? IntlNumberFormat : Schema;
- /**
- * The type definition of datetime format
- *
- * @remarks
- * The typealias is used to strictly define the type of the Datetime format.
- *
- * The type defined by this can be used in the global scope.
- *
- * @example
- * ```ts
- * // type.d.ts (`.d.ts` file at your app)
- * import { DefineDateTimeFormat } from 'vue-i18n'
- *
- * declare module 'vue-i18n' {
- * export interface DefineDateTimeFormat {
- * short: {
- * hour: 'numeric'
- * timezone: string
- * }
- * }
- * }
- * ```
- *
- * @VueI18nGeneral
- */
- export declare interface DefineDateTimeFormat extends IntlDateTimeFormat {
- }
- /**
- * The type definition of Locale Message
- *
- * @remarks
- * The typealias is used to strictly define the type of the Locale message.
- *
- * The type defined by this can be used in the global scope.
- *
- * @example
- * ```ts
- * // type.d.ts (`.d.ts` file at your app)
- * import { DefineLocaleMessage } from 'vue-i18n'
- *
- * declare module 'vue-i18n' {
- * export interface DefineLocaleMessage {
- * title: string
- * menu: {
- * login: string
- * }
- * }
- * }
- * ```
- *
- * @VueI18nGeneral
- */
- export declare interface DefineLocaleMessage extends LocaleMessage<VueMessageType> {
- }
- /**
- * The type definition of number format
- *
- * @remarks
- * The typealias is used to strictly define the type of the Number format.
- *
- * The type defined by this can be used in the global scope.
- *
- * @example
- * ```ts
- * // type.d.ts (`.d.ts` file at your app)
- * import { DefineNumberFormat } from 'vue-i18n'
- *
- * declare module 'vue-i18n' {
- * export interface DefineNumberFormat {
- * currency: {
- * style: 'currency'
- * currencyDisplay: 'symbol'
- * currency: string
- * }
- * }
- * }
- * ```
- *
- * @VueI18nGeneral
- */
- export declare interface DefineNumberFormat extends IntlNumberFormat {
- }
- /**
- * Exported global composer instance
- *
- * @remarks
- * This interface is the [global composer](general#global) that is provided interface that is injected into each component with `app.config.globalProperties`.
- *
- * @VueI18nGeneral
- */
- export declare interface ExportedGlobalComposer {
- /**
- * Locale
- *
- * @remarks
- * This property is proxy-like property for `Composer#locale`. About details, see the [Composer#locale](composition#locale)
- */
- locale: Locale;
- /**
- * Fallback locale
- *
- * @remarks
- * This property is proxy-like property for `Composer#fallbackLocale`. About details, see the [Composer#fallbackLocale](composition#fallbacklocale)
- */
- fallbackLocale: FallbackLocale;
- /**
- * Available locales
- *
- * @remarks
- * This property is proxy-like property for `Composer#availableLocales`. About details, see the [Composer#availableLocales](composition#availablelocales)
- */
- readonly availableLocales: Locale[];
- }
- export { FallbackLocale }
- /**
- * Formattable Props
- *
- * @remarks
- * The props used in DatetimeFormat, or NumberFormat component
- *
- * @VueI18nComponent
- */
- export declare interface FormattableProps<Value, Format> extends BaseFormatProps {
- /**
- * @remarks
- * The value specified for the target component
- */
- value: Value;
- /**
- * @remarks
- * The format to use in the target component.
- *
- * Specify the format key string or the format as defined by the Intl API in ECMA 402.
- */
- format?: string | Format;
- }
- export declare interface Formatter {
- interpolate(message: string, values: any, path: string): Array<any> | null;
- }
- /**
- * I18n instance
- *
- * @remarks
- * The instance required for installation as the Vue plugin
- *
- * @VueI18nGeneral
- */
- export declare interface I18n<Messages = {}, DateTimeFormats = {}, NumberFormats = {}, OptionLocale = Locale, Legacy = boolean> {
- /**
- * Vue I18n API mode
- *
- * @remarks
- * If you specified `legacy: true` option in `createI18n`, return `legacy`, else `composition`
- *
- * @defaultValue `'legacy'`
- */
- readonly mode: I18nMode;
- /**
- * The property accessible to the global Composer instance or VueI18n instance
- *
- * @remarks
- * If the [I18n#mode](general#mode) is `'legacy'`, then you can access to a global {@link VueI18n} instance, else then [I18n#mode](general#mode) is `'composition' `, you can access to the global {@link Composer} instance.
- *
- * An instance of this property is **global scope***.
- */
- readonly global: Legacy extends true ? VueI18n<Messages, DateTimeFormats, NumberFormats, OptionLocale> : Legacy extends false ? Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale> : unknown;
- /**
- * The property whether or not the Composition API is available
- *
- * @remarks
- * If you specified `allowComposition: true` option in Legacy API mode, return `true`, else `false`. else you use the Composition API mode, this property will always return `true`.
- */
- readonly allowComposition: boolean;
- /**
- * Install entry point
- *
- * @param app - A target Vue app instance
- * @param options - An install options
- */
- install(app: App, ...options: unknown[]): void;
- /**
- * Release global scope resource
- */
- dispose(): void;
- }
- /**
- * I18n Additional Options
- *
- * @remarks
- * Specific options for {@link createI18n}
- *
- * @VueI18nGeneral
- */
- export declare interface I18nAdditionalOptions {
- /**
- * Whether vue-i18n Legacy API mode use on your Vue App
- *
- * @remarks
- * The default is to use the Legacy API mode. If you want to use the Composition API mode, you need to set it to `false`.
- *
- * @VueI18nSee [Composition API](../guide/advanced/composition)
- *
- * @defaultValue `true`
- */
- legacy?: boolean;
- /**
- * Whether to inject global properties & functions into for each component.
- *
- * @remarks
- * If set to `true`, then properties and methods prefixed with `$` are injected into Vue Component.
- *
- * @VueI18nSee [Implicit with injected properties and functions](../guide/advanced/composition#implicit-with-injected-properties-and-functions)
- * @VueI18nSee [ComponentCustomProperties](injection#componentcustomproperties)
- *
- * @defaultValue `true`
- */
- globalInjection?: boolean;
- /**
- * Whether to allow the Composition API to be used in Legacy API mode.
- *
- * @remarks
- * If this option is enabled, you can use {@link useI18n} in Legacy API mode. This option is supported to support the migration from Legacy API mode to Composition API mode.
- *
- * @VueI18nWarning Note that the Composition API made available with this option doesn't work on SSR.
- * @VueI18nSee [Composition API](../guide/advanced/composition)
- *
- * @defaultValue `false`
- */
- allowComposition?: boolean;
- }
- /**
- * Injection key for {@link useI18n}
- *
- * @remarks
- * The global injection key for I18n instances with `useI18n`. this injection key is used in Web Components.
- * Specify the i18n instance created by {@link createI18n} together with `provide` function.
- *
- * @VueI18nGeneral
- */
- export declare const I18nInjectionKey: InjectionKey<I18n> | string;
- /**
- * Vue I18n API mode
- *
- * @VueI18nSee [I18n#mode](general#mode)
- *
- * @VueI18nGeneral
- */
- export declare type I18nMode = 'legacy' | 'composition';
- /**
- * I18n Options for `createI18n`
- *
- * @remarks
- * `I18nOptions` is inherited {@link I18nAdditionalOptions}, {@link ComposerOptions} and {@link VueI18nOptions},
- * so you can specify these options.
- *
- * @VueI18nGeneral
- */
- export declare type I18nOptions<Schema extends {
- message?: unknown;
- datetime?: unknown;
- number?: unknown;
- } = {
- message: DefaultLocaleMessageSchema;
- datetime: DefaultDateTimeFormatSchema;
- number: DefaultNumberFormatSchema;
- }, Locales extends {
- messages: unknown;
- datetimeFormats: unknown;
- numberFormats: unknown;
- } | string = Locale, Options extends ComposerOptions<Schema, Locales> | VueI18nOptions<Schema, Locales> = ComposerOptions<Schema, Locales> | VueI18nOptions<Schema, Locales>> = I18nAdditionalOptions & Options;
- /**
- * Vue I18n plugin options
- *
- * @remarks
- * An options specified when installing Vue I18n as Vue plugin with using `app.use`.
- *
- * @VueI18nGeneral
- */
- export declare interface I18nPluginOptions {
- /**
- * Whether to use the tag name `i18n` for Translation Component
- *
- * @remarks
- * This option is used for compatibility with Vue I18n v8.x.
- *
- * If you can't migrate right away, you can temporarily enable this option, and you can work Translation Component.
- *
- * @defaultValue `false`
- */
- useI18nComponentName?: boolean;
- /**
- * Whether to globally install the components that is offered by Vue I18n
- *
- * @remarks
- * If this option is enabled, the components will be installed globally at `app.use` time.
- *
- * If you want to install manually in the `import` syntax, you can set it to `false` to install when needed.
- *
- * @defaultValue `true`
- */
- globalInstall?: boolean;
- }
- /**
- * I18n Scope
- *
- * @VueI18nSee [ComposerAdditionalOptions#useScope](composition#usescope)
- * @VueI18nSee [useI18n](composition#usei18n)
- *
- * @VueI18nGeneral
- */
- export declare type I18nScope = 'local' | 'parent' | 'global';
- export { IntlDateTimeFormat }
- export { IntlDateTimeFormats }
- export { IntlFormatMatcher }
- export { IntlLocaleMatcher }
- export { IntlNumberFormat }
- export { IntlNumberFormats }
- export { IsEmptyObject }
- export { IsNever }
- export { LinkedModifiers }
- export { Locale }
- export { LocaleMessageDictionary }
- /** @VueI18nLegacy */
- export declare type LocaleMessageObject<Message = string> = LocaleMessageDictionary<Message>;
- export { LocaleMessages }
- export { LocaleMessageType }
- export { LocaleMessageValue }
- export { MessageFunction }
- export { MessageFunctions }
- /** @VueI18nComposition */
- export declare type MissingHandler = (locale: Locale, key: Path, instance?: ComponentInternalInstance, type?: string) => string | void;
- export { NamedValue }
- /**
- * Number Format Component
- *
- * @remarks
- * See the following items for property about details
- *
- * @VueI18nSee [FormattableProps](component#formattableprops)
- * @VueI18nSee [BaseFormatProps](component#baseformatprops)
- * @VueI18nSee [Custom Formatting](../guide/essentials/number#custom-formatting)
- *
- * @VueI18nDanger
- * Not supported IE, due to no support `Intl.NumberFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
- *
- * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-numberformat)
- *
- * @VueI18nComponent
- */
- export declare const NumberFormat: {
- name: string;
- props: {
- value: {
- type: NumberConstructor;
- required: boolean;
- };
- format: {
- type: (ObjectConstructor | StringConstructor)[];
- };
- } & {
- tag: {
- type: (ObjectConstructor | StringConstructor)[];
- };
- locale: {
- type: StringConstructor;
- };
- scope: {
- type: StringConstructor;
- validator: (val: "parent" | "global") => boolean;
- default: "parent" | "global";
- };
- i18n: {
- type: ObjectConstructor;
- };
- };
- setup(props: any, context: any): any;
- };
- /**
- * NumberFormat Component Props
- *
- * @VueI18nComponent
- */
- export declare type NumberFormatProps = FormattableProps<number, Intl.NumberFormatOptions>;
- /** @VueI18nLegacy */
- export declare type NumberFormatResult = string;
- export { NumberOptions }
- export { Path }
- export { PathValue }
- export { PickupFormatPathKeys }
- export { PickupKeys }
- export { PickupPaths }
- export { PluralizationRule }
- export declare type PluralizationRulesMap = {
- [locale: string]: PluralizationRule;
- };
- export { PostTranslationHandler }
- export declare type RemovedIndexResources<T> = RemoveIndexSignature<{
- [K in keyof T]: T[K];
- }>;
- export { TranslateOptions }
- /** @VueI18nLegacy */
- export declare type TranslateResult = string;
- /**
- * Translation Component
- *
- * @remarks
- * See the following items for property about details
- *
- * @VueI18nSee [TranslationProps](component#translationprops)
- * @VueI18nSee [BaseFormatProps](component#baseformatprops)
- * @VueI18nSee [Component Interpolation](../guide/advanced/component)
- *
- * @example
- * ```html
- * <div id="app">
- * <!-- ... -->
- * <i18n path="term" tag="label" for="tos">
- * <a :href="url" target="_blank">{{ $t('tos') }}</a>
- * </i18n>
- * <!-- ... -->
- * </div>
- * ```
- * ```js
- * import { createApp } from 'vue'
- * import { createI18n } from 'vue-i18n'
- *
- * const messages = {
- * en: {
- * tos: 'Term of Service',
- * term: 'I accept xxx {0}.'
- * },
- * ja: {
- * tos: '利用規約',
- * term: '私は xxx の{0}に同意します。'
- * }
- * }
- *
- * const i18n = createI18n({
- * locale: 'en',
- * messages
- * })
- *
- * const app = createApp({
- * data: {
- * url: '/term'
- * }
- * }).use(i18n).mount('#app')
- * ```
- *
- * @VueI18nComponent
- */
- export declare const Translation: {
- name: string;
- props: {
- keypath: {
- type: StringConstructor;
- required: boolean;
- };
- plural: {
- type: (StringConstructor | NumberConstructor)[];
- validator: (val: any) => boolean;
- };
- } & {
- tag: {
- type: (ObjectConstructor | StringConstructor)[];
- };
- locale: {
- type: StringConstructor;
- };
- scope: {
- type: StringConstructor;
- validator: (val: "parent" | "global") => boolean;
- default: "parent" | "global";
- };
- i18n: {
- type: ObjectConstructor;
- };
- };
- setup(props: any, context: any): any;
- };
- /**
- * Translation Directive (`v-t`)
- *
- * @remarks
- * Update the element `textContent` that localized with locale messages.
- *
- * You can use string syntax or object syntax.
- *
- * String syntax can be specified as a keypath of locale messages.
- *
- * If you can be used object syntax, you need to specify as the object key the following params
- *
- * ```
- * - path: required, key of locale messages
- * - locale: optional, locale
- * - args: optional, for list or named formatting
- * ```
- *
- * @example
- * ```html
- * <!-- string syntax: literal -->
- * <p v-t="'foo.bar'"></p>
- *
- * <!-- string syntax: binding via data or computed props -->
- * <p v-t="msg"></p>
- *
- * <!-- object syntax: literal -->
- * <p v-t="{ path: 'hi', locale: 'ja', args: { name: 'kazupon' } }"></p>
- *
- * <!-- object syntax: binding via data or computed props -->
- * <p v-t="{ path: greeting, args: { name: fullName } }"></p>
- * ```
- *
- * @VueI18nDirective
- */
- export declare type TranslationDirective<T = HTMLElement> = ObjectDirective<T>;
- /**
- * Translation Component Props
- *
- * @VueI18nComponent
- */
- export declare interface TranslationProps extends BaseFormatProps {
- /**
- * @remarks
- * The locale message key can be specified prop
- */
- keypath: string;
- /**
- * @remarks
- * The Plural Choosing the message number prop
- */
- plural?: number | string;
- }
- export declare function useI18n<Options extends UseI18nOptions = UseI18nOptions>(options?: Options): Composer<NonNullable<Options['messages']>, NonNullable<Options['datetimeFormats']>, NonNullable<Options['numberFormats']>, NonNullable<Options['locale']>>;
- /**
- * Use Composition API for Vue I18n
- *
- * @param options - An options, see {@link UseI18nOptions}
- *
- * @typeParam Schema - The i18n resources (messages, datetimeFormats, numberFormats) schema, default {@link LocaleMessage}
- * @typeParam Locales - The locales of i18n resource schema, default `en-US`
- *
- * @returns {@link Composer} instance
- *
- * @remarks
- * This function is mainly used by `setup`.
- *
- * If options are specified, Composer instance is created for each component and you can be localized on the component.
- *
- * If options are not specified, you can be localized using the global Composer.
- *
- * @example
- * case: Component resource base localization
- * ```html
- * <template>
- * <form>
- * <label>{{ t('language') }}</label>
- * <select v-model="locale">
- * <option value="en">en</option>
- * <option value="ja">ja</option>
- * </select>
- * </form>
- * <p>message: {{ t('hello') }}</p>
- * </template>
- *
- * <script>
- * import { useI18n } from 'vue-i18n'
- *
- * export default {
- * setup() {
- * const { t, locale } = useI18n({
- * locale: 'ja',
- * messages: {
- * en: { ... },
- * ja: { ... }
- * }
- * })
- * // Something to do ...
- *
- * return { ..., t, locale }
- * }
- * }
- * </script>
- * ```
- *
- * @VueI18nComposition
- */
- export declare function useI18n<Schema = DefaultLocaleMessageSchema, Locales = 'en-US', Options extends UseI18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>> = UseI18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>>>(options?: Options): Composer<NonNullable<Options['messages']>, NonNullable<Options['datetimeFormats']>, NonNullable<Options['numberFormats']>, NonNullable<Options['locale']>>;
- /**
- * I18n Options for `useI18n`
- *
- * @remarks
- * `UseI18nOptions` is inherited {@link ComposerAdditionalOptions} and {@link ComposerOptions}, so you can specify these options.
- *
- * @VueI18nSee [useI18n](composition#usei18n)
- *
- * @VueI18nComposition
- */
- export declare type UseI18nOptions<Schema extends {
- message?: unknown;
- datetime?: unknown;
- number?: unknown;
- } = {
- message: DefaultLocaleMessageSchema;
- datetime: DefaultDateTimeFormatSchema;
- number: DefaultNumberFormatSchema;
- }, Locales extends {
- messages: unknown;
- datetimeFormats: unknown;
- numberFormats: unknown;
- } | string = Locale, Options extends ComposerOptions<Schema, Locales> = ComposerOptions<Schema, Locales>> = ComposerAdditionalOptions & Options;
- /**
- * Vue I18n Version
- *
- * @remarks
- * Semver format. Same format as the package.json `version` field.
- *
- * @VueI18nGeneral
- */
- export declare const VERSION: string;
- export declare function vTDirective(i18n: I18n): TranslationDirective<HTMLElement>;
- /**
- * VueI18n legacy interfaces
- *
- * @remarks
- * This interface is compatible with interface of `VueI18n` class (offered with Vue I18n v8.x).
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18n<Messages = {}, DateTimeFormats = {}, NumberFormats = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = OptionLocale extends string ? [ResourceLocales] extends [never] ? Locale : ResourceLocales : OptionLocale | ResourceLocales, Composition extends Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale> = Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale>> {
- /**
- * @remarks
- * Instance ID.
- */
- id: number;
- /**
- * @remarks
- * The current locale this VueI18n instance is using.
- *
- * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- */
- locale: Locales;
- /**
- * @remarks
- * The current fallback locales this VueI18n instance is using.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- fallbackLocale: FallbackLocales<Locales>;
- /**
- * @remarks
- * The list of available locales in `messages` in lexical order.
- */
- readonly availableLocales: Composition['availableLocales'];
- /**
- * @remarks
- * The locale messages of localization.
- *
- * @VueI18nSee [Getting Started](../guide/)
- */
- readonly messages: {
- [K in keyof Messages]: Messages[K];
- };
- /**
- * @remarks
- * The datetime formats of localization.
- *
- * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
- */
- readonly datetimeFormats: {
- [K in keyof DateTimeFormats]: DateTimeFormats[K];
- };
- /**
- * @remarks
- * The number formats of localization.
- *
- * @VueI18nSee [Number Formatting](../guide/essentials/number)
- */
- readonly numberFormats: {
- [K in keyof NumberFormats]: NumberFormats[K];
- };
- /**
- * @remarks
- * Custom Modifiers for linked messages.
- *
- * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
- */
- readonly modifiers: Composition['modifiers'];
- /**
- * @remarks
- * The formatter that implemented with Formatter interface.
- *
- * @deprecated See the [here](../guide/migration/breaking#remove-custom-formatter)
- */
- formatter: Formatter;
- /**
- * @remarks
- * A handler for localization missing.
- */
- missing: MissingHandler | null;
- /**
- * @remarks
- * A handler for post processing of translation.
- */
- postTranslation: PostTranslationHandler<VueMessageType> | null;
- /**
- * @remarks
- * Whether suppress warnings outputted when localization fails.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- silentTranslationWarn: Composition['missingWarn'];
- /**
- * @remarks
- * Whether suppress fallback warnings when localization fails.
- */
- silentFallbackWarn: Composition['fallbackWarn'];
- /**
- * @remarks
- * Whether suppress warnings when falling back to either `fallbackLocale` or root.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- */
- formatFallbackMessages: Composition['fallbackFormat'];
- /**
- * @remarks
- * Whether synchronize the root level locale to the component localization locale.
- *
- * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
- */
- sync: Composition['inheritLocale'];
- /**
- * @remarks
- * Whether to allow the use locale messages of HTML formatting.
- *
- * If you set `warn` or` error`, will check the locale messages on the VueI18n instance.
- *
- * If you are specified `warn`, a warning will be output at console.
- *
- * If you are specified `error` will occurred an Error.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
- */
- warnHtmlInMessage: WarnHtmlInMessageLevel;
- /**
- * @remarks
- * Whether interpolation parameters are escaped before the message is translated.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- */
- escapeParameterHtml: Composition['escapeParameter'];
- /**
- * @remarks
- * Whether `v-t` directive's element should preserve `textContent` after directive is unbinded.
- *
- * @VueI18nSee [Custom Directive](../guide/advanced/directive)
- * @VueI18nSee [Remove preserveDirectiveContent option](../guide/migration/breaking#remove-preservedirectivecontent-option)
- *
- * @deprecated The `v-t` directive for Vue 3 now preserves the default content. Therefore, this option and its properties have been removed from the VueI18n instance.
- */
- preserveDirectiveContent: boolean;
- /**
- * A set of rules for word pluralization
- *
- * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
- */
- pluralizationRules: Composition['pluralRules'];
- /**
- * Locale message translation
- *
- * @remarks
- * About details functions, See the {@link VueI18nTranslation}
- */
- t: VueI18nTranslation<Messages, Locales, RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }>>;
- /**
- * Resolve locale message translation
- *
- * @remarks
- * About details functions, See the {@link VueI18nResolveLocaleMessageTranslation}
- */
- rt: VueI18nResolveLocaleMessageTranslation<Locales>;
- /**
- * Locale message pluralization
- *
- * @remarks
- * About details functions, See the {@link VueI18nTranslationChoice}
- */
- tc: VueI18nTranslationChoice<Messages, Locales, RemoveIndexSignature<{
- [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
- }>>;
- /**
- * Translation locale message exist
- *
- * @remarks
- * whether do exist locale message on VueI18n instance [messages](legacy#messages).
- *
- * If you specified `locale`, check the locale messages of `locale`.
- *
- * @param key - A target locale message key
- * @param locale - A target locale
- *
- * @returns If found locale message, `true`, else `false`
- */
- te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
- /**
- * Locale messages getter
- *
- * @remarks
- * If [i18n component options](injection#i18n) is specified, it’s get in preferentially local scope locale messages than global scope locale messages.
- *
- * If [i18n component options](injection#i18n) isn't specified, it’s get with global scope locale messages.
- *
- * Based on the current `locale`, locale messages will be returned from Composer instance messages.
- *
- * If you change the `locale`, the locale messages returned will also correspond to the locale.
- *
- * If there are no locale messages for the given `key` in the composer instance messages, they will be returned with [fallbacking](../guide/essentials/fallback).
- *
- * @VueI18nWarning
- * You need to use `rt` for the locale message returned by `tm`. see the [rt](legacy#rt-message) details.
- *
- * @example
- * template:
- * ```html
- * <div class="container">
- * <template v-for="content in $tm('contents')">
- * <h2>{{ $rt(content.title) }}</h2>
- * <p v-for="paragraph in content.paragraphs">
- * {{ $rt(paragraph) }}
- * </p>
- * </template>
- * </div>
- * ```
- *
- * ```js
- * import { createI18n } from 'vue-i18n'
- *
- * const i18n = createI18n({
- * messages: {
- * en: {
- * contents: [
- * {
- * title: 'Title1',
- * // ...
- * paragraphs: [
- * // ...
- * ]
- * }
- * ]
- * }
- * }
- * // ...
- * })
- * ```
- * @param key - A target locale message key
- *
- * @return Locale messages
- */
- tm: Composition['tm'];
- /**
- * Get locale message
- *
- * @remarks
- * get locale message from VueI18n instance [messages](legacy#messages).
- *
- * @param locale - A target locale
- *
- * @returns Locale messages
- */
- getLocaleMessage: Composition['getLocaleMessage'];
- /**
- * Set locale message
- *
- * @remarks
- * Set locale message to VueI18n instance [messages](legacy#messages).
- *
- * @param locale - A target locale
- * @param message - A message
- */
- setLocaleMessage: Composition['setLocaleMessage'];
- /**
- * Merge locale message
- *
- * @remarks
- * Merge locale message to VueI18n instance [messages](legacy#messages).
- *
- * @param locale - A target locale
- * @param message - A message
- */
- mergeLocaleMessage: Composition['mergeLocaleMessage'];
- /**
- * Datetime formatting
- *
- * @remarks
- * About details functions, See the {@link VueI18nDateTimeFormatting}
- */
- d: VueI18nDateTimeFormatting<DateTimeFormats, Locales, RemoveIndexSignature<{
- [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
- }>>;
- /**
- * Get datetime format
- *
- * @remarks
- * get datetime format from VueI18n instance [datetimeFormats](legacy#datetimeformats).
- *
- * @param locale - A target locale
- *
- * @returns Datetime format
- */
- getDateTimeFormat: Composition['getDateTimeFormat'];
- /**
- * Set datetime format
- *
- * @remarks
- * Set datetime format to VueI18n instance [datetimeFormats](legacy#datetimeformats).
- *
- * @param locale - A target locale
- * @param format - A target datetime format
- */
- setDateTimeFormat: Composition['setDateTimeFormat'];
- /**
- * Merge datetime format
- *
- * @remarks
- * Merge datetime format to VueI18n instance [datetimeFormats](legacy#datetimeformats).
- *
- * @param locale - A target locale
- * @param format - A target datetime format
- */
- mergeDateTimeFormat: Composition['mergeDateTimeFormat'];
- /**
- * Number Formatting
- *
- * @remarks
- * About details functions, See the {@link VueI18nNumberFormatting}
- */
- n: VueI18nNumberFormatting<NumberFormats, Locales, RemoveIndexSignature<{
- [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
- }>>;
- /**
- * Get number format
- *
- * @remarks
- * get number format from VueI18n instance [numberFormats](legacy#numberFormats).
- *
- * @param locale - A target locale
- *
- * @returns Number format
- */
- getNumberFormat: Composition['getNumberFormat'];
- /**
- * Set number format
- *
- * @remarks
- * Set number format to VueI18n instance [numberFormats](legacy#numberFormats).
- *
- * @param locale - A target locale
- * @param format - A target number format
- */
- setNumberFormat: Composition['setNumberFormat'];
- /**
- * Merge number format
- *
- * @remarks
- * Merge number format to VueI18n instance [numberFormats](legacy#numberFormats).
- *
- * @param locale - A target locale
- * @param format - A target number format
- */
- mergeNumberFormat: Composition['mergeNumberFormat'];
- /**
- * Get choice index
- *
- * @remarks
- * Get pluralization index for current pluralizing number and a given amount of choices.
- *
- * @deprecated Use `pluralizationRules` option instead of `getChoiceIndex`.
- */
- getChoiceIndex: (choice: Choice, choicesLength: number) => number;
- }
- /**
- * Datetime formatting functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nDateTimeFormatting<DateTimeFormats = {}, Locales = 'en-US', DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>, C = IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K];
- }> : never, M = IsEmptyObject<DateTimeFormats> extends false ? PickupFormatKeys<DateTimeFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Datetime formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [i18n component options](injection#i18n) is specified, it’s formatted in preferentially local scope datetime formats than global scope locale messages.
- *
- * If [i18n component options](injection#i18n) isn't specified, it’s formatted with global scope datetime formats.
- *
- * @param value - A value, timestamp number or `Date` instance
- *
- * @returns Formatted value
- *
- * @VueI18nSee [Datetime formatting](../guide/essentials/datetime)
- */
- (value: number | Date): DateTimeFormatResult;
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- *
- * @returns Formatted value
- */
- <Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys): DateTimeFormatResult;
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Formatted value
- */
- <Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys, locale: Locales): DateTimeFormatResult;
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param args - An argument values
- *
- * @returns Formatted value
- */
- (value: number | Date, args: {
- [key: string]: string | boolean | number;
- }): DateTimeFormatResult;
- }
- /**
- * Number formatting functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nNumberFormatting<NumberFormats = {}, Locales = 'en-US', DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> = RemovedIndexResources<DefineNumberFormat>, C = IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K];
- }> : never, M = IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Number formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [i18n component options](injection#i18n) is specified, it’s formatted in preferentially local scope number formats than global scope locale messages.
- *
- * If [i18n component options](injection#i18n) isn't specified, it’s formatted with global scope number formats.
- *
- * @param value - A number value
- *
- * @returns Formatted value
- *
- * @VueI18nSee [Number formatting](../guide/essentials/number)
- */
- (value: number): NumberFormatResult;
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
- *
- * @param value - A number value
- * @param key - A key of number formats
- *
- * @returns Formatted value
- */
- <Key extends string = string>(value: number, key: Key | ResourceKeys): NumberFormatResult;
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
- *
- * @param value - A number value
- * @param key - A key of number formats
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Formatted value
- */
- <Key extends string = string>(value: number, key: Key | ResourceKeys, locale: Locales): NumberFormatResult;
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
- *
- * @param value - A number value
- * @param args - An argument values
- *
- * @returns Formatted value
- */
- (value: number, args: {
- [key: string]: string | boolean | number;
- }): NumberFormatResult;
- }
- /**
- * VueI18n Options
- *
- * @remarks
- * This option is compatible with `VueI18n` class constructor options (offered with Vue I18n v8.x)
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nOptions<Schema extends {
- message?: unknown;
- datetime?: unknown;
- number?: unknown;
- } = {
- message: DefaultLocaleMessageSchema;
- datetime: DefaultDateTimeFormatSchema;
- number: DefaultNumberFormatSchema;
- }, Locales extends {
- messages: unknown;
- datetimeFormats: unknown;
- numberFormats: unknown;
- } | string = Locale, Options extends ComposerOptions<Schema, Locales> = ComposerOptions<Schema, Locales>> {
- /**
- * @remarks
- * The locale of localization.
- *
- * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- *
- * @defaultValue `'en-US'`
- */
- locale?: Options['locale'];
- /**
- * @remarks
- * The locale of fallback localization.
- *
- * For more complex fallback definitions see fallback.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue The default `'en-US'` for the `locale` if it's not specified, or it's `locale` value
- */
- fallbackLocale?: Options['fallbackLocale'];
- /**
- * @remarks
- * The locale messages of localization.
- *
- * @VueI18nSee [Getting Started](../guide/)
- *
- * @defaultValue `{}`
- */
- messages?: Options['messages'];
- /**
- * @remarks
- * Allow use flat json messages or not
- *
- * @defaultValue `false`
- */
- flatJson?: Options['flatJson'];
- /**
- * @remarks
- * The datetime formats of localization.
- *
- * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
- *
- * @defaultValue `{}`
- */
- datetimeFormats?: Options['datetimeFormats'];
- /**
- * @remarks
- * The number formats of localization.
- *
- * @VueI18nSee [Number Formatting](../guide/essentials/number)
- *
- * @defaultValue `{}`
- */
- numberFormats?: Options['numberFormats'];
- /**
- * @remarks
- * The list of available locales in messages in lexical order.
- *
- * @defaultValue `[]`
- */
- availableLocales?: Locale[];
- /**
- * @remarks
- * Custom Modifiers for linked messages.
- *
- * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
- */
- modifiers?: Options['modifiers'];
- /**
- * @remarks
- * The formatter that implemented with Formatter interface.
- *
- * @deprecated See the [here](../guide/migration/breaking#remove-custom-formatter)
- */
- formatter?: Formatter;
- /**
- * @remarks
- * A handler for localization missing.
- *
- * The handler gets called with the localization target locale, localization path key, the Vue instance and values.
- *
- * If missing handler is assigned, and occurred localization missing, it's not warned.
- *
- * @defaultValue `null`
- */
- missing?: Options['missing'];
- /**
- * @remarks
- * In the component localization, whether to fall back to root level (global scope) localization when localization fails.
- *
- * If `false`, it's not fallback to root.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `true`
- */
- fallbackRoot?: Options['fallbackRoot'];
- /**
- * @remarks
- * Whether suppress warnings outputted when localization fails.
- *
- * If `true`, suppress localization fail warnings.
- *
- * If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `false`
- */
- silentTranslationWarn?: Options['missingWarn'];
- /**
- * @remarks
- * Whether do template interpolation on translation keys when your language lacks a translation for a key.
- *
- * If `true`, skip writing templates for your "base" language; the keys are your templates.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `false`
- */
- silentFallbackWarn?: Options['fallbackWarn'];
- /**
- * @remarks
- * Whether suppress warnings when falling back to either `fallbackLocale` or root.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `false`
- */
- formatFallbackMessages?: Options['fallbackFormat'];
- /**
- * @remarks
- * Whether `v-t` directive's element should preserve `textContent` after directive is unbinded.
- *
- * @VueI18nSee [Custom Directive](../guide/advanced/directive)
- * @VueI18nSee [Remove `preserveDirectiveContent` option](../guide/migration/breaking#remove-preservedirectivecontent-option)
- *
- * @defaultValue `false`
- *
- * @deprecated The `v-t` directive for Vue 3 now preserves the default content. Therefore, this option and its properties have been removed from the VueI18n instance.
- */
- preserveDirectiveContent?: boolean;
- /**
- * @remarks
- * Whether to allow the use locale messages of HTML formatting.
- *
- * See the warnHtmlInMessage property.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
- *
- * @defaultValue `'off'`
- */
- warnHtmlInMessage?: WarnHtmlInMessageLevel;
- /**
- * @remarks
- * If `escapeParameterHtml` is configured as true then interpolation parameters are escaped before the message is translated.
- *
- * This is useful when translation output is used in `v-html` and the translation resource contains html markup (e.g. <b> around a user provided value).
- *
- * This usage pattern mostly occurs when passing precomputed text strings into UI components.
- *
- * The escape process involves replacing the following symbols with their respective HTML character entities: `<`, `>`, `"`, `'`.
- *
- * Setting `escapeParameterHtml` as true should not break existing functionality but provides a safeguard against a subtle type of XSS attack vectors.
- *
- * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
- *
- * @defaultValue `false`
- */
- escapeParameterHtml?: Options['escapeParameter'];
- /**
- * @remarks
- * The shared locale messages of localization for components. More detail see Component based localization.
- *
- * @VueI18nSee [Shared locale messages for components](../guide/essentials/local#shared-locale-messages-for-components)
- *
- * @defaultValue `undefined`
- */
- sharedMessages?: LocaleMessages<VueMessageType>;
- /**
- * @remarks
- * A set of rules for word pluralization
- *
- * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
- *
- * @defaultValue `{}`
- */
- pluralizationRules?: Options['pluralRules'];
- /**
- * @remarks
- * A handler for post processing of translation. The handler gets after being called with the `$t`, `t`, `$tc`, and `tc`.
- *
- * This handler is useful if you want to filter on translated text such as space trimming.
- *
- * @defaultValue `null`
- */
- postTranslation?: Options['postTranslation'];
- /**
- * @remarks
- * Whether synchronize the root level locale to the component localization locale.
- *
- * If `false`, regardless of the root level locale, localize for each component locale.
- *
- * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
- *
- * @defaultValue `true`
- */
- sync?: boolean;
- /**
- * @remarks
- * A handler for getting notified when component-local instance was created.
- *
- * The handler gets called with new and old (root) VueI18n instances.
- *
- * This handler is useful when extending the root VueI18n instance and wanting to also apply those extensions to component-local instance.
- *
- * @defaultValue `null`
- */
- componentInstanceCreatedListener?: ComponentInstanceCreatedListener;
- /**
- * @remarks
- * A message resolver to resolve [`messages`](legacy#messages).
- *
- * If not specified, the vue-i18n internal message resolver will be used by default.
- *
- * You need to implement a message resolver yourself that supports the following requirements:
- *
- * - Resolve the message using the locale message of [`locale`](legacy#locale) passed as the first argument of the message resolver, and the path passed as the second argument.
- *
- * - If the message could not be resolved, you need to return `null`.
- *
- * - If you will be returned `null`, the message resolver will also be called on fallback if [`fallbackLocale`](legacy#fallbacklocale-2) is enabled, so the message will need to be resolved as well.
- *
- * The message resolver is called indirectly by the following APIs:
- *
- * - [`t`](legacy#t-key)
- *
- * - [`tc`](legacy#tc-key)
- *
- * - [`te`](legacy#te-key-locale)
- *
- * - [`tm`](legacy#tm-key)
- *
- * - [Translation component](component#translation)
- *
- * @example
- * Here is an example of how to set it up using your `createI18n`:
- * ```js
- * import { createI18n } from 'vue-i18n'
- *
- * // your message resolver
- * function messageResolver(obj, path) {
- * // simple message resolving!
- * const msg = obj[path]
- * return msg != null ? msg : null
- * }
- *
- * // call with I18n option
- * const i18n = createI18n({
- * locale: 'ja',
- * messageResolver, // set your message resolver
- * messages: {
- * en: { ... },
- * ja: { ... }
- * }
- * })
- *
- * // the below your something to do ...
- * // ...
- * ```
- *
- * @VueI18nTip
- * :new: v9.2+
- *
- * @VueI18nWarning
- * If you use the message resolver, the [`flatJson`](legacy#flatjson) setting will be ignored. That is, you need to resolve the flat JSON by yourself.
- *
- * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
- *
- * @defaultValue `undefined`
- */
- messageResolver?: MessageResolver;
- }
- /**
- * Resolve locale message translation functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}. This interfce is an alias of {@link ComposerResolveLocaleMessageTranslation}.
- *
- * @VueI18nLegacy
- */
- export declare type VueI18nResolveLocaleMessageTranslation<Locales = 'en-US'> = ComposerResolveLocaleMessageTranslation<Locales>;
- /**
- * Locale message translation functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nTranslation<Messages = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
- }> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Locale message translation.
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [i18n component options](injection#i18n) is specified, it’s translated in preferentially local scope locale messages than global scope locale messages.
- *
- * If [i18n component options](injection#i18n) isn't specified, it’s translated with global scope locale messages.
- *
- * @param key - A target locale message key
- *
- * @returns Translated message
- *
- * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
- */
- <Key extends string>(key: Key | ResourceKeys): TranslateResult;
- /**
- * Locale message translation.
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * @param key - A target locale message key
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Translated message
- */
- <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale): TranslateResult;
- /**
- * Locale message translation.
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * @param key - A target locale message key
- * @param locale - A locale, it will be used over than global scope or local scope.
- * @param list - A values of list interpolation
- *
- * @returns Translated message
- *
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale, list: unknown[]): TranslateResult;
- /**
- * Locale message translation.
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * @param key - A target locale message key
- * @param locale - A locale, it will be used over than global scope or local scope.
- * @param named - A values of named interpolation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale, named: Record<string, unknown>): TranslateResult;
- /**
- * Locale message translation.
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- *
- * @returns Translated message
- *
- * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
- /**
- * Locale message translation.
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- *
- * @returns Translated message
- *
- * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
- */
- <Key extends string>(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
- }
- /**
- * Locale message pluralization functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nTranslationChoice<Messages = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
- }> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
- /**
- * Locale message pluralization
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * If [i18n component options](injection#i18n) is specified, it’s pluraled in preferentially local scope locale messages than global scope locale messages.
- *
- * If [i18n component options](injection#i18n) isn't specified, it’s pluraled with global scope locale messages.
- *
- * The plural choice number is handled with default `1`.
- *
- * @param key - A target locale message key
- *
- * @returns Pluraled message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- */
- <Key extends string = string>(key: Key | ResourceKeys): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Pluraled message
- */
- <Key extends string = string>(key: Key | ResourceKeys, locale: Locales | Locale): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, choice: number): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param locale - A locale, it will be used over than global scope or local scope.
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, choice: number, locale: Locales | Locale): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param list - A values of list interpolation
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, choice: number, list: unknown[]): TranslateResult;
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param named - A values of named interpolation
- *
- * @returns Pluraled message
- */
- <Key extends string>(key: Key | ResourceKeys, choice: number, named: Record<string, unknown>): TranslateResult;
- }
- /** @VueI18nComposition */
- export declare type VueMessageType = string | VNode;
- export declare type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error';
- export { }
- declare module '@vue/runtime-core' {
- /**
- * Component Custom Options for Vue I18n
- *
- * @VueI18nInjection
- */
- export interface ComponentCustomOptions {
- /**
- * VueI18n options
- *
- * @remarks
- * See the {@link VueI18nOptions}
- */
- i18n?: VueI18nOptions
- /**
- * For custom blocks options
- * @internal
- */
- __i18n?: CustomBlocks
- /**
- * For devtools
- * @internal
- */
- __INTLIFY_META__?: string
- }
- /**
- * Component Custom Properties for Vue I18n
- *
- * @VueI18nInjection
- */
- export interface ComponentCustomProperties {
- /**
- * Exported Global Composer instance, or global VueI18n instance.
- *
- * @remarks
- * You can get the {@link ExportedGlobalComposer | exported composer instance} which are exported from global {@link Composer | composer instance} created with {@link createI18n}, or global {@link VueI18n | VueI18n instance}.
- * You can get the exported composer instance in {@link I18nMode | Composition API mode}, or the Vuei18n instance in {@link I18nMode | Legacy API mode}, which is the instance you can refer to with this property.
- * The locales, locale messages, and other resources managed by the instance referenced by this property are valid as global scope.
- * If the `i18n` component custom option is not specified, it's the same as the VueI18n instance that can be referenced by the i18n instance {@link I18n.global | global} property.
- */
- $i18n: VueI18n | ExportedGlobalComposer
- /**
- * Locale message translation
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#t | `VueI18n#t`}.
- *
- * In {@link I18nMode | Composition API mode}, the `$t` is injected by `app.config.globalProperties`.
- * the input / output is the same as for Composer, and it work on **global scope**. About that details, see {@link Composer#t | `Composer#t` }.
- *
- * @param key - A target locale message key
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param locale - A locale, override locale that global scope or local scope
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param locale - A locale, override locale that global scope or local scope
- * @param list - A values of list interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- locale: Locale,
- list: unknown[]
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param locale - A locale, override locale that global scope or local scope
- * @param named - A values of named interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- locale: Locale,
- named: object
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[]
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: Record<string, unknown>
- ): TranslateResult
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param plural - A choice number of plural
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- plural: number
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param plural - Which plural string to get. 1 returns the first one.
- * @param options - An options, see the {@link TranslateOptions}
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- plural: number,
- options: TranslateOptions
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- defaultMsg: string
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param defaultMsg - A default message to return if no translation was found
- * @param options - An options, see the {@link TranslateOptions}
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- defaultMsg: string,
- options: TranslateOptions
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[]
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param plural - A choice number of plural
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[],
- plural: number
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[],
- defaultMsg: string
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- * @param options - An options, see the {@link TranslateOptions}
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[],
- options: TranslateOptions
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: NamedValue
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param plural - A choice number of plural
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: NamedValue,
- plural: number
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: NamedValue,
- defaultMsg: string
- ): string
- /**
- * Locale message translation
- *
- * @remarks
- * Overloaded `$t`. About details, see the {@link $t} remarks.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- * @param options - An options, see the {@link TranslateOptions}
- *
- * @returns translation message
- */
- $t<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: NamedValue,
- options: TranslateOptions
- ): string
- /**
- * Resolve locale message translation
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#rt | `VueI18n#rt`}.
- *
- * In {@link I18nMode | Composition API mode}, the `$rt` is injected by `app.config.globalProperties`.
- * the input / output is the same as for Composer, and it work on **global scope**. About that details, see {@link Composer#rt | `Composer#rt` }.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `$tm`.
- *
- * @returns translated message
- */
- $rt(message: MessageFunction<VueMessageType> | VueMessageType): string
- /**
- * Resolve locale message translation for plurals
- *
- * @remarks
- * Overloaded `$rt`. About details, see the {@link $rt} remarks.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `$tm`.
- * @param plural - Which plural string to get. 1 returns the first one.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- */
- $rt(
- message: MessageFunction<VueMessageType> | VueMessageType,
- plural: number,
- options?: TranslateOptions
- ): string
- /**
- * Resolve locale message translation for list interpolations
- *
- * @remarks
- * Overloaded `$rt`. About details, see the {@link $rt} remarks.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `$tm`.
- * @param list - A values of list interpolation.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- */
- $rt(
- message: MessageFunction<VueMessageType> | VueMessageType,
- list: unknown[],
- options?: TranslateOptions
- ): string
- /**
- * Resolve locale message translation for named interpolations
- *
- * @remarks
- * Overloaded `$rt`. About details, see the {@link $rt} remarks.
- *
- * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `$tm`.
- * @param named - A values of named interpolation.
- * @param options - Additional {@link TranslateOptions | options} for translation
- *
- * @returns Translated message
- */
- $rt(
- message: MessageFunction<VueMessageType> | VueMessageType,
- named: NamedValue,
- options?: TranslateOptions
- ): string
- /**
- * Locale message pluralization
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * The input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#tc | `VueI18n#tc` }.
- * The value of plural is handled with default `1`.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path
- ): TranslateResult
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param locale - A locale, override locale that global scope or local scope
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- locale: Locale
- ): TranslateResult
- /**
- * Locale message pluralization
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param list - A values of list interpolation
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- list: unknown[]
- ): TranslateResult
- /**
- * Locale message pluralization
- * Supported for Legacy API mode only.
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param named - A values of named interpolation
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- named: Record<string, unknown>
- ): TranslateResult
- /**
- * Locale message pluralization
- * Supported for Legacy API mode only.
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- choice: number
- ): TranslateResult
- /**
- * Locale message pluralization
- * Supported for Legacy API mode only.
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param locale - A locale, override locale that global scope or local scope
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- choice: number,
- locale: Locale
- ): TranslateResult
- /**
- * Locale message pluralization
- * Supported for Legacy API mode only.
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param list - A values of list interpolation
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- choice: number,
- list: unknown[]
- ): TranslateResult
- /**
- * Locale message pluralization
- * Supported for Legacy API mode only.
- *
- * @remarks
- * Overloaded `$tc`. About details, see the {@link $tc} remarks.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param choice - Which plural string to get. 1 returns the first one.
- * @param named - A values of named interpolation
- *
- * @returns translation message that is pluraled
- */
- $tc<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- choice: number,
- named: Record<string, unknown>
- ): TranslateResult
- /**
- * Translation message exist
- *
- * @remarks
- * The input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#te | `VueI18n.#te` }.
- * Supported for Legacy API mode only.
- *
- * @param key - A target locale message key
- * @param locale - A locale, optional, override locale that global scope or local scope
- *
- * @returns if found locale message, `true`, else `false`
- */
- $te<
- Key extends string,
- DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? PickupPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys | Path,
- locale?: Locale
- ): boolean
- /**
- * Datetime formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#d | `VueI18n#d` }.
- *
- * In {@link I18nMode | Composition API mode}, the `$d` is injected by `app.config.globalProperties`.
- * the input / output is the same as for Composer instance, and it work on **global scope**. About that details, see {@link Composer#d | `Composer#d` }.
- *
- * @param value - A value, timestamp number or `Date` instance
- *
- * @returns formatted value
- */
- $d(value: number | Date): DateTimeFormatResult
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- *
- * @returns formatted value
- */
- $d<
- Value extends number | Date = number,
- Key extends string = string,
- DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedDateTimeFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: Value,
- key: Key | ResourceKeys
- ): DateTimeFormatResult
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- * @param locale - A locale, optional, override locale that global scope or local scope
- *
- * @returns formatted value
- */
- $d<
- Value extends number | Date = number,
- Key extends string = string,
- DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedDateTimeFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: Value,
- key: Key | ResourceKeys,
- locale: Locale
- ): DateTimeFormatResult
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param args - An argument values
- *
- * @returns formatted value
- */
- $d(
- value: number | Date,
- args: { [key: string]: string }
- ): DateTimeFormatResult
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- *
- * @returns formatted value
- */
- $d(value: number | Date): string
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- *
- * @returns formatted value
- */
- $d<
- Value extends number | Date = number,
- Key extends string = string,
- DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedDateTimeFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: Value,
- key: Key | ResourceKeys
- ): string
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param key - A key of datetime formats
- * @param locale - A locale, optional, override locale that global scope or local scope
- *
- * @returns formatted value
- */
- $d<
- Value extends number | Date = number,
- Key extends string = string,
- DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedDateTimeFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: Value,
- key: Key | ResourceKeys,
- locale: Locale
- ): string
- /**
- * Datetime formatting
- *
- * @remarks
- * Overloaded `$d`. About details, see the {@link $d} remarks.
- *
- * @param value - A value, timestamp number or `Date` instance
- * @param options - An options, see the {@link DateTimeOptions}
- *
- * @returns formatted value
- */
- $d(value: number | Date, options: DateTimeOptions): string
- /**
- * Number formatting
- *
- * @remarks
- * If this is used in a reactive context, it will re-evaluate once the locale changes.
- *
- * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#n | `VueI18n.n` }.
- *
- * In {@link I18nMode | Composition API mode}, the `$n` is injected by `app.config.globalProperties`.
- * the input / output is the same as for Composer instance, and it work on **global scope**. About that details, see {@link Composer#n | `Composer.n` }.
- *
- * @param value - A number value
- *
- * @returns formatted value
- */
- $n(value: number): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- *
- * @returns formatted value
- */
- $n<
- Key extends string = string,
- DefinedNumberFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedNumberFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: number,
- key: Key | ResourceKeys
- ): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- * @param locale - A locale, optional, override locale that global scope or local scope
- *
- * @returns formatted value
- */
- $n<
- Key extends string = string,
- DefinedNumberFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedNumberFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: number,
- key: Key | ResourceKeys,
- locale: Locale
- ): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param args - An argument values
- *
- * @returns formatted value
- */
- $n(
- value: number,
- args: { [key: string]: string | boolean | number }
- ): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- * @param args - An argument values
- *
- * @returns formatted value
- */
- $n(
- value: number,
- key: string,
- args: { [key: string]: string | boolean | number }
- ): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- * @param locale - A locale, optional, override locale that global scope or local scope
- * @param args - An argument values
- *
- * @returns formatted value
- */
- $n(
- value: number,
- key: string,
- locale: Locale,
- args: { [key: string]: string | boolean | number }
- ): NumberFormatResult
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- *
- * @returns formatted value
- */
- $n(value: number): string
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- *
- * @returns formatted value
- */
- $n<
- Key extends string = string,
- DefinedNumberFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedNumberFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: number,
- key: Key | ResourceKeys
- ): string
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param key - A key of number formats
- * @param locale - A locale, optional, override locale that global scope or local scope
- *
- * @returns formatted value
- */
- $n<
- Key extends string = string,
- DefinedNumberFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>,
- Keys = IsEmptyObject<DefinedNumberFormat> extends false
- ? PickupFormatPathKeys<{
- [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- value: number,
- key: Key | ResourceKeys,
- locale: Locale
- ): string
- /**
- * Number formatting
- *
- * @remarks
- * Overloaded `$n`. About details, see the {@link $n} remarks.
- *
- * @param value - A number value
- * @param options - An options, see the {@link NumberOptions}
- *
- * @returns formatted value
- */
- $n(value: number, options: NumberOptions): string
- /**
- * Locale messages getter
- *
- * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#tm | `VueI18n#tm` }.
- *
- * @remarks
- * In {@link I18nMode | Composition API mode}, the `$tm` is injected by `app.config.globalProperties`.
- * the input / output is the same as for Composer instance, and it work on **global scope**. About that details, see {@link Composer#tm | `Composer.tm` }.
- * Based on the current `locale`, locale messages will be returned from Composer instance messages.
- * If you change the `locale`, the locale messages returned will also correspond to the locale.
- * If there are no locale messages for the given `key` in the composer instance messages, they will be returned with fallbacking.
- *
- * @param key - A target locale message key
- *
- * @returns locale messages
- */
- $tm<
- Key extends string,
- Messages extends object = {},
- ResourceKeys extends PickupKeys<Messages> = PickupKeys<Messages>
- >(
- key: Key | ResourceKeys
- ): LocaleMessageValue<VueMessageType> | {}
- }
- }
|