Configuring OmegaT plugins using project-scope properties files

Cyclotis plugin for OmegaT is based on an improvement in the API : the possibility to declare which plugin to use and how to parametrize it at a project scope, using one or more properties file.

The reason is that the database can contain more than one collection (memory or glossary) and you will want to decide which one to include for each project individually: not only you filter by source and target language, but you may, for example, use memories by thematics (agriculture, transport, science, ...) and each project individually may enter in one or more of these categories. Simply add one file per collection you want to connect to: each one will be parsed, exactly as for a tmx or a glossary file, except that it generates a plugin instance instead of a list in RAM. In case some of these files are related to the same server, this is the responsability of the plugin, not of OmegaT, to optimize the number of physical connections to create.

How it works

The file is in properties format, the same which is used for configuration files by many Java projects.

Only one parameter is always present in all files : class, containing the name of the Java class containing the plugin. For each properties file one instance will be created using the constructor with Properties as unique parameter. Of course, the constructor will receive the just loaded properties content.

The class must be an implementation of the interface corresponding to the service: IGlossary for glossary, IExternalMemory for entries in tm/ directory, ProjectMemory.IExternalProjectMemory for project-save. If it is not the case, if the class does not exist, or if the parameter is not correctly provided, an exception will be visible in the log but it does not prevent the application from continuing to work. The class may also implement one of the searchable or writable interfaces, this will be detected by OmegaT during the load.

Then, each plugin is free to define which other parameters it needs to use: this must be described in the documentation of the plugin. Alternatively, the plugin may come with an extra tool which is able to generate the file for a specific memory: for example the web interfaces associated to Cyclotis, including the SaaS one, can generate the file for you.

Security note : the corresponding class and all the necessary dependancies must be in the plugins directories, either common OmegaT's one or the directory specific to your local configuration. A JAR file present in your project will not be read, even if you have some properties files calling for it. The reason is that this could be used by hackers to run malicious code. We consider that your plugins directory is secure, while the project directory, which could have been sent to you by another translator, is not.