Cyclotis patches : API
If you want to write a plugin based on Cyclotis patches for OmegaT, here is what you have to do.
Translation memory plugin
These plugins must implement one of the following interfaces:
org.omegat.core.matching.external.IExternalMemoryfor read-only, non-browsable memory like MyMemory;
org.omegat.core.search.ISearchable<PrepareTMXEntry>if the memory can also be used in the "Search project" window;
org.omegat.core.matching.external.IBrowsableMemoryfor a memory which accepts to retreive full contents (actually the only exception is MyMemory, which provides nothing to retrieve all results). Such a memory is always searchable, and it can be used in
org.omegat.core.matching.external.IWritableExternalMemoryfor a memory which will receive updates each time the user validates a segment
These are interfaces, not classes, so you can implement more than one interface.
Plugins which appear in "Translation memories" menu must extend class
org.omegat.core.matching.external.MenuMemory and you must add an entry in the MANIFEST.MF (yes, old method).
Plugins which are parametrized using a Java.properties file must have a constructor taking a
java.util.Properties instance, and that's all: when OmegaT founds a properties file in tm folder, it searches for the class whose name is in the parameter "class" in the file, if found it calls the constructor. If there are more than one file in the folder, each one generates one object, so one call to the constructor. But some plugins, including Cyclotis, are capable of sharing some connection data in static variables, if possible.
Project memory plugin
These plugins must implement the interface
org.omegat.core.matching.external.ProjectMemory.IExternalProjectMemory (interface IExternalProjectMemory in class ProjectMemory). This interface works with internal class
ContextTMXEntry, which is
PrepareTMXEntry with added informations about the entry key.
org.omegat.core.matching.external.ProjectMemory.IConvertibleExternalProjectMemory, which extends the previous one, allows to create a translation memory for orphan entries: thanks to that, OmegaT does not require to keep in the RAM entries which are locally orphans (the corresponding key does not exist) but which are not orphans at server side.
In all cases, the only way for the user to load a project memory plugin is to use a properties file named project_save.properties (or tmx2source/someLanguage.properties). Singleton methods are not implemented.
Look at package
org.omegat.core.matching.external.rmi for an example.
These plugins must implement the already existing interface
org.omegat.core.glossary.IGlossary. What we added:
- If they implement the subinterface
org.omegat.core.glossary.IWritableGlossary, then the properties file can be set as project's main glossary: when the user will add an entry, method
addEntryis called, which can eventually send to a server;
- Properties file in the
glossarydirectory of the project are read as glossary plugin configurators, exactly as for the other features.