ngx-i18nsupport-lib
Version:
A Typescript library to work with Angular generated i18n files (xliff, xmb)
46 lines (45 loc) • 2.33 kB
TypeScript
/**
* Created by roobm on 21.03.2017.
*/
import { ITranslationMessagesFile } from './i-translation-messages-file';
/**
* Helper class to read translation files depending on format.
* This is part of the public api
*/
export declare class TranslationMessagesFileFactory {
/**
* Read file function, result depends on format, either XliffFile or XmbFile.
* @param i18nFormat currently 'xlf' or 'xlf2' or 'xmb' or 'xtb' are supported
* @param xmlContent the file content
* @param path the path of the file (only used to remember it)
* @param encoding utf-8, ... used to parse XML.
* This is read from the file, but if you know it before, you can avoid reading the file twice.
* @param optionalMaster in case of xmb the master file, that contains the original texts.
* (this is used to support state infos, that are based on comparing original with translated version)
* Ignored for other formats.
* @return {ITranslationMessagesFile} either XliffFile or XmbFile
*/
static fromFileContent(i18nFormat: string, xmlContent: string, path: string, encoding: string, optionalMaster?: {
xmlContent: string;
path: string;
encoding: string;
}): ITranslationMessagesFile;
/**
* Read file function for any file with unknown format.
* This functions tries to guess the format based on the filename and the content of the file.
* Result depends on detected format, either XliffFile or XmbFile.
* @param xmlContent the file content
* @param path the path of the file (only used to remember it)
* @param encoding utf-8, ... used to parse XML.
* This is read from the file, but if you know it before, you can avoid reading the file twice.
* @param optionalMaster in case of xmb the master file, that contains the original texts.
* (this is used to support state infos, that are based on comparing original with translated version)
* Ignored for other formats.
* @return {ITranslationMessagesFile} either XliffFile or XmbFile
*/
static fromUnknownFormatFileContent(xmlContent: string, path: string, encoding: string, optionalMaster?: {
xmlContent: string;
path: string;
encoding: string;
}): ITranslationMessagesFile;
}