Plugin System¶
Summary¶
OmegaT's plugin architecture allows extending functionality through .jar files that register new filters, machine translators, glossaries, tokenizers, markers, and base functionality — without modifying the core codebase.
How Plugins Work¶
A plugin is a single .jar file placed in the /plugins/ directory (user-level: ~/.omegat/plugins/ or system-level). If a plugin needs additional libraries, they are placed in the same directory.
Plugin Manifest¶
Since OmegaT 3.0.1+, a plugin declares its initialization class in the manifest:
Plugin-Name: My Plugin
Plugin-Version: 1.0.0
Plugin-Author: Developer Name
Plugin-Description: What this plugin does
OmegaT-Plugins: com.example.MyPluginInit
The initialization class must have:
java
public static void loadPlugins() // Called at startup, before GUI init
public static void unloadPlugins() // Called at shutdown
Plugin Types¶
| Type | Purpose | Registration |
|---|---|---|
| filter | Parse/build translation files in new formats | Core.registerFilterClass() |
| tokenizer | Split segments into tokens for spell checking/matching | Core.registerTokenizerClass() |
| marker | Visual markers in the editor (e.g., highlighting) | Core.registerMarkerClass() |
| machinetranslator | Integrate MT engines (Google, DeepL, Azure) | Core.registerMachineTranslatorClass() |
| glossary | Provide glossary/terminology results | Core.registerGlossaryClass() |
| base | General-purpose plugins without specific type | Standard registration |
Plugin Loading Lifecycle¶
- Startup —
loadPlugins()runs before any GUI initialization - Registration — Plugin registers its classes (filters, markers, etc.)
- Version check — Plugin should verify OmegaT compatibility
- Error handling — If incompatible,
Core.pluginLoadingError()shows message after GUI init - Shutdown —
unloadPlugins()runs on application exit (usually empty)
Best Practices¶
- Separate initialization from implementation — The init class should only use
CoreandCoreEventsto catch loading errors gracefully - Don't execute long operations in
loadPlugins()— It blocks startup - Check version compatibility — Use try/catch to handle API changes between OmegaT versions
- FatJar packaging — Bundle all runtime dependencies into a single jar
Extension Points (Post-GUI)¶
Additional extension points available after GUI initialization via IApplicationEventListener.onApplicationStartup():
- IGlossary — Custom glossary providers via
Core.getGlossaryManager().addGlossaryProvider() - IDictionaryFactory / IDictionary — Custom dictionary formats via
Core.getDictionaries().addDictionaryFactory() - AbstractAutoCompleterView — Custom auto-completion UIs via
Core.getEditor().getAutoCompleter().addView()
Plugin Development¶
OmegaT provides:
- plugin-skeleton — Gradle-based plugin development starter with Groovy and Kotlin DSL examples
- gradle-omegat-plugin — Custom Gradle plugin handling OmegaT core references
- FatJar generation — PackIntoJar configuration bundles dependencies automatically
- CI/CD — GitHub Actions example for automated plugin builds
Notable Plugins¶
- DeepL Connector — DeepL V2 API integration
- Azure Translate — Microsoft Azure Translate V3
- Certified plugins database — Community-maintained collection at omegat-plugins (Kotlin)
See Also¶
- Omegat Architecture
- Filter System
machine-translation-integration