File

packages/base/src/lib/eui-models/eui-config/i18n.config.ts

Index

Properties

Properties

i18nFolders
i18nFolders: string | string[]
Type : string | string[]
Optional

Those folders will be used to load the translations files from 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.

i18nResources
i18nResources: I18nResource | I18nResource[]
Type : I18nResource | I18nResource[]
Optional

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 :
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',
        }]
      }
    }
};



i18nServices
i18nServices: string | string[]
Type : string | string[]
Optional

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.

results matching ""

    No results matching ""