public LocaleId getLocale () { return startDoc.getLocale(); }
private void handleStartDocument (Event event) { Util.createDirectories(directory + File.separator); // TODO: Move this check at the pensieve package level File file = new File(directory + File.separator + "segments.gen"); // Create a new index only if one does not exists yet // If one exists we pass false to append to it writer = TmWriterFactory.createFileBasedTmWriter(directory, !file.exists()); StartDocument sd = (StartDocument) event.getResource(); srcLoc = sd.getLocale(); }
private void processStartDocument(StartDocument res) { try { sourceLocale = res.getLocale();
private void processStartDocument (Event event) { try { StartDocument sd = (StartDocument)event.getResource(); // Create the output createWriter(sd); // Writer header writer.write(String.format("%s%s\t%s\t%s"+LINEBREAK, SIGNATURE, VERSION, sd.getLocale().toString(), language.toString())); crumbs = CRUMBS_PREFIX; } catch ( IOException e ) { throw new OkapiIOException("Error writing the header.", e); } }
try { buffer = new byte[2048]; sourceLocale = res.getLocale(); ZipSkeleton skel = (ZipSkeleton)res.getSkeleton();
String srcLCode = sd.getLocale().toString();
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(); }
private void processStartDocument (Event event) { StartDocument sd = (StartDocument)event.getResource(); // Create the output if ( outputStream == null ) { if (writer == null) { writer = new TMXWriter(outputPath); } else { writer.setPath(outputPath); } } else if ( outputStream != null ) { if (writer == null) { writer = new TMXWriter(new XMLWriter( new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))); } else { writer.setXmlWriter(new XMLWriter( new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))); } } writer.setWriteAllPropertiesAsAttributes(params.isWriteAllPropertiesAsAttributes()); writer.setExpandDuplicateProps(params.isEnableDuplicateProps()); writer.setPropValueSep(params.getPropValueSep()); writer.setGenerateUUID(params.isGenerateUUID()); writer.setNormalizeCodeIds(params.isNormalizeInlineIDs()); writer.writeStartDocument(sd, sd.getLocale(), locale, null, null, segType, "unknown", "text"); }
storageStack = new Stack<StorageList>(); this.inputLoc = resource.getLocale(); this.outputLoc = outputLocale; this.encoderManager = encoderManager;
@Override public String processStartDocument (LocaleId outputLocale, String outputEncoding, ILayerProvider layer, EncoderManager encoderManager, StartDocument resource) { setOutputLoc(outputLocale); setInputLoc(resource.getLocale()); setEncoderManager(encoderManager); this.params = (Parameters)resource.getFilterParameters(); if ( this.encoderManager != null ) { this.encoderManager.setDefaultOptions(params, outputEncoding, resource.getLineBreak()); this.encoderManager.updateEncoder(resource.getMimeType()); } // Process the resource XMLSkeleton skel = (XMLSkeleton)resource.getSkeleton(); if ( skel == null ) return ""; return skel.toString().replace("[#$$self$@%encoding]", outputEncoding); }
sourceLocale = event.getStartDocument().getLocale(); if (!Util.isNullOrEmpty(sourceLocale)) { processStartDocument(event);
setTargetLocale(startDocument.getLocale());