Skip to content

pantoken / renderers/web-components/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" });