12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043 |
- import type { App } from 'vue';
- import { CompileError } from '@intlify/core-base';
- 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 type { GeneratedLocale } from '@intlify/core-base';
- import { GeneratedTypeConfig } 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 type { JsonPaths } 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 { MessageCompiler } from '@intlify/core-base';
- import { MessageCompilerContext } from '@intlify/core-base';
- import { MessageContext } from '@intlify/core-base';
- import { MessageFunction } from '@intlify/core-base';
- import { MessageFunctions } from '@intlify/core-base';
- import { 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 { RemovedIndexResources } from '@intlify/core-base';
- import type { RemoveIndexSignature } from '@intlify/core-base';
- import type { ResourceNode } 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 { TranslationsPaths } from '@intlify/core-base';
- import type { VNode } from 'vue';
- import type { VNodeProps } 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?: ComponentI18nScope;
- /**
- * @remarks
- * A composer instance with an existing scope.
- *
- * This option takes precedence over the `scope` option.
- */
- i18n?: Composer;
- }
- /**
- * @deprecated will be removed at vue-i18n v12
- * @VueI18nLegacy
- */
- export declare type Choice = number;
- export { CompileError }
- export declare type ComponentI18nScope = Exclude<I18nScope, 'local'>;
- /**
- * Composer interfaces
- *
- * @remarks
- * This is the interface for being used for Vue 3 Composition API.
- *
- * @VueI18nComposition
- */
- export declare interface Composer<Messages extends Record<string, any> = {}, DateTimeFormats extends Record<string, any> = {}, NumberFormats extends Record<string, any> = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = Locale extends GeneratedLocale ? GeneratedLocale : OptionLocale extends Locale ? IsNever<ResourceLocales> extends true ? 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/essentials/started)
- */
- 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`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is not translatable.
- */
- 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 extends Record<string, any> = {}, 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;
- }
- export declare type ComposerExtender = (composer: Composer) => Disposer | undefined;
- /**
- * Number formatting functions
- *
- * @remarks
- * This is the interface for {@link Composer}
- *
- * @VueI18nComposition
- */
- export declare interface ComposerNumberFormatting<NumberFormats extends Record<string, any> = {}, 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/essentials/started)
- *
- * @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;
- /**
- * @remarks
- * A compiler for custom message format.
- *
- * If not specified, the vue-i18n default message compiler will be used.
- *
- * You will need to implement your own message compiler that returns Message Functions
- *
- * @example
- * Here is an example of how to custom message compiler with `intl-messageformat`
- *
- * ```js
- * import { createI18n } from 'vue-i18n'
- * import IntlMessageFormat from 'intl-messageformat'
- *
- * function messageCompiler(message, { locale, key, onError }) {
- * if (typeof message === 'string') {
- * // You can tune your message compiler performance more with your cache strategy or also memoization at here
- * const formatter = new IntlMessageFormat(message, locale)
- * return ctx => formatter.format(ctx.values)
- * } else {
- * // If you would like to support it for AST,
- * // You need to transform locale mesages such as `json`, `yaml`, etc. with the bundle plugin.
- * onError && onError(new Error('not support for AST'))
- * return () => key // return default with `key`
- * }
- * }
- *
- * // call with I18n option
- * const i18n = createI18n({
- * legacy: false,
- * locale: 'ja',
- * messageCompiler, // set your message compiler
- * messages: {
- * en: {
- * hello: 'hello world!',
- * greeting: 'hi, {name}!',
- * // ICU Message format
- * photo: `You have {numPhotos, plural,
- * =0 {no photos.}
- * =1 {one photo.}
- * other {# photos.}
- * }`
- * },
- * }
- * })
- *
- * // the below your something to do ...
- * // ...
- * ```
- *
- * @VueI18nTip
- * :new: v9.3+
- *
- * @VueI18nWarning
- * The Custom Message Format is an experimental feature. It may receive breaking changes or be removed in the future.
- *
- * @VueI18nSee [Custom Message Format](../guide/advanced/format)
- *
- * @defaultValue `undefined`
- */
- messageCompiler?: MessageCompiler;
- }
- /**
- * 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 extends Record<string, any> = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
- }> : never, M = IsEmptyObject<Messages> extends false ? TranslationsPaths<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.
- *
- * @param key - A target locale message key
- * @param plural - Which plural string to get. 1 returns the first one.
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- */
- <Key extends string>(key: Key | ResourceKeys | number, plural: 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.
- *
- * @param key - A target locale message key
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns Translated message
- */
- <Key extends string>(key: Key | ResourceKeys | number, defaultMsg: string): 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.
- *
- * @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 | number, list: unknown[]): 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 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 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.
- *
- * @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 | number, named: NamedValue): 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;
- /**
- * 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;
- }
- export declare function createI18n<Legacy extends boolean = true, Options extends I18nOptions = I18nOptions, Messages extends Record<string, unknown> = Options['messages'] extends Record<string, unknown> ? Options['messages'] : {}, DateTimeFormats extends Record<string, unknown> = Options['datetimeFormats'] extends Record<string, unknown> ? Options['datetimeFormats'] : {}, NumberFormats extends Record<string, unknown> = Options['numberFormats'] extends Record<string, unknown> ? Options['numberFormats'] : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options): (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 to specify {@link VueI18nOptions} and `legacy: true` option.
- *
- * If you use composition API mode, you need to specify {@link ComposerOptions}.
- *
- * @VueI18nSee [Getting Started](../guide/essentials/started)
- * @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 extends Record<string, unknown> = NonNullable<Options['messages']> extends Record<string, unknown> ? NonNullable<Options['messages']> : {}, DateTimeFormats extends Record<string, unknown> = NonNullable<Options['datetimeFormats']> extends Record<string, unknown> ? NonNullable<Options['datetimeFormats']> : {}, NumberFormats extends Record<string, unknown> = NonNullable<Options['numberFormats']> extends Record<string, unknown> ? NonNullable<Options['numberFormats']> : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options): (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: {
- new (): {
- $props: VNodeProps & DatetimeFormatProps & BaseFormatProps;
- };
- };
- /**
- * DatetimeFormat Component Props
- *
- * @VueI18nComponent
- */
- export declare type DatetimeFormatProps = FormattableProps<number | Date, Intl.DateTimeFormatOptions>;
- /**
- * @deprecated will be removed at vue-i18n v12
- * @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 {
- }
- export declare type Disposer = () => void;
- /**
- * 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;
- }
- /**
- * Narrowed i18n instance type based on `GeneratedTypeConfig['legacy']`
- *
- * - `never` (unset) resolves to `VueI18n | ExportedGlobalComposer`
- * - `true` resolves to `VueI18n`
- * - `false` resolves to `ExportedGlobalComposer`
- */
- declare type GeneratedInstanceType = GeneratedTypeConfig extends Record<'legacy', infer Legacy> ? Legacy : never;
- export { GeneratedTypeConfig }
- /**
- * I18n instance
- *
- * @remarks
- * The instance required for installation as the Vue plugin
- *
- * @VueI18nGeneral
- */
- export declare interface I18n<Messages extends Record<string, unknown> = {}, DateTimeFormats extends Record<string, unknown> = {}, NumberFormats extends Record<string, unknown> = {}, OptionLocale = Locale, Legacy = boolean> {
- /**
- * Vue I18n API mode
- *
- * @remarks
- * If you specified `legacy: true` option in `createI18n`, return `legacy`, else `composition`
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @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;
- /**
- * 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`.
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @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;
- }
- export declare const I18nD: new () => {
- $props: VNodeProps & DatetimeFormatProps & BaseFormatProps;
- };
- /**
- * 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
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @VueI18nSee [I18n#mode](general#mode)
- *
- * @VueI18nGeneral
- */
- export declare type I18nMode = 'legacy' | 'composition';
- export declare const I18nN: new () => {
- $props: VNodeProps & NumberFormatProps & BaseFormatProps;
- };
- /**
- * 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 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 declare const I18nT: new () => {
- $props: VNodeProps & TranslationProps;
- };
- export { IntlDateTimeFormat }
- export { IntlDateTimeFormats }
- export { IntlFormatMatcher }
- export { IntlLocaleMatcher }
- export { IntlNumberFormat }
- export { IntlNumberFormats }
- export { IsEmptyObject }
- export { IsNever }
- export { LinkedModifiers }
- export { Locale }
- export { LocaleMessageDictionary }
- /**
- * @deprecated will be removed at vue-i18n v12
- * @VueI18nLegacy
- */
- export declare type LocaleMessageObject<Message = string> = LocaleMessageDictionary<Message>;
- export { LocaleMessages }
- export { LocaleMessageType }
- export { LocaleMessageValue }
- export { MessageCompiler }
- export { MessageCompilerContext }
- export { MessageContext }
- export { MessageFunction }
- export { MessageFunctions }
- export { MessageResolver }
- /** @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: {
- new (): {
- $props: VNodeProps & NumberFormatProps & BaseFormatProps;
- };
- };
- /**
- * NumberFormat Component Props
- *
- * @VueI18nComponent
- */
- export declare type NumberFormatProps = FormattableProps<number, Intl.NumberFormatOptions>;
- /**
- * @deprecated will be removed at vue-i18n v12
- * @VueI18nLegacy
- */
- export declare type NumberFormatResult = string;
- export { NumberOptions }
- export { Path }
- export { PathValue }
- export { PickupFormatPathKeys }
- export { PickupKeys }
- export { PickupPaths }
- export { PluralizationRule }
- /**
- * @deprecated will be removed at vue-i18n v12
- * @VueI18nLegacy
- */
- export declare type PluralizationRulesMap = {
- [locale: string]: PluralizationRule;
- };
- export { PostTranslationHandler }
- export { RemovedIndexResources }
- export { TranslateOptions }
- /**
- * @deprecated will be removed at vue-i18n v12
- * @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 keypath="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: {
- new (): {
- $props: VNodeProps & TranslationProps;
- };
- };
- /**
- * 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>
- * ```
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @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']>, Options['locale'] extends unknown ? string : 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;
- /**
- * @deprecated will be removed at vue-i18n v12
- */
- export declare function vTDirective(i18n: I18n): TranslationDirective<HTMLElement>;
- export declare type VTDirectiveValue = {
- path: string;
- locale?: Locale;
- args?: NamedValue;
- choice?: number;
- plural?: number;
- };
- /**
- * VueI18n legacy interfaces
- *
- * @remarks
- * This interface is compatible with interface of `VueI18n` class (offered with Vue I18n v8.x).
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18n<Messages extends Record<string, any> = {}, DateTimeFormats extends Record<string, any> = {}, NumberFormats extends Record<string, any> = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = Locale extends GeneratedLocale ? GeneratedLocale : 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/essentials/started)
- */
- 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
- * 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'];
- /**
- * 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>;
- /**
- * 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'];
- }
- /**
- * Datetime formatting functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nDateTimeFormatting<DateTimeFormats extends Record<string, any> = {}, 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;
- }
- /**
- * @deprecated will be removed at vue-i18n v12
- */
- export declare type VueI18nExtender = (vueI18n: VueI18n) => Disposer | undefined;
- /** @VueI18nGeneral */
- export declare type VueI18nInstance = IsNever<GeneratedInstanceType> extends true ? VueI18n | ExportedGlobalComposer : GeneratedInstanceType extends true ? VueI18n : ExportedGlobalComposer;
- /**
- * Number formatting functions for VueI18n legacy interfaces
- *
- * @remarks
- * This is the interface for {@link VueI18n}
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nNumberFormatting<NumberFormats extends Record<string, any> = {}, 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)
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @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/essentials/started)
- *
- * @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
- * 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 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`, and `t`.
- *
- * 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 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)
- *
- * - [`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
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @remarks
- * This is the interface for {@link VueI18n}. This interface 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}
- *
- * @deprecated will be removed at vue-i18n v12
- *
- * @VueI18nLegacy
- */
- export declare interface VueI18nTranslation<Messages extends Record<string, any> = {}, 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 for plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
- *
- * In this overloaded `t`, return a pluralized translation message.
- *
- * You can also suppress the warning, when the translation missing according to the options.
- *
- * @param key - A target locale message key
- * @param plural - Which plural string to get. 1 returns the first one.
- *
- * @returns Translated message
- *
- * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
- */
- <Key extends string>(key: Key | ResourceKeys, plural: number): TranslateResult;
- /**
- * Locale message translation for plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, plural: number, options: TranslateOptions<Locales>): TranslateResult;
- /**
- * Locale message translation for missing default message
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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.
- *
- * @param key - A target locale message key
- * @param defaultMsg - A default message to return if no translation was found
- *
- * @returns Translated message
- */
- <Key extends string>(key: Key | ResourceKeys, defaultMsg: string): TranslateResult;
- /**
- * Locale message translation for missing default message
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, defaultMsg: string, options: TranslateOptions<Locales>): 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 for list interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, list: unknown[], plural: number): TranslateResult;
- /**
- * Locale message translation for list interpolations and missing default message
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, list: unknown[], defaultMsg: string): TranslateResult;
- /**
- * Locale message translation for list interpolations
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, list: unknown[], options: TranslateOptions<Locales>): 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 translation for named interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, named: NamedValue, plural: number): TranslateResult;
- /**
- * Locale message translation for named interpolations and plurals
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, named: NamedValue, defaultMsg: string): TranslateResult;
- /**
- * Locale message translation for named interpolations
- *
- * @remarks
- * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) 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, named: NamedValue, options: TranslateOptions<Locales>): TranslateResult;
- }
- /** @VueI18nComposition */
- export declare type VueMessageType = string | ResourceNode | VNode;
- /**
- * @deprecated will be removed at vue-i18n v12
- * @VueI18nLegacy
- */
- export declare type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error';
- export { }
- declare module 'vue' {
- /**
- * 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: VueI18nInstance
- /**
- * 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys
- ): TranslateResult
- /**
- * 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- plural: number
- ): TranslateResult
- /**
- * 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- plural: number,
- options: TranslateOptions
- ): TranslateResult
- /**
- * 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- defaultMsg: string
- ): TranslateResult
- /**
- * 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- defaultMsg: string,
- options: TranslateOptions
- ): 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- list: unknown[]
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- list: unknown[],
- plural: number
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- list: unknown[],
- defaultMsg: string
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- list: unknown[],
- options: TranslateOptions
- ): 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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- named: NamedValue
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- named: NamedValue,
- plural: number
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- named: NamedValue,
- defaultMsg: string
- ): 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
- * @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
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- named: NamedValue,
- options: TranslateOptions
- ): TranslateResult
- /**
- * 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
- /**
- * Translation message exist
- *
- * @remarks
- * About that details, see {@link VueI18n#te | `VueI18n#te` } or {@link Composer#te | `Composer#te`}.
- *
- * @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`, Note that `false` is returned even if the value present in the key is not translatable.
- */
- $te<
- Key extends string,
- DefinedLocaleMessage extends
- RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys,
- 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,
- DefinedLocaleMessage extends
- RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
- Keys = IsEmptyObject<DefinedLocaleMessage> extends false
- ? JsonPaths<{
- [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
- }>
- : never,
- ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
- >(
- key: Key | ResourceKeys
- ): LocaleMessageValue<VueMessageType> | {}
- }
- }
- declare module 'vue' {
- export interface GlobalComponents {
- ['i18n-t']: typeof Translation
- ['i18n-d']: typeof DatetimeFormat
- ['i18n-n']: typeof NumberFormat
- ['I18nT']: typeof Translation
- ['I18nD']: typeof DatetimeFormat
- ['I18nN']: typeof NumberFormat
- }
- }
|