/** * Created by martin on 17.02.2017. * Collection of all parameters used by the tool. * The parameters are read form the profile or defaults are used. */ import { XliffMergeError } from './xliff-merge-error'; import { CommandOutput } from '../common/command-output'; import { ProgramOptions, IConfigFile } from './i-xliff-merge-options'; export declare class XliffMergeParameters { private usedProfilePath; private _quiet; private _verbose; private _allowIdChange; private _defaultLanguage; private _srcDir; private _i18nBaseFile; private _i18nFile; private _i18nFormat; private _encoding; private _genDir; private _languages; private _removeUnusedIds; private _supportNgxTranslate; private _ngxTranslateExtractionPattern; private _useSourceAsTarget; private _targetPraefix; private _targetSuffix; private _beautifyOutput; private _preserveOrder; private _autotranslate; private _apikey; private _apikeyfile; errorsFound: XliffMergeError[]; warningsFound: string[]; /** * Create Parameters. * @param options command options * @param profileContent given profile (if not, it is read from the profile path from options). */ static createFromOptions(options: ProgramOptions, profileContent?: IConfigFile): XliffMergeParameters; private constructor(); /** * Read potential profile. * To be a candidate, file must exist and contain property "xliffmergeOptions". * @param profilePath path of profile * @return parsed content of file or null, if file does not exist or is not a profile candidate. */ private static readProfileCandidate; /** * Initialize me from the profile content. * (public only for test usage). * @param options options given at runtime via command line * @param profileContent if null, read it from profile. */ private configure; /** * Read profile. * @param options program options * @return the read profile (empty, if none, null if errors) */ private readProfile; private adjustPathToProfilePath; private initializeFromConfig; /** * Check all Parameters, wether they are complete and consistent. * if something is wrong with the parameters, it is collected in errorsFound. */ private checkParameters; /** * Check syntax of language. * Must be compatible with XML Schema type xsd:language. * Pattern: [a-zA-Z]{1,8}((-|_)[a-zA-Z0-9]{1,8})* * @param lang language to check */ private checkLanguageSyntax; allowIdChange(): boolean; verbose(): boolean; quiet(): boolean; /** * Debug output all parameters to commandOutput. */ showAllParameters(commandOutput: CommandOutput): void; /** * Default-Language, default en. * @return default language */ defaultLanguage(): string; /** * Liste der zu bearbeitenden Sprachen. * @return languages */ languages(): string[]; /** * src directory, where the master xlif is located. * @return srcDir */ srcDir(): string; /** * The base file name of the xlif file for input and output. * Default is messages * @return base file */ i18nBaseFile(): string; /** * The master xlif file (the one generated by ng-xi18n). * Default is /.xlf. * @return master file */ i18nFile(): string; /** * Format of the master xlif file. * Default is "xlf", possible are "xlf" or "xlf2" or "xmb". * @return format */ i18nFormat(): string; /** * potentially to be generated I18n-File with the translations for one language. * @param lang language shortcut * @return Path of file */ generatedI18nFile(lang: string): string; private suffixForGeneratedI18nFile; /** * potentially to be generated translate-File for ngx-translate with the translations for one language. * @param lang language shortcut * @return Path of file */ generatedNgxTranslateFile(lang: string): string; /** * The encoding used to write new XLIFF-files. * @return encoding */ encoding(): string; /** * Output-Directory, where the output is written to. * Default is . */ genDir(): string; removeUnusedIds(): boolean; supportNgxTranslate(): boolean; ngxTranslateExtractionPattern(): string; /** * Whether source must be used as target for new trans-units * Default is true */ useSourceAsTarget(): boolean; /** * Praefix used for target when copying new trans-units * Default is "" */ targetPraefix(): string; /** * Suffix used for target when copying new trans-units * Default is "" */ targetSuffix(): string; /** * If set, run xml result through beautifier (pretty-data). */ beautifyOutput(): boolean; /** * If set, order of new trans units will be as in master. * Otherwise they are added at the end. */ preserveOrder(): boolean; /** * Whether to use autotranslate for new trans-units * Default is false */ autotranslate(): boolean; /** * Whether to use autotranslate for a given language. * @param lang language code. */ autotranslateLanguage(lang: string): boolean; /** * Return a list of languages to be autotranslated. */ autotranslatedLanguages(): string[]; /** * API key to be used for Google Translate * @return api key */ apikey(): string; /** * file name for API key to be used for Google Translate. * Explicitly set or read from env var API_KEY_FILE. * @return file of api key */ apikeyfile(): string; }