Skip to content

pantoken / renderers/svelte/src / registerLocalized

Swyddogaeth: registerLocalized()

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

Arbrofol

Cofrestru elfennau wedi'u teilwra gyda stringiau a chyfeiriad penodol i leoliad.

Derbynnir LocaleBundle wedi'i ddatrys yn llawn neu llinyn tag BCP47 raw. Pan gawn llinyn, mae makeStrings yn deillio enwau dydd y wythnos drwy Intl.DateTimeFormat a bydd pob llinyn arall yn dychwelyd at Saesneg; pasio bundle i gael cyfieithiadau llawn.

Paramedrau

bundle

string | LocaleBundle

Gwrthrych LocaleBundle, neu dag BCP47 ("hu", "ar", …).

target?

ElementRegistry

Y gofrestr i ddiffinio ynddo (diofyn i globalThis.customElements).

options?

Wedi'i basio ymlaen at register() (e.e. prefix, only).

prefix?

string | null

only?

readonly string[]

Yn dychwelyd

void

Enghraifft

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

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