UNPKG

@pisell/pisellos

Version:

一个可扩展的前端模块化SDK框架,支持插件系统

38 lines (37 loc) 1.21 kB
import { Locale, LibraryItem, LoadLibraryByUrlParams } from "./type"; import App from "../app"; export interface LocalesOptions { locale?: Locale; library?: { [key in Locale]: LibraryItem; }; } export declare class Locales { private app; locale: string; library: { [key in Locale]: LibraryItem; }; constructor(app: App, options?: LocalesOptions); getLocale: () => string; getCurrentTexts: (locale?: Locale) => { [key: string]: string; }; setLocale: (locale: Locale, reload?: boolean) => void; getText: (id: string, locale?: Locale) => string; isCN: () => boolean; loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{ [x: string]: LibraryItem; }>; loadLibraryByItems(libraryList: LibraryItem[]): void; loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{ [x: string]: LibraryItem; }>; translation: (text: string | { [key: Locale]: string; }, locale?: Locale) => string | number; getLibraryByData: (data: LibraryItem[]) => LibraryItem; createTextsByLibrary: (id: string, library?: { [key in Locale]: LibraryItem; }) => { [x: string]: string; }; }