Map<String, TextFlowTarget> translations, String locale,
Optional<String> params) throws FileFormatAdapterException,
IllegalArgumentException {
net.sf.okapi.common.LocaleId localeId =
net.sf.okapi.common.LocaleId.fromString(locale);
IFilterWriter writer = filter.createFilterWriter();
writer.setOptions(localeId, getOutputEncoding());
if (requireFileOutput) {
writeTranslatedFileWithFileOutput(output, originalFile,
translations, localeId, writer, params);
} else {
writer.setOutput(output);
generateTranslatedFile(originalFile, translations, localeId,
writer, params);
}
}