Skip to content

pantoken / renderers/web-components/src / registerLocalized

Função: registerLocalized()

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

Alfa

Registrar elementos personalizados com strings específicas de localidade e direção.

Aceita um LocaleBundle totalmente resolvido ou uma string bruta de tag BCP47. Quando uma string é passada, makeStrings deriva os nomes dos dias da semana via Intl.DateTimeFormat e todas as outras strings recaem para o inglês; passe um bundle para traduções completas.

Parâmetros

bundle

string | LocaleBundle

Um objeto LocaleBundle, ou uma tag BCP47 ("hu", "ar", …).

target?

ElementRegistry

O registro no qual definir (padrão: globalThis.customElements).

options?

Encaminhado para register() (por exemplo, prefix, only).

prefix?

string | null

only?

readonly string[]

Retorna

void

Exemplo

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

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