/** * Creates a new {@link StartSubfilter} object with the identifier of the group's parent * and the group's identifier. * @param id the identifier of this sub filter. * @param startDoc The StartDocument resource of the subfilter. * @param parentEncoder the parent encoder. */ public StartSubfilter (String id, StartDocument startDoc, IEncoder parentEncoder) { super(startDoc.getName(), null, false); // Not referenced by default this.startDoc = startDoc; this.parentEncoder = parentEncoder; setId(id); }
@Override protected Event handleStartDocument (Event event) { StartDocument sd = (StartDocument)event.getResource(); fileName = Util.getFilename(sd.getName(), true); isMultilingual = sd.isMultilingual(); if(!isMultilingual){ logger.warn("File {} is not processed as a multiLingual file and cannot be used to populate the SimpleTm.", fileName); } return event; }
private void processStartDocument(Event event) { try { StartDocument sd = event.getStartDocument(); // Create the output createWriter(sd); // Writer header writer.write("|b" + sd.getName() + linebreak); } catch (IOException e) { throw new OkapiIOException("Error writing the versified text file header.", e); } }
protected void processStartDocument (Event event) { StartDocument sd = event.getStartDocument(); String docPath = sd.getName()==null ? "" : sd.getName(); if (System.getProperty("os.name").startsWith("Windows") && Pattern.matches("^/[A-Z]:.*$", docPath)) docPath = docPath.substring(1); String ori = manifest.getTempOriginalDirectory(); if ( Util.isEmpty(ori) ) return; // No copy to be done // Else: copy the original MergingInfo info = manifest.getItem(docId); String inputPath = exists(docPath) ? docPath : manifest.getInputRoot() + info.getRelativeInputPath(); String outputPath = ori + info.getRelativeInputPath(); StreamUtil.copy(inputPath, outputPath, false); }
private void processStartDocument (StartDocument resource) { // trgLoc was set before // fwOutputPath was set before create(fwOutputPath, null, resource.getLocale(), trgLoc, resource.getMimeType(), resource.getName(), null); // Additional variables specific to IFilterWriter mode fwInputEncoding = resource.getEncoding(); IParameters params = resource.getFilterParameters(); if ( params == null ) fwConfigId = null; else fwConfigId = params.getPath(); }
@Override protected void processStartDocument (Event event) { super.processStartDocument(event); writer = new XLIFFWriter(); referents = new LinkedHashMap<String, String>(); MergingInfo item = manifest.getItem(docId); rawDocPath = manifest.getTempSourceDirectory() + item.getRelativeInputPath() + ".xlf"; // Set the writer's options writer.setWithOriginalData(options.getwithOriginalData()); writer.setUseIndentation(true); // Create the writer trgLoc = manifest.getTargetLocale(); Util.createDirectories(rawDocPath); //TODO: This should be done by the writer. To change when it's implemented properly. writer.create(new File(rawDocPath), manifest.getSourceLocale().toBCP47(), trgLoc.toBCP47()); StartXliffData sxd = new StartXliffData(null); ITSWriter.addDeclaration(sxd); writer.writeStartDocument(sxd, null); // Original: use the document name if there is one (null is allowed) // For now we don't set ID for the files, the writer will generate them StartFileData sfd = new StartFileData(null); sfd.setOriginal(event.getStartDocument().getName()); writer.setStartFileData(sfd); }