Skip to content

pantoken / renderers/web-components/src / registerLocalized

함수: registerLocalized()

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

알파

로케일별 문자열 및 방향으로 커스텀 요소를 등록합니다.

완전히 해석된 LocaleBundle 또는 원시 BCP47 태그 문자열을 허용합니다. 문자열이 전달될 경우, makeStringsIntl.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" });