protected void writeResourceLevelProperties(Set<String> names, ITextUnit item, TextFragment srcSegment) { // Write any resource-level properties for ( String name : names ) { // Filter out attributes (temporary solution) if ( ATTR_NAMES.contains(";"+name+";") ) continue; writeProp(name, item.getProperty(name).getValue()); } }
private static void populateMetaDataFromProperties (ITextUnit textUnit, TranslationUnit tu) { MetadataType mdt; for (String key : textUnit.getPropertyNames()) { mdt = MetadataType.findMetadataType(key); if (mdt != null) { tu.getMetadata().put(mdt, textUnit.getProperty(key).getValue()); } else { //TODO: What do we do if mapping for metadata doesn't exist? It is enough for simpleTM replacement to //support a finite set. } } } }
protected void writeAllPropertiesAsAttibutes (XMLWriter writer, Set<String> names, ITextUnit item) { // Write any TU-level properties as attributes (but only standard attributes) for ( String name : names ) { if ( ATTR_NAMES.contains(";"+name+";") && !name.equals("tuid")) { writer.writeAttributeString(name, item.getProperty(name).getValue()); } } }
@Override protected boolean isEmpty(ITextUnit textUnit) { if (textUnit == null) return true; TextContainer source = textUnit.getSource(); Property prop = textUnit.getProperty(PROP_QUALIFIED); boolean isQualified = prop != null && "yes".equals(prop.getValue()); if (source.isEmpty() && !isQualified) return true; // 12/7/2015 Setting this to false otherwise it skips empty targets. // See isssue #511 return false; //return super.isEmpty(textUnit); // Always false in superclass } }
Property propGName = tu.getProperty(Database.NGRPNAME); if ( propGName == null ) propGName = tu.getProperty("Txt::"+Database.NGRPNAME); Property propFName = tu.getProperty(Database.NFILENAME); if ( propFName == null ) propFName = tu.getProperty("Txt::"+Database.NFILENAME);
if (resource.getProperty(NAME) != null) tmp = tmp.replace(NAME_PLACEHOLDER, String.format(" name=\"%s\"", resource.getProperty(NAME).getValue())); if (resource.getProperty(CANRESEGMENT) != null) tmp = tmp.replace(CANRESEGMENT_PLACEHOLDER, String.format(" canResegment=\"%s\"", resource.getProperty(CANRESEGMENT).getValue())); if (resource.getProperty(TRANSLATE) != null) tmp = tmp.replace(TRANSLATE_PLACEHOLDER, String.format(" translate=\"%s\"", resource.getProperty(TRANSLATE).getValue())); if (resource.getProperty(SRCDIR) != null) tmp = tmp.replace(SRCDIR_PLACEHOLDER, String.format(" srcDir=\"%s\"", resource.getProperty(SRCDIR).getValue())); if (resource.getProperty(TRGDIR) != null) tmp = tmp.replace(TRGDIR_PLACEHOLDER, String.format(" trgDir=\"%s\"", resource.getProperty(TRGDIR).getValue())); if (resource.getProperty(TYPE) != null) tmp = tmp.replace(TYPE_PLACEHOLDER, String.format(" type=\"%s\"", resource.getProperty(TYPE).getValue())); if (parts.length() > 0) { tmp = tmp.replace(SEGMENTS_PLACEHOLDER, parts.toString());
scalarType = resource.getProperty(YamlFilter.YAML_SCALAR_TYPE_PROPERTY_NAME); scalarFlow = resource.getProperty(YamlFilter.YAML_SCALAR_FLOW_PROPERTY_NAME); scalarParentIndent = resource.getProperty(YamlFilter.YAML_PARENT_INDENT_PROPERTY_NAME); flow = scalarFlow.getBoolean(); fullIndent = Integer.parseInt(scalarParentIndent.getValue());
if(tu.getProperty("tuid")!=null){ tu.setName(tu.getProperty("tuid").getValue());
@Override public String processTextUnit(ITextUnit tu) { if (tu.hasProperty(CommaSeparatedValuesFilter.PROP_QUALIFIED) && "yes".equals(tu.getProperty(CommaSeparatedValuesFilter.PROP_QUALIFIED).getValue())) { return super.processTextUnit(tu);
StringBuilder tmp = new StringBuilder(); Property prop = tu.getProperty(Property.NOTE);
ITextUnit tu = event.getTextUnit(); if (tu.getProperty("canResegment") != null && tu.getProperty("canResegment").getValue().equals("no")) { return event;
writer.writeAttributeString("coord", tu.getProperty(Property.COORDINATES).getValue()); writer.writeString(tu.getProperty(Property.NOTE).getValue()); writer.writeStartElement("note"); writer.writeAttributeString("from", "translator"); writer.writeString(tu.getProperty(Property.TRANSNOTE).getValue());
Note note = new Note(tu.getProperty(Property.NOTE).getValue(), Note.AppliesTo.UNDEFINED); note.setPriority(2); unit.addNote(note); Note note = new Note("From Translator: "+tu.getProperty(Property.TRANSNOTE).getValue(), Note.AppliesTo.UNDEFINED); note.setPriority(2); unit.addNote(note);