...
Category | Import Converter |
---|---|
Purpose | Enables Translate5 to import other file formats as just bilingual files. |
Bootstrap Class | editor_Plugins_Okapi_Init |
Type | Core 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.
...
Additional installation instructions
Original DocumentationDownload and install Okapi Longhorn as shown here: http://okapiframework.org/wiki/index.php?title=Longhorn#Download_and_Installation.
Download okapi from https://bintray.com/okapi/Distribution/Longhorn
Install a tomcat server and get up Okapi there.
...
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
Code Block | ||
---|---|---|
| ||
/var/lib/tomcat9/work |
Yet, by default Okapi M37 with Tomcat9 tries to write to
Code Block | ||
---|---|---|
| ||
/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.
Code Block | ||||
---|---|---|---|---|
| ||||
<?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):
Code Block | ||
---|---|---|
| ||
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):
Code Block | ||
---|---|---|
| ||
mkdir /var/lib/tomcat8/Okapi-Longhorn-Files
chown tomcat:tomcat /var/lib/tomcat8/Okapi-Longhorn-Files
chmod 700 /var/lib/tomcat9/work/Okapi-Longhorn-Filessystemctl restart tomcat8 |
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 more details see https://groups.yahoo.com/neo/groups/okapitools/conversations/topics/4593?reverse=1
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# as root:
wget https://bintray.com/okapi/Distribution/download_file?file_path=okapi-longhorn_all-platforms_0.35.zip -O okapi-longhorn_all-platforms_0.35.zip
unzip okapi-longhorn_all-platforms_0.35.zip
sudo apt-get update
sudo apt-get install tomcat8
sudo cp okapi-longhorn.war /var/lib/tomcat8/webapps/
sudo systemctl enable tomcat8.service
sudo service tomcat8 start |
The data directory for Okapi must be created manually (see readme.html from the downloaded zip).
Try to create a Okapi project via the integrated web front-end accessible via the configured Okapi URL (see readme.html, too: {localhost}/okapi-longhorn/okapi-longhorn-sample-js-client.html; see also: http://okapiframework.org/wiki/index.php?title=Longhorn#HTML-Client).
Check the tomcat 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 Ensure that the directory mentioned there exists and is writeable writable for tomcat.
If you get the following errors in the tomcat log file: "net.sf.okapi.common.exceptions.OkapiException: SRX file not found" the reason could be missing rights on the above folder.
chown or chmod 777 the Okapi-Longhorn-Files folder and test the import again.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cd /var/log/tomcat8/
grep "default working directory" catalina.*
catalina.out:INFO: The default working directory for Okapi Longhorn will be used, because no other was specified: /usr/share/tomcat8/Okapi-Longhorn-Files
cd /usr/share/tomcat8/
ls -al
mkdir Okapi-Longhorn-Files
chown tomcat8:tomcat8 Okapi-Longhorn-Files/ |
For Tikal:
...
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-b01Oracle 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 name | Values | Default | Description |
---|---|---|---|
runtimeOptions.plugins.Okapi.api.url | string | Url used for Okapi api. In default Okapi setup this should be http://localhost:8080/okapi-longhorn/ | |
runtimeOptions.plugins.Okapi.tikal.executable | string | This usually is left empty, because in the default setup of translate5 you do not use Okapi Tikal, but Okapi Longhorn for conversion. | |
runtimeOptions.worker.editor_Plugins_Okapi_Worker.maxParallelWorkers | integer | 3 | Max 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.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
-- 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_SegmentStatistics_Bootstrap","editor_Plugins_TermTagger_Bootstrap","editor_Plugins_MatchResource_Init","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'; |
...