Core methods¶
There are OmegaT standard API that provide a way to get current project, current GUI window, and
internal services defined in org.omegat.core.Core class.
Getter of core objects¶
There are very basic static methods to get core objects. You can call it anywhere from OmegaT components and 3rd party plugins.
Get project specific properties¶
Method |
Return Type |
Description |
|---|---|---|
getProject |
IProject |
Current project instance |
Component registrations¶
Plugins can be registered themselves through registration API.
Method |
Accepted type |
Description |
|---|---|---|
registerFilterClass |
IFilter class |
register filter component |
registerMachineTranslationClass |
IMachineTranslation class |
register MT connector |
registerMarkerClass |
IMarker class |
|
registerTokenizerClass |
ITokeninzer class |
Get GUI instances¶
Many accessor returns GUI pane/window instance.
There is some inconsistency such as MachineTranslatePane does not return something like
IMachineTranslates.
Method |
Return Type |
Description |
|---|---|---|
getEditor |
IEditor |
Get editor instance |
getMainWindow |
IMainWindow |
Get main window instance |
getTagValidation |
ITagValidation |
Get tag validation component |
getIssues |
IIssues |
Get issues window instance |
getMatcher |
IMatcher |
Get fuzzy match component |
getSpellChecker |
ISpellChecker |
Get spell checker component |
getFilterMaster |
FilterMaster |
Get FilterMaster instance |
getMachineTranslatePane |
MachineTranslateTextArea |
Get MT GUI pane |
getAutoSave |
IAutoSave |
|
getGlossary |
IGlossaries |
Get Glossary GUI pane |
getNotes |
INotes |
Get Notes GUI pane |
getComments |
IComments |
Get Comments GUI pane |
getDictionaries |
IDictionaries |
Get Dictionaries GUI pane |
Get internal processing components¶
Method |
Return Type |
Description |
|---|---|---|
getSegmenter |
Segmenter |
Get segmenter instance |
getMarkers |
List |
Get marker instances |
Core methods to start new application and project¶
These core methods are called from Main class.
Method |
Description |
|---|---|
initializeConsole |
Start console mode |
initializeGUI |
Start GUI mode |
FilterMaster methods¶
There is FilterMaster class that provide a way to invoke translater using corresponding filter type.
You can get FilterMaster instance using Core.getFilterMaster() static method.
FilterMaster has a following methods;
Method |
Return Type |
Description |
|---|---|---|
getConfig |
Filters |
Get ~/.omegat/filters.xml configuration |
getFilterInstance |
IFilter |
Get filter instance of specified class name |
translateFile |
void |
OmegaT core calls this method to translate a source file |
alignFile |
void |
|
setOptions |
void |
Set options for a specified filter |
You may want to use Core.getFilterMaster().getConfig() to get filters.xml configuration.
Filters.xml general configuration¶
These configurations are used in filters3.xml Abstract XML filters and HTML filter.
Method |
Property path |
Description |
|---|---|---|
isRemoveTags |
filters.removeTags |
Whether remove tags from source text |
isRemoveNonseg |
filters.removeNonseg |
|
isPreserveSpaces |
filters.preserveSpaces |
|
isIgnoreFileContext |
filters.ignoreFileContext |
Filter configuration¶
When your filter need to have options, you can use getOption accessor through AbstractOptions class.
See org.omegat.filters2.html2.HTMLOptions to know how to store options.
Method |
Property path |
Description |
|---|---|---|
isEnabled |
filters->filter.enabled |
Whether the specified filter is enabled or not |
getFiles |
filters->filter->files |
Get target “files” properties, file name pattern and extension |
getOption |
filters->filter.(name) |
Get filter’s arbitrary option list, form of listOf(name=value) |