/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import type { Config } from '../types/config.js'; import type { Locale } from '../types/locale.js'; import { Formatter } from './index.js'; import { Bundle, Message, ProgramMessage } from '../messages.js'; /** * Create an XLIFF formatter from a main config object. */ export declare function xliffFactory(config: Config): XliffFormatter; /** * Formatter for XLIFF v1.2 * https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html */ export declare class XliffFormatter implements Formatter { private config; private xliffConfig; constructor(config: Config); /** * For each target locale, look for the file "/.xlf", and if * it exists, parse out translations. */ readTranslations(): Bundle[]; /** * Parse the given XLIFF XML string and return its translations. */ private parseXliff; /** * Write a "/.xlf" file for each target locale. If a message * has already been translated, it will have both a and a . * Otherwise, it will only have a . */ writeOutput(sourceMessages: ProgramMessage[], translations: Map): Promise; /** * Encode the given locale in XLIFF format. */ private encodeLocale; /** * Encode the given message contents in XLIFF format. */ private encodeContents; private createPlaceholder; private initNewTargetDocument; private readTranslationFile; private makeExistingTranslationsMap; private getElementByTagName; private getNoteElement; /** * xmldom does not implement replaceChildren. */ private clearElement; /** * Append childNode to parentNode, try to preserve some * whitespace / indentation for common scenarios. */ private appendChild; private removeChildAndPrecedingText; private createIndentFunction; }