Class ProjectTMX

java.lang.Object
org.omegat.core.data.ProjectTMX

public class ProjectTMX extends Object
Class for store data from project_save.tmx.

Orphaned or non-orphaned translation calculated by RealProject.

  • Field Details

  • Constructor Details

  • Method Details

    • load

      public void load(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, Segmenter segmenter) throws Exception
      Throws:
      Exception
    • isEmpty

      public boolean isEmpty()
      Check TMX for empty.
    • save

      public void save(ProjectProperties props, String translationFile, boolean translationUpdatedByUser) throws Exception
      It saves current translation into file.
      Throws:
      Exception
    • exportTMX

      public void exportTMX(ProjectProperties props, File outFile, boolean forceValidTMX, boolean levelTwo, boolean useOrphaned) throws Exception
      Exports the TMX (Translation Memory Exchange) data from the project to a specified file.
      Parameters:
      props - The project properties containing source and target language information and other project-level settings.
      outFile - The output file to which the TMX data will be exported.
      forceValidTMX - A boolean indicating whether to enforce the generation of a valid TMX file.
      levelTwo - A boolean indicating whether to enable creation of TMX Level-2 format.
      useOrphaned - A boolean indicating whether orphaned entries (entries not currently in use) should be included in the export.
      Throws:
      Exception - If any error occurs during the export process.
    • getDefaultTranslation

      public TMXEntry getDefaultTranslation(String source)
      Get default translation or null if not exist.
    • getMultipleTranslation

      public TMXEntry getMultipleTranslation(EntryKey ek)
      Get multiple translation or null if not exist.
    • setTranslation

      public void setTranslation(SourceTextEntry ste, TMXEntry te, boolean isDefault)
      Set a new translation.
    • clear

      public void clear()
    • getDefaults

      public Collection<TMXEntry> getDefaults()
      Returns the collection of TMX entries that have a default translation
    • getAlternatives

      public Collection<TMXEntry> getAlternatives()
      Returns the collection of TMX entries that have an alternative translation.
      Returns:
      alternative entries
    • replaceContent

      public void replaceContent(ProjectTMX tmx)
      Replaces the content of the current ProjectTMX instance with the content of the provided ProjectTMX instance.

      This includes replacing the defaults and alternatives mappings with those from the given instance.

      Parameters:
      tmx - the ProjectTMX instance whose content will replace the current content
    • toString

      public String toString()
      Overrides:
      toString in class Object