Skip to content

pantoken-root / renderers/svelte/src / registerLocalized

Function: registerLocalized() ​

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

Experimental

Register custom elements with locale-specific strings and direction.

Accepts a fully resolved LocaleBundle or a raw BCP47 tag string. When a string is passed, makeStrings derives weekday names via Intl.DateTimeFormat and all other strings fall back to English; pass a bundle for full translations.

Parameters ​

bundle ​

string | LocaleBundle

A LocaleBundle object, or a BCP47 tag ("hu", "ar", …).

target? ​

ElementRegistry

The registry to define into (defaults to globalThis.customElements).

options? ​

Passed through to register() (e.g. prefix, only).

prefix? ​

string | null

only? ​

readonly string[]

Returns ​

void

Example ​

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

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