import { RequireService } from './require/require.interface'; import { Parser } from './parser/parser.interface'; import { SijilOpts } from './sijil.opts'; /** * Defines a BundlesService, whice is the main entry point for Sijil operations. * * A BundlesServices has three dependencies : * - RequireService : Used to fetch bundles * - Parser : Used to parse logic inside bundle values * - SijilOpts : An object containing custom settings */ export declare class BundlesService { private requireService; private parser; constructor(requireService: RequireService, parser: Parser, sijilOpts: SijilOpts); private bundles; /** * Fallback language. */ defaultLanguage: string; /** * Current language. */ currentLanguage: string; /** * Add keys/values to an existing bundle, or create it if missing. * * @param bundle An object containing translations as key / values. * @param lang The language to map the bundle with, or the current langugage if omitted. */ addToBundle(bundle: Object, lang?: string): void; /** * Loads a bundle and associates it with a language. * If the target language already contains key/values, then we mixin the new bundle and the existing one. * * @param where The path, or whatever the RequireService needs to fetch the bundle. * @param lang The target language, or the current language if omitted. * @returns A Promise, because the RequireService can be (is - by default) asynchronous. */ loadBundle(where: any, lang?: string): Promise; /** * Loads multiple bundles and associates then with a language. * * @see {@link loadBundle} */ loadBundles(specs: { lang: string; where: any; }[]): Promise; /** * Removes a bundle from the bundles list. * * @param lang Language to remove. */ unloadBundle(lang: string): void; /** * @returns Returns a list of all loaded languages. */ getLoadedLanguages(): string[]; /** * Translates a single key into a target language, using the parameters provided if needed. * * @param key Key to translate * @param parameters Parameters to use if the translation contains logic. * @param lang Target language, of the current language if omitted. * @returns The computed translation, or the key if no match was found in the bundles (including the fallback language bundle). */ translate(key: string, parameters?: Object | any[], lang?: string): string; }