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 Classes Modifier and Type Interface Description static class
IProject.AllTranslations
These translations can't be null.static interface
IProject.DefaultTranslationsIterator
static class
IProject.FileInfo
static interface
IProject.MultipleTranslationsIterator
static class
IProject.OptimisticLockingFail
Exception for optimistic locking fail.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeProject()
Close project.void
commitSourceFiles()
Commit source files in a team project.void
compileProject(java.lang.String sourcePattern)
Create translated documents.void
compileProjectAndCommit(java.lang.String sourcePattern, boolean doPostProcessing, boolean commitTargetFiles)
Builds translated files corresponding to sourcePattern and creates fresh TM files.java.util.List<SourceTextEntry>
getAllEntries()
Get all source segments.IProject.AllTranslations
getAllTranslations(SourceTextEntry ste)
Get default and alternative translations for optimistic locking.java.util.Map<Language,ProjectTMX>
getOtherTargetLanguageTMs()
Get all translation memories from /other_lang/ folder.java.util.List<IProject.FileInfo>
getProjectFiles()
Get info about each source file in project.ProjectProperties
getProjectProperties()
Get project properties.java.util.List<java.lang.String>
getSourceFilesOrder()
Get ordered list of source file names.ITokenizer
getSourceTokenizer()
Returns tokenizer for source language.StatisticsInfo
getStatistics()
Get statistics for project.java.lang.String
getTargetPathForSourceFile(java.lang.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).ITokenizer
getTargetTokenizer()
Returns tokenizer for target language.TMXEntry
getTranslationInfo(SourceTextEntry ste)
Get translation info for specified entry.java.util.Map<java.lang.String,ExternalTMX>
getTransMemories()
Get all translation memories from /tm/ folder.boolean
isOrphaned(java.lang.String source)
Check if orphaned.boolean
isOrphaned(EntryKey entry)
Check if orphaned.boolean
isProjectLoaded()
Get project loaded status.boolean
isProjectModified()
Is project modified ?boolean
isRemoteProject()
Tells whether a project is a team projectboolean
isTeamSyncPrepared()
Check if team synchronization prepared.void
iterateByDefaultTranslations(IProject.DefaultTranslationsIterator it)
Iterate by all default translations in project.void
iterateByMultipleTranslations(IProject.MultipleTranslationsIterator it)
Iterate by all multiple translations in project.void
saveProject(boolean doTeamSync)
Save project.void
saveProjectProperties()
Save project properties only.void
setNote(SourceTextEntry entry, TMXEntry oldTrans, java.lang.String note)
Change note only for translation.void
setSourceFilesOrder(java.util.List<java.lang.String> filesList)
Set ordered list of source file names.void
setTranslation(SourceTextEntry entry, PrepareTMXEntry trans, boolean defaultTranslation, TMXEntry.ExternalLinked externalLinked)
Set translation for entry.void
setTranslation(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.void
teamSync()
Execute synchronization.void
teamSyncPrepare()
Prepare for team synchronization from save thread.
-
-
-
Method Detail
-
saveProjectProperties
void saveProjectProperties() throws java.lang.Exception
Save project properties only.- Throws:
java.lang.Exception
-
saveProject
void saveProject(boolean doTeamSync)
Save project.
-
teamSyncPrepare
void teamSyncPrepare() throws java.lang.Exception
Prepare for team synchronization from save thread.- Throws:
java.lang.Exception
-
isTeamSyncPrepared
boolean isTeamSyncPrepared()
Check if team synchronization prepared.
-
teamSync
void teamSync()
Execute synchronization.
-
closeProject
void closeProject()
Close project.
-
compileProject
void compileProject(java.lang.String sourcePattern) throws java.lang.Exception
Create translated documents.- Throws:
java.lang.Exception
-
compileProjectAndCommit
void compileProjectAndCommit(java.lang.String sourcePattern, boolean doPostProcessing, boolean commitTargetFiles) throws java.lang.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:
java.lang.Exception
-
isRemoteProject
boolean isRemoteProject()
Tells whether a project is a team project- Returns:
- whether the project is a team project
-
commitSourceFiles
void commitSourceFiles() throws java.lang.Exception
Commit source files in a team project.- Throws:
java.lang.Exception
-
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
java.util.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, 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
void setNote(SourceTextEntry entry, TMXEntry oldTrans, java.lang.String note)
Change note only for translation.- Parameters:
entry
- entryoldTrans
- old translationnote
- note text
-
getStatistics
StatisticsInfo getStatistics()
Get statistics for project.- Returns:
-
getTranslationInfo
TMXEntry getTranslationInfo(SourceTextEntry ste)
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
IProject.AllTranslations getAllTranslations(SourceTextEntry ste)
Get default and alternative translations for optimistic locking.
-
iterateByDefaultTranslations
void iterateByDefaultTranslations(IProject.DefaultTranslationsIterator it)
Iterate by all default translations in project.
-
iterateByMultipleTranslations
void iterateByMultipleTranslations(IProject.MultipleTranslationsIterator it)
Iterate by all multiple translations in project.
-
isOrphaned
boolean isOrphaned(java.lang.String source)
Check if orphaned.
-
isOrphaned
boolean isOrphaned(EntryKey entry)
Check if orphaned.
-
getTransMemories
java.util.Map<java.lang.String,ExternalTMX> getTransMemories()
Get all translation memories from /tm/ folder.- Returns:
- translation memories
-
getOtherTargetLanguageTMs
java.util.Map<Language,ProjectTMX> getOtherTargetLanguageTMs()
Get all translation memories from /other_lang/ folder.- Returns:
- translation memories
-
getProjectFiles
java.util.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
java.lang.String getTargetPathForSourceFile(java.lang.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).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 thesource
directory) of the source file, e.g.Bundle.properties
- Returns:
- The relative path (under the
target
directory) of the corresponding target file, e.g.Bundle_fr_FR.properties
-
getSourceFilesOrder
java.util.List<java.lang.String> getSourceFilesOrder()
Get ordered list of source file names.
-
setSourceFilesOrder
void setSourceFilesOrder(java.util.List<java.lang.String> filesList)
Set ordered list of source file names.
-
-