Skip to content

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

Funzione: registerLocalized() ​

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

Alpha

Registra elementi personalizzati con stringhe e direzione specifiche per la località.

Accetta un LocaleBundle completamente risolto o una stringa grezza di tag BCP47. Quando viene passata una stringa, makeStrings ricava i nomi dei giorni della settimana tramite Intl.DateTimeFormat e tutte le altre stringhe ricadono sull'inglese; passa un bundle per traduzioni complete.

Parametri ​

bundle ​

string | LocaleBundle

Un oggetto LocaleBundle, oppure un tag BCP47 ("hu", "ar", …).

target? ​

ElementRegistry

Il registro in cui definire (predefinito: globalThis.customElements).

options? ​

Inoltrato a register() (es. prefix, only).

prefix? ​

string | null

only? ​

readonly string[]

Restituisce ​

void

Esempio ​

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

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