@textbus/editor
Version:
Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.
42 lines (41 loc) • 1.42 kB
TypeScript
export interface I18NConfig {
editor: {
[key: string]: any;
};
plugins?: {
[key: string]: any;
};
components?: {
[key: string]: any;
};
[key: string]: any;
}
export type I18nString = string | ((i18n: I18n) => string);
/**
* Textbus 国际化方案类
*/
export declare class I18n {
private defaultConfig;
private customConfig;
constructor(defaultConfig: I18NConfig, customConfig: I18NConfig);
/**
* 通过 path 获取 i18n 配置中的字段,如果没有自定义配置,则返回默认配置,
* 如果获取到的值不为字符串,则返回空字符串
* @param path 访问路径,支持如: a.b、a['b'].c、a[0] 等格式
*/
get(path: string): string;
/**
* 通过 path 获取 i18n 配置中的上下文,并返回一个新的 i18n 实例
* @param path 访问路径,支持如: a.b、a['b'].c、a[0] 等格式
*/
getContext(path: string): I18n;
/**
* 用于连接模板字符串,模板字符串占位符为: {number},其中 number 为占位符索引,
* 如: template string {0} is {1}.
* @param template 模板字符串
* @param values 替换占位符的值,根据参数下标位置替换模板字符串的点位符
*/
joinTemplate(template: string, ...values: Array<string | number>): string;
private parse;
private getLabelByTokens;
}