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