import { GlobalConfig } from './eui-app-config';
import { EuiLanguage } from '../eui-language/eui-language.model';
export interface I18nResource {
    /** prefix of the resource could be like the 2 char language code e.g. /en */
    prefix: string;
    /** suffix can be either .json or anything related of the resource HTTP call */
    suffix?: string;
    /**
     It is an ID of the function which should be defined into the customHandlers with the interface TranslationsCompiler
     */
    compileTranslations?: string;
}
/**
 * a factory to compile translations into the main object holding them all
 *
 * @param translations the object to be pre-processed
 * @param lang the translations language
 * @returns the pre-processed translations
 */
export type TranslationsCompiler<T = unknown, C = unknown> = (translations: T, lang: string) => C;
export interface I18nConfig {
    i18nService: I18nServiceConfig;
    i18nLoader: I18nLoaderConfig;
}
export interface I18nServiceConfig {
    /** an ISO 2 char code array of available languages */
    languages?: (string | EuiLanguage)[];
    /** default language to be used in case of not any has been set */
    defaultLanguage?: string;
}
export interface I18nLoaderConfig {
    /**
     * Those folders will be used to load the translations files from {@link https://angular.io/guide/workspace-config#extra-build-and-test-options assets}.
     * e.g [`${environment.apiBaseUrl}translations/`, `${environment.apiBaseUrl}translations?lang=`]
     * Important! the language code will be added automatically to the end of the url except if the url ends with a slash.
     */
    i18nFolders?: string | string[];
    /**
     * Array of service urls to translation, don't add the language it will be added e.g. http://net1/trans/en
     * Keep in mind that the url should be the prefix and not contain any suffix.
     */
    i18nServices?: string | string[];
    /**
     * It is a set of more customized resources to be loaded. You can provide a function to compile the translations or simply
     * provide the prefix and suffix of the resource, or both.
     *
     * @example
     * ```typescript
     * export function CompileTranslations(translations: any): any {
     *     const result = {};
     *     translations.forEach((translation: any) => {
     *         // extract the key and value from the translation object
     *         const key = translation['key'];
     *         const value = translation['value'];
     *         if (key && value) {
     *             result[key] = value;
     *         }
     *     });
     *     return result;
     * }
     * export const appConfig: EuiAppConfig = {
     *     ...,
     *     customHandler: {
     *         'CompileTranslations_ID': CompileTranslations
     *     }
     * };
     * export const GLOBAL: GlobalConfig = {
     *     ...,
     *     i18n: {
     *       i18nLoader: {
     *         i18nFolders: ['i18n-eui'],
     *         i18nResources: [{
     *             prefix: 'api/translations/',
     *             compileTranslations: 'CompileTranslations_ID',
     *         }]
     *       }
     *     }
     * };
     *
     */
    i18nResources?: I18nResource | I18nResource[];
}
export declare const getI18nServiceConfigFromBase: (baseGlobalConfig: GlobalConfig) => I18nServiceConfig;
export declare const getI18nServiceConfig: (config: I18nServiceConfig) => I18nServiceConfig;
export declare const getI18nLoaderConfig: (config: I18nLoaderConfig) => I18nLoaderConfig;
/**
 * returns a language code based on https://tools.ietf.org/rfc/bcp/bcp47.txt specification. To get the Browser's
 * it's using the navigator.language, splits by hyphen and get the first part.
 */
export declare const getBrowserDefaultLanguage: () => string;
/**
 * returns an array of DOMStrings representing the user's preferred languages. The language is described using BCP 47
 * language tags. In the returned array they are ordered by preference with the most preferred language first.
 * The array languages will be lower cased 2 char code.
 */
export declare const getBrowserPreferredLanguages: () => string[];
//# sourceMappingURL=i18n.config.d.ts.map