Class ParseEntry

  • All Implemented Interfaces:
    IParseCallback

    public abstract class ParseEntry
    extends java.lang.Object
    implements IParseCallback
    Process one entry on parse source file. This class caches segments for one file, then flushes they. It required to ability to link prev/next segments.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ParseEntry.ParseEntryResult
      Storage for results of entry parsing, i.e.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(java.lang.String id, java.lang.String source, java.lang.String translation, boolean isFuzzy, java.lang.String comment, java.lang.String path, IFilter filter, java.util.List<ProtectedPart> protectedParts)
      This method is called by filters to add new entry in OmegaT after read it from source file.
      void addEntry​(java.lang.String id, java.lang.String source, java.lang.String translation, boolean isFuzzy, java.lang.String comment, IFilter filter)
      This method is called by filters to add new entry in OmegaT after read it from source file.
      void addEntryWithProperties​(java.lang.String id, java.lang.String source, java.lang.String translation, boolean isFuzzy, java.lang.String[] props, java.lang.String path, IFilter filter, java.util.List<ProtectedPart> protectedParts)
      This method is called by filters to add new entry in OmegaT after read it from source file.
      void linkPrevNextSegments()
      This method can be called from any filter on the end of file processing.
      static java.lang.String stripSomeChars​(java.lang.String src, ParseEntry.ParseEntryResult per, boolean removeTags, boolean removeSpaces)
      Strip some chars for represent string in UI.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • linkPrevNextSegments

        public void linkPrevNextSegments()
        This method can be called from any filter on the end of file processing. It links prev/next segments for multiple translations.
        Specified by:
        linkPrevNextSegments in interface IParseCallback
      • addEntryWithProperties

        public void addEntryWithProperties​(java.lang.String id,
                                           java.lang.String source,
                                           java.lang.String translation,
                                           boolean isFuzzy,
                                           java.lang.String[] props,
                                           java.lang.String path,
                                           IFilter filter,
                                           java.util.List<ProtectedPart> protectedParts)
        This method is called by filters to add new entry in OmegaT after read it from source file.
        Specified by:
        addEntryWithProperties in interface IParseCallback
        Parameters:
        id - ID of entry, if format supports it
        source - Translatable source string
        translation - translation of the source string, if format supports it
        isFuzzy - flag for fuzzy translation. If a translation is fuzzy, it is not added to the projects TMX, but it is added to the generated 'reference' TMX, a special TMX that is used as extra reference during translation.
        props - a staggered array of non-uniquely-identifying key=value properties (metadata) for the entry. If property is org.omegat.core.data.SegmentProperties.REFERENCE, the entire segment is added only to the generated 'reference' TMX, a special TMX that is used as extra reference during translation. The segment is not added to the list of translatable segments. Property can also be org.omegat.core.data.SegmentProperties.COMMENT, which shown in the comment panel. Other properties are possible, but have no special meaning in OmegaT.
        path - path of entry in file
        filter - filter which produces entry
        protectedParts - protected parts
      • addEntry

        public void addEntry​(java.lang.String id,
                             java.lang.String source,
                             java.lang.String translation,
                             boolean isFuzzy,
                             java.lang.String comment,
                             java.lang.String path,
                             IFilter filter,
                             java.util.List<ProtectedPart> protectedParts)
        This method is called by filters to add new entry in OmegaT after read it from source file.

        Old call for filters that only support extracting a "comment" property. Kept for compatibility.

        Specified by:
        addEntry in interface IParseCallback
      • addEntry

        public void addEntry​(java.lang.String id,
                             java.lang.String source,
                             java.lang.String translation,
                             boolean isFuzzy,
                             java.lang.String comment,
                             IFilter filter)
        This method is called by filters to add new entry in OmegaT after read it from source file.

        Old call without path, for compatibility. Comment is converted to a property.

        Specified by:
        addEntry in interface IParseCallback
        Parameters:
        id - ID of entry, if format supports it
        source - Translatable source string
        translation - translation of the source string, if format supports it
        isFuzzy - flag for fuzzy translation. If a translation is fuzzy, it is not added to the projects TMX, but it is added to the generated 'reference' TMX, a special TMX that is used as extra reference during translation.
        comment - entry's comment, if format supports it
        filter - filter which produces entry
      • stripSomeChars

        public static java.lang.String stripSomeChars​(java.lang.String src,
                                                      ParseEntry.ParseEntryResult per,
                                                      boolean removeTags,
                                                      boolean removeSpaces)
        Strip some chars for represent string in UI.
        Parameters:
        src - source string to strip chars
        Returns:
        result