Skip to content

pantoken / renderers/svelte/src / registerLocalized

تابع: registerLocalized()

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

تجربی

عناصر سفارشی را با رشته‌ها و جهت‌بندی مختص locale ثبت کنید.

یک LocaleBundle کاملاً حل‌شده یا یک رشتهٔ خام تگ BCP47 می‌پذیرد. وقتی یک رشته ارسال شود، makeStrings نام‌های روزهای هفته را از طریق Intl.DateTimeFormat استخراج می‌کند و تمام رشته‌های دیگر به انگلیسی بازمی‌گردند؛ برای ترجمهٔ کامل یک bundle ارسال کنید.

پارامترها

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" });