Skip to content

pantoken-root / renderers/web-components/src / LocaleSet

介面: LocaleSet<K> ​

Alpha(內測)

一個經過型別限定的 LocaleBundle 子集。由 createLocaleSet 建立,用以在編譯時限制應用程式支援的語系 — 註冊或取用不在該集合中的語系會造成 TypeScript 錯誤。

型別參數 ​

K ​

K 繼承 string

屬性 ​

locales ​

readonly locales: readonly K[]

Alpha(內測)

此集合中包含的語系標籤。

方法 ​

has() ​

has(locale): locale is K

Alpha(內測)

型別守衛 — 當 locale 屬於此集合時回傳 true。

參數 ​

locale ​

string

回傳 ​

locale is K


get() ​

get(locale): LocaleBundle

Alpha(內測)

回傳 locale 的 bundle。若以未知語系呼叫則於執行時拋出錯誤。

參數 ​

locale ​

K

回傳 ​

LocaleBundle


register() ​

register(locale, target?, options?): void

Alpha(內測)

使用此集合中的指定語系註冊 @pantoken/web-components 元素。

參數 ​

locale ​

K

target? ​

ElementRegistry

options? ​
prefix? ​

string | null

only? ​

readonly string[]

回傳 ​

void