Skip to content

pantoken-root / renderers/web-components/src / registerLocalized

Swyddogaeth: registerLocalized() ​

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

Alffa

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

Derbynnir LocaleBundle sydd wedi'i ddatrys yn llawn neu llinyn tag BCP47 crai. Pan gaiff llinyn ei basio, mae makeStrings yn deillio enwau dyddiau'r wythnos drwy Intl.DateTimeFormat a bydd yr holl linyddion eraill yn dychwelyd i Saesneg; pasiwch 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" });