Skip to content

pantoken / renderers/svelte/src / registerLocalized

Ֆունկցիա: registerLocalized()

registerLocalized(bundle, target?, options?): void

Փորձարկումային

Գրանցում է հատուկ էլեմենտներ՝ տեղայնացված տողերով և ուղղությամբ։

Ընդունում է ամբողջությամբ լուծված LocaleBundleկամ հում BCP47 պիտակի տող։ Երբ տող է փոխանցվում, makeStrings-ը ստանում է շաբաթվա օրերի անունները Intl.DateTimeFormat-ի միջոցով, իսկ բոլոր այլ տողերը վերադառնում են անգլերենի; ամբողջական թարգմանությունների համար փոխանցեք bundle։

Պարամետրեր

bundle

string | LocaleBundle

Մեկ LocaleBundle օբյեկտ, կամ BCP47 պիտակ ("hu", "ar", …).

target?

ElementRegistry

Ռեգիստրը, որում սահմանումը կատարվում է (ստանդարտ արժեքը globalThis.customElements է).

options?

Արտահարվում է register()-ին (օր.՝ prefix, only).

prefix?

string | null

only?

readonly string[]

Վերադարձվող արժեք

void

Օրինակ

ts
import { registerLocalized, hu } from "@pantoken/web-components";

registerLocalized(hu);
registerLocalized("ar"); // direction inferred from LOCALES
registerLocalized("x-custom", customElements, { prefix: "x" });