Package org.omegat.core.data
Interface IProject
- All Known Implementing Classes:
NotLoadedProject,RealProject
public interface IProject
Interface for access to loaded project. Each loaded project will be new instance of IProject.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThese translations can't be null.static interfacestatic classstatic interfacestatic classException for optimistic locking fail. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose project.voidCommit source files in a team project.voidcompileProject(String sourcePattern) Create translated documents.voidcompileProjectAndCommit(String sourcePattern, boolean doPostProcessing, boolean commitTargetFiles) Builds translated files corresponding to sourcePattern and creates fresh TM files.Get all source segments.Get default and alternative translations for optimistic locking.Get all translation memories from /other_lang/ folder.Get info about each source file in project.Get project properties.Get ordered list of source file names.Returns tokenizer for source language.Get statistics info.getTargetPathForSourceFile(String sourceFile) For a given source file, calculate the path of the target file that would be created by running Create Translated Documents (the file may not exist yet).Returns tokenizer for target language.Get translation info for specified entry.Get all translation memories from /tm/ folder.booleanisOrphaned(String source) Check if orphaned.booleanisOrphaned(EntryKey entry) Check if orphaned.booleanGet project loaded status.booleanIs project modified ?booleanTells whether a project is a team projectbooleanCheck if team synchronization prepared.voidIterate by all default translations in project.voidIterate by all multiple translations in project.voidsaveProject(boolean doTeamSync) Save project.voidSave project properties only.voidsetNote(SourceTextEntry entry, TMXEntry oldTrans, String note) Change note only for translation.voidsetSourceFilesOrder(List<String> filesList) Set ordered list of source file names.voidsetTranslation(SourceTextEntry entry, PrepareTMXEntry trans, boolean defaultTranslation, TMXEntry.ExternalLinked externalLinked) Set translation for entry.voidsetTranslation(SourceTextEntry entry, PrepareTMXEntry trans, boolean defaultTranslation, TMXEntry.ExternalLinked externalLinked, IProject.AllTranslations previousTranslations) Set translation for entry with optimistic lock checking: if previous translation is not the same like in storage, OptimisticLockingFail exception will be generated.voidteamSync()Execute synchronization.voidPrepare for team synchronization from save thread.
-
Method Details
-
saveProjectProperties
Save project properties only.- Throws:
Exception
-
saveProject
void saveProject(boolean doTeamSync) Save project. -
teamSyncPrepare
Prepare for team synchronization from save thread.- Throws:
Exception
-
isTeamSyncPrepared
boolean isTeamSyncPrepared()Check if team synchronization prepared. -
teamSync
void teamSync()Execute synchronization. -
closeProject
void closeProject()Close project. -
compileProject
Create translated documents.- Throws:
Exception
-
compileProjectAndCommit
void compileProjectAndCommit(String sourcePattern, boolean doPostProcessing, boolean commitTargetFiles) throws Exception Builds translated files corresponding to sourcePattern and creates fresh TM files.- Parameters:
sourcePattern- The regexp of files to createdoPostProcessing- Whether or not we should perform external post-processing.commitTargetFiles- Whether or not we should commit target files- Throws:
Exception- If any error occurs during the compilation process.
-
isRemoteProject
boolean isRemoteProject()Tells whether a project is a team project- Returns:
- whether the project is a team project
-
commitSourceFiles
Commit source files in a team project.- Throws:
Exception- if any error occurs during the commit process
-
getProjectProperties
ProjectProperties getProjectProperties()Get project properties.- Returns:
- project properties
-
isProjectLoaded
boolean isProjectLoaded()Get project loaded status.- Returns:
- true if project loaded
-
isProjectModified
boolean isProjectModified()Is project modified ? -
getSourceTokenizer
ITokenizer getSourceTokenizer()Returns tokenizer for source language. -
getTargetTokenizer
ITokenizer getTargetTokenizer()Returns tokenizer for target language. -
getAllEntries
List<SourceTextEntry> getAllEntries()Get all source segments. It's unmodifiable list, so, there is no need synchronization to read it. -
setTranslation
void setTranslation(SourceTextEntry entry, PrepareTMXEntry trans, boolean defaultTranslation, @Nullable TMXEntry.ExternalLinked externalLinked) Set translation for entry.Optimistic locking will not be checked.
- Parameters:
entry- entrytrans- translation. It can't be null
-
setTranslation
void setTranslation(SourceTextEntry entry, PrepareTMXEntry trans, boolean defaultTranslation, TMXEntry.ExternalLinked externalLinked, IProject.AllTranslations previousTranslations) throws IProject.OptimisticLockingFail Set translation for entry with optimistic lock checking: if previous translation is not the same like in storage, OptimisticLockingFail exception will be generated. Use when user has typed a new translation.- Parameters:
entry- entrytrans- translation. It can't be null- Throws:
IProject.OptimisticLockingFail
-
setNote
Change note only for translation.- Parameters:
entry- entryoldTrans- old translationnote- note text
-
getStatistics
StatisticsInfo getStatistics()Get statistics info. -
getTranslationInfo
Get translation info for specified entry. It looks first for multiple, then for default. This method ALWAYS returns TMXEntry, because note can exist even for non-translated segment. Use TMXEntry.isTranslated() for check if translation text really exist. Translation can be checked for default/alternative by the TMXEntry.defaultTranslation.- Parameters:
ste- source entry- Returns:
- translation
-
getAllTranslations
Get default and alternative translations for optimistic locking. -
iterateByDefaultTranslations
Iterate by all default translations in project. -
iterateByMultipleTranslations
Iterate by all multiple translations in project. -
isOrphaned
Check if orphaned. -
isOrphaned
Check if orphaned. -
getTransMemories
Map<String,ExternalTMX> getTransMemories()Get all translation memories from /tm/ folder.- Returns:
- translation memories
-
getOtherTargetLanguageTMs
Map<Language,ProjectTMX> getOtherTargetLanguageTMs()Get all translation memories from /other_lang/ folder.- Returns:
- translation memories
-
getProjectFiles
List<IProject.FileInfo> getProjectFiles()Get info about each source file in project. It's unmodifiable list, so, there is no need synchronization to read it. -
getTargetPathForSourceFile
For a given source file, calculate the path of the target file that would be created by running Create Translated Documents (the file may not exist yet).The target path must be calculated because it can depend on project properties such as the target language, etc.
- Parameters:
sourceFile- The relative path (under thesourcedirectory) of the source file, e.g.Bundle.properties- Returns:
- The relative path (under the
targetdirectory) of the corresponding target file, e.g.Bundle_fr_FR.properties
-
getSourceFilesOrder
Get ordered list of source file names. -
setSourceFilesOrder
Set ordered list of source file names.
-