Package org.omegat.core.data
Class ProjectTMX
java.lang.Object
org.omegat.core.data.ProjectTMX
Class for store data from project_save.tmx.
Orphaned or non-orphaned translation calculated by RealProject.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis interface is used as a callback mechanism to check if specific entries or source texts exist in a project. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for TMX delta, clone and tests.ProjectTMX(ProjectTMX.CheckOrphanedCallback callback) ProjectTMX(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, ProjectTMX.CheckOrphanedCallback callback) ProjectTMX(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, ProjectTMX.CheckOrphanedCallback callback, Segmenter segmenter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidexportTMX(ProjectProperties props, File outFile, boolean forceValidTMX, boolean levelTwo, boolean useOrphaned) Exports the TMX (Translation Memory Exchange) data from the project to a specified file.Returns the collection of TMX entries that have an alternative translation.Returns the collection of TMX entries that have a default translationgetDefaultTranslation(String source) Get default translation or null if not exist.Get multiple translation or null if not exist.booleanisEmpty()Check TMX for empty.voidload(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, Segmenter segmenter) voidreplaceContent(ProjectTMX tmx) Replaces the content of the currentProjectTMXinstance with the content of the providedProjectTMXinstance.voidsave(ProjectProperties props, String translationFile, boolean translationUpdatedByUser) It saves current translation into file.voidsetTranslation(SourceTextEntry ste, TMXEntry te, boolean isDefault) Set a new translation.toString()
-
Field Details
-
PROP_ORIGIN
- See Also:
-
-
Constructor Details
-
ProjectTMX
public ProjectTMX(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, ProjectTMX.CheckOrphanedCallback callback) -
ProjectTMX
public ProjectTMX(Language sourceLanguage, Language targetLanguage, boolean isSentenceSegmentingEnabled, File file, ProjectTMX.CheckOrphanedCallback callback, Segmenter segmenter) -
ProjectTMX
-
ProjectTMX
public ProjectTMX()Constructor for TMX delta, clone and tests.
-
-
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
Get default translation or null if not exist. -
getMultipleTranslation
Get multiple translation or null if not exist. -
setTranslation
Set a new translation. -
clear
public void clear() -
getDefaults
Returns the collection of TMX entries that have a default translation -
getAlternatives
Returns the collection of TMX entries that have an alternative translation.- Returns:
- alternative entries
-
replaceContent
Replaces the content of the currentProjectTMXinstance with the content of the providedProjectTMXinstance.This includes replacing the defaults and alternatives mappings with those from the given instance.
- Parameters:
tmx- theProjectTMXinstance whose content will replace the current content
-
toString
-