OmegaT Architecture¶
Summary¶
OmegaT uses a component-based, event-driven architecture built in Java with a modular Gradle multi-project build. Components communicate through well-defined interfaces and an event system, with a Swing-based UI and an extensible plugin system.
Core Components¶
All components are accessible via the Core class static methods. Each implements a specific interface, and only that interface should be used for inter-component communication.
| Component | Interface | Purpose |
|---|---|---|
| Main Window | IMainWindow |
Controls the main application frame; locks/unlocks UI, displays messages and errors |
| Editor | IEditor |
The translation editor; only one active editor at a time, but theoretically swappable without project reload |
| Project | IProject |
Interface for the currently loaded project; two implementations: RealProject and NotLoadedProject; stores all project data |
| Matcher | IMatcher |
Panel that finds matches in translation memory (TM) files and other translations |
| Tag Validator | ITagValidation |
Checks tags in all translations and shows invalid tags |
| Tokenizer | ITokenizer |
Splits segments into tokens for spell checking and match finding |
| Spell Checker | ISpellChecker |
Spell checker for translation text |
Event System¶
Components communicate through CoreEvents — a publish/subscribe event system. Components register listeners via CoreEvents.register... methods.
Event Types¶
| Event | Trigger |
|---|---|
IProjectEventListener.onProjectChanged() |
Project closed, compiled, created, loaded, or saved |
IEntryEventListener.onNewFile() |
User changes the current file in the editor |
IEntryEventListener.onEntryActivated() |
User changes the current entry in the editor |
IFontChangedEventListener.onFontChanged() |
User changes the application font |
All event listeners execute in the UI (Swing event dispatcher) thread via invokeLater. Event listening is the preferred way to handle project open/close and entry changes, since the list of components can be large and the application cannot know about user-defined components.
Threading Model¶
- Short-term operations — executed in the UI thread (event dispatcher thread)
- Long-term operations — use
SwingWorker, locking the UI to prevent user interaction - SaveThread — the only "real" background thread; saves the project every 10 minutes automatically
Project Lifecycle¶
Application states:
- Not loaded —
NotLoadedProjectinstance - Open project —
RealProjectinstance created - Close and reopen — new
RealProjectinstance created (previous is discarded)
Project loading sequence: - Initialize project structure - Load source files through appropriate filters - Load translation memory (TMX) - Load glossaries - Load previous translations - Initialize editor with first file
Filter System¶
OmegaT supports many file formats through a filter architecture. Each filter class can: 1. Read the document in a given format 2. Extract translatable content 3. Write the document back, replacing translatable content with translations
FilterMaster organizes all filters and detects which filter to use for a given file format. Filters are distinguished by file extension and content.
Output Filename Patterns¶
Output filenames use variable substitution:
- ${filename} — full input filename (default)
- ${nameOnly} — name without extension
- ${extension} — file extension
- ${sourceLanguage} / ${targetLanguage} — project languages
Example: Java Resource Bundles use ${nameOnly}_${targetLanguage}.${extension}.
XML Processing¶
OmegaT has sophisticated XML handling: - Paragraph tags declare new paragraphs but don't define translatable/untranslatable parts - Intact tags mark content that should NOT be translated - Paired tags — OmegaT handles balanced/unbalanced tag pairs - Content-based tags — tags that shouldn't be skipped even if leading/trailing - Spaces processing — distinguishes formatting spaces from real leading/trailing spaces in formatted vs unformatted XML
Modular Architecture¶
The source tree is a Gradle multi-project:
| Module | Purpose |
|---|---|
src/ |
Core application |
aligner/ |
TM alignment module |
machinetranslators/ |
MT integrations (Google, DeepL, Azure) |
language-modules/ |
Language-specific segmentation/tokenization |
spellchecker/ |
Spell checking |
theme/ |
UI theming |
firsttime-wizard/ |
First-run onboarding |
tipoftheday/ |
Tips system |
Gradle compiles modules concurrently, using as many cores as available.
Plugin Architecture¶
Plugins are .jar files placed in /plugins/ directory with manifest entries:
- Plugin-Name, Plugin-Version, Plugin-Author, Plugin-Description
- OmegaT-Plugins: <classname> — initialization class
Plugin types: filter, tokenizer, marker, machinetranslator, base, glossary
Plugins register via Core.registerFilterClass(), Core.registerMarkerClass(), etc. The loadPlugins() method runs at startup before GUI initialization.
Build System¶
- Gradle multi-project with concurrent compilation
- JDK 11+ for building, Java 8+ compatible runtime
- Custom-patched libraries when upstream is abandoned (forks on github.com/omegat-org)
- Smart task execution — Gradle skips unchanged parts (UP-TO-DATE, FROM-CACHE)
- Containerized builds for installers (InnoSetup for Windows, Mac signing)
local.propertiesfor signed installers and custom configuration