Skip to content

pantoken-root / renderers/svelte/src / registerLocalized

関数: registerLocalized() ​

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

実験的

ロケール固有の文字列と方向情報でカスタム要素を登録する。

完全に解決された LocaleBundle または生の BCP47 タグ文字列を受け取る。文字列が渡された場合、makeStrings は Intl.DateTimeFormat を使って曜日名を導出し、その他のすべての文字列は英語にフォールバックする。完全な翻訳を得るにはバンドルを渡す。

パラメーター ​

bundle ​

string | LocaleBundle

LocaleBundle オブジェクト、または BCP47 タグ("hu", "ar", …)。

target? ​

ElementRegistry

定義先のレジストリ(デフォルトは globalThis.customElements)。

options? ​

register() に透過される(例: prefix, only)。

prefix? ​

string | null

only? ​

readonly string[]

戻り値 ​

void

例 ​

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

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