Class Entry

java.lang.Object
org.omegat.filters3.Entry
Direct Known Subclasses:
XMLIntactEntry

public class Entry extends Object
Translatable entry. Holds a list of source tags and text, translated text and maintains correspondence between tags in source and in target.
  • Constructor Details

  • Method Details

    • clear

      public void clear()
      Cleans up this entry.
    • resetTagDetected

      public void resetTagDetected()
    • sourceToShortcut

      public String sourceToShortcut(boolean tagsAggregation, XMLDialect xmlDialect, List<ProtectedPart> protectedParts)
      Returns shortcut string representation of the entry source. This is what the user translates. E.g. for Here's <b>bold text</b> should return Here's <b0>bold text</b0>.
      Parameters:
      tagsAggregation - Whether tags of this entry can be aggregated.
      xmlDialect - dialect for processing shortcuts
    • sourceToTMX

      public String sourceToTMX()
      Returns long XML-encoded representation of the source entry for storing in TMX. E.g. for Here's <b>bold text</b> should return Here's <bpt i="0">&b0&gt;</bpt>bold text<ept i="0">&lt;/b0&gt;</ept>.
    • sourceToOriginal

      public String sourceToOriginal()
      Returns the entry source in its original form as it was in original document. E.g. for Here's <b>bold text</b> should return the same string Here's <b>bold text</b>.
    • setTranslation

      public void setTranslation(String translation, XMLDialect xmlDialect, List<ProtectedPart> protectedParts) throws TranslationException
      Sets the translation of the shortcut string returned by Tag.toShortcut(). Before setting translation checks whether the translation contains all the same tags in weakly correct order:
      • All the tags present in source must be present in translation. For example, It's <b>bold</b> text should not be translated as Etot tekst poluzhirnyi.
      • End tag goes after corresponding beginning tag. For example, It's <b>bold</b> text should not be translated as Etot tekst </b>poluzhirnyi<b>.
      • If standalone tag or tag pair was enclosed in another tag pair in source, it should be enclosed in translation. For example, It's <b>bold and <i>bold italic</i></b> text should not be translated as Etot tekst <b>poluzhirnyi</b> i <i>naklonnyi</i>.
      • Independent standalone tags and tag pairs may be reordered within entry. For example, It's <b>bold</b> and <i>italic</i> text can be translated as Etot tekst <i>naklonnyi</i> i <b>poluzhirnyi</b>.
      Throws:
      TranslationException - -- if any tag is missing or tags are ordered incorrectly.
    • translationToTMX

      public String translationToTMX()
      Returns long XML-encoded representation of the entry translation for storing in TMX.
    • translationToOriginal

      public String translationToOriginal()
      Returns the translated entry as it should be stored in translated document.
    • add

      public void add(Element elem)
      Adds an element to this entry. Can be either a Text or a Tag.
    • remove

      public void remove(int index)
      Removes an element from this entry.
    • get

      public Element get(int i)
      Gets an element. Can be either a Text or a Tag.
    • size

      public int size()
      Returns the number of source elements.
    • isEmpty

      public boolean isEmpty()
      Returns whether or not the elements list is empty.