Skip to content

pantoken / renderers/web-components/src / createLocaleSet

Fonksyon: createLocaleSet()

createLocaleSet<K>(bundles): LocaleSet<K>

Alfa

Defini sou-ansanm lokal aplikasyon w lan sipòte. Pase objè pake yo enpòte kòm yon objè ki gen kle yo kòm etikèt lokal (senplifikasyon JavaScript fè sa natirèl). TypeScript limite etikèt lokal yo aksepte yo sèlman a kle ou bay.

Pa rele createLocaleSet ditou bay tout barèl 44-lokal la — itilize faktori sa a sèlman lè ou bezwen validasyon nan tan konpilasyon oswa siyal eksplisit pou tree-shaking.

Paramèt tip

K

K erite string

Paramèt

bundles

Record<K, LocaleBundle>

Retounen

LocaleSet<K>

Egzanp

ts
import { createLocaleSet, en, hu, de } from "@pantoken/web-components";

const locales = createLocaleSet({ en, hu, de });

locales.register("hu");          // ✓ type-safe
locales.register("fr");          // TypeScript error — not in this set
locales.has("hu");               // → true (type guard)
locales.get("hu");               // → LocaleBundle