Menu

Scripting Languages Log in to Edit

Aaron Madlon-Kay

As of version 3.0.3, OmegaT supports scripting in the Groovy and JavaScript languages "out of the box". However OmegaT hypothetically supports any language compatible with the Java Scripting API a.k.a. JSR 223.

OmegaT only specifically bundles Groovy. JavaScript is supported by virtue of being included in Java itself (for now; it is deprecated as of Java 11).

Other languages can be used if they are compatible with JSR 223 and you can get them on your classpath. For instance you can use Python via Jython if you launch OmegaT like this (assumes the current working directory is the root of the OmegaT installation):

java -cp 'OmegaT.jar:lib/*:/path/to/jython.jar' org.omegat.Main

For instance if you have installed the jython and OmegaT packages via MacPorts, and you are using the default prefix of /opt/local then this will work from anywhere:

java -cp '/opt/local/share/java/OmegaT/OmegaT.jar:/opt/local/share/java/OmegaT/lib/*:/opt/local/share/java/jython/jython.jar' org.omegat.Main

If the language was correctly recognized by Java, it should appear in the log like so:

96445: Info: Available script engines: 
96445: Info:  - jython python v.2.7 (extensions: py) 
96445: Info:  - Groovy Scripting Engine Groovy v.2.5.6 (extensions: groovy) 
96445: Info:  - Oracle Nashorn ECMAScript v.ECMA - 262 Edition 5.1 (extensions: js) 

Other languages with JSR 223-compatible implementations can be seen here:
https://github.com/scijava/javax-scripting/tree/master/engines


Related

Wiki: Home