Page tree
Skip to end of metadata
Go to start of metadata

CategoryImport Converter

Purpose

Enables Translate5 to import other file formats as just bilingual files.

Bootstrap Class

editor_Plugins_Okapi_Init
TypeCore plug-in (delivered with translate5 core)


Description

The Okapi plugin enables you to use Okapi Longhorn REST server for converting native source file formats like MS Office 2007, Indesign, HTML, XML, etc. to Xliff and thus directly import these native file formats in translate5.

The end user of translate5 has no contact with Okapi - everything is handled by translate5 on import and re-export after translation.

Here you find the list of all file formats supported by Okapi and thus supported by translate5 through the translate5 Okapi plugin.

Additional installation instructions

Download and install Okapi Longhorn as shown here: http://okapiframework.org/wiki/index.php?title=Longhorn#Download_and_Installation.

Important hints for Okapi with Tomcat9

Tomcat9 only has rights to write inside of its working directory, which under Ubuntu 18.04 and TomCat9 is

/var/lib/tomcat9/work

Yet, by default Okapi M37 with Tomcat9 tries to write to

/Okapi-Longhorn-files

So even if you create a directory at this place with user "tomcat" and rights 777, Okapi will not be able to write files there.

To solve this: Create a config file with the name "okapi-longhorn-configuration.xml" in the tomcat user directory.

Strangely under Ubuntu 18.04 and Tomcat9 the tomcat user directory is the Linux root directory, meaning "/". To find out if this is the case in your Linux distro, you can look up the user directory for the user "tomcat" or "tomcat9" in /etc/passwd.

So for Ubuntu 18.04 and Tomcat9 create a file "okapi-longhorn-configuration.xml" at /okapi-longhorn-configuration.xml with the following contents.

okapi-longhorn-configuration.xml
<?xml version="1.0" encoding="utf-8"?>
<okapi-longhorn-configuration version="1">
    <working-directory>/var/lib/tomcat9/work/Okapi-Longhorn-Files</working-directory>
</okapi-longhorn-configuration>

Change the path to "working-directory", if the working directory of your Tomcat9 is located somewhere else.

Create a directory "Okapi-Longhorn-Files" at the path, where your config file points to.

Set the rights and user of the new directory (change the path, if your directory is somewhere else) and restart tomcat (change the call to restart tomcat, if this is different in your distro):

chown tomcat:tomcat /var/lib/tomcat9/work/Okapi-Longhorn-Fileschmod 700 /var/lib/tomcat9/work/Okapi-Longhorn-Filessystemctl restart tomcat9

Important hints for Okapi with Tomcat8

Similar as for Tomcat9, also for Tomcat8 the working directory for Okapi needs to be set up manually.

To do this for Ubuntu 18.04, Okapi M37 and Java 1.8 do the following (for other Linux distros or Okapi versions the working directory might differ):

mkdir /var/lib/tomcat8/Okapi-Longhorn-Files
chown tomcat8 /var/lib/tomcat8/Okapi-Longhorn-Files
chmod 700 /var/lib/tomcat8/work/Okapi-Longhorn-Files
systemctl restart tomcat8

You can find out, if "tomcat8" is really your tomcat user, if you execute the following command, when tomcat is running:

ps auxwww | grep -v grep | grep tomcat

Trouble shooting, if your Okapi installation is not working

Problems with Okapi working direcory

If you run into problems, please check the tomcat logs for messages like:

INFO: The default working directory for Okapi Longhorn will be used, because no other was specified: /usr/share/tomcat7/Okapi-Longhorn-Files

Ensure that the directory mentioned there exists and is writable for tomcat.

Try to put an Okapi config into the user directory of your tomcat user analogous to what is shown for Okapi installation with Tomcat 9 above.

If this does not help:

Previously we did run into a bug or problem with Okapi, that lead to a dysfunctional Okapi with Tomcat 8 and Okapi M35. So if you run into further problems, either try to set up a newer Okapi version or if you already have the latest Okapi version try to set it up with Tomcat 7 (with JVM 1.7.0_151-b01 Oracle Corporation ) or Tomcat 9 (as shown above). The current code block shows the installation of tomcat8. However it seems, that due to a bug in Okapi Longhorn the conversion routines needed by translate5 do not work correctly with Okapi Longhorn running under TomCat 8. Yet with TomCat 7 and the correct Java Version, everything seems to work fine. For more details see https://groups.yahoo.com/neo/groups/okapitools/conversations/topics/4593?reverse=1

Translate5 Configuration of the Okapi Plug-In

Config nameValuesDefaultDescription
runtimeOptions.plugins.Okapi.api.urlstring
Url used for Okapi api. In default Okapi setup this should be
http://localhost:8080/okapi-longhorn/
runtimeOptions.plugins.Okapi.tikal.executablestring

This usually is left empty, because in the default setup of translate5 you do not use Okapi Tikal, but Okapi Longhorn for conversion.

The absolute path to the tikal executable, no usable default can be given so is empty and must be configured by the user!

runtimeOptions.worker.editor_Plugins_Okapi_Worker.maxParallelWorkers

integer3Max parallel running workers of the Okapi worker

The above configurations must be set in the Zf_configuration table of your translate5 instance.

In addition the Okapi plug-in must be enabled in your translate5 instance.

To do both, execute the following code block. Be careful to change the contents to which "value" will be set in the sql-statements to your needs, if the plug-ins you want to activate or the URL for Okapi is different on your installation. Best look for the existing value of your plug-in configuration and simply add the Okapi Bootstrap-Class "editor_Plugins_Okapi_Init".

Example SQL of the translate5 Okapi configuration
-- activate plug-in (be careful and watch, if the active plug-ins in the SQL match your needs)
UPDATE `Zf_configuration` SET `value` = ["editor_Plugins_NoMissingTargetTerminology_Bootstrap","editor_Plugins_Transit_Bootstrap","editor_Plugins_TermTagger_Bootstrap","editor_Plugins_ChangeLog_Init","editor_Plugins_Okapi_Init"] WHERE `name` = 'runtimeOptions.plugins.active';

-- configure Okapi URL
UPDATE `Zf_configuration` SET `value` = "http://localhost:8080/okapi-longhorn/" WHERE `name` = 'runtimeOptions.plugins.Okapi.api.url';