7.5.2 Example scenario
Performing a 'translation management' export or import is very similar to the normal export and import. Let's look at an example scenario. Suppose we have a number of documents in language 'en' which we want to translate to language 'fr'.
7.5.2.1 Getting started
Often your Daisy installation will be situated on some server, but you will be calling the tools from your desktop. If you find yourself in this situation, just do the following:
- download a Daisy distribution (not the Windows installer). Use the same version as installed on the server.
- extract the download
- do not perform the Daisy installation procedure
- make sure you have the Sun Java runtime (version 1.5 or higher) installed, have JAVA_HOME point to it.
- set DAISY_HOME to point to the directory created when extracting the download
- and for convenience, add Daisy's bin directory to the PATH so that the tools can be called easily
The last two steps are done as follows:
[For Windows]
set DAISY_HOME=c:\daisy-{version}
set PATH=%PATH%;%DAISY_HOME%\bin
[For Linux]
set DAISY_HOME=/home/me/daisy-{version}
export PATH=$PATH:$DAISY_HOME/bin
7.5.2.2 Exporting the content to be translated
To create an export, first decide on the documents to export.
Let's suppose the reference variant is 'en' and we want to export the documents for which the 'fr' translation is not in sync or is missing. The query below is the canonical example of how to select those documents.
Create a file called exportset.xml and put the snippet below in it. Of course, you can use any query you like, as long as the resultset only contains documents belonging to the same language variant.
<documents>
<query>
select
id
where
branch = 'main'
and language = 'en'
and referenceLanguage = 'en'
and ( ReverseLangNotInSync('fr', 'last') or variants has none('main:fr') )
and documentType = 'SimpleDocument'
and InCollection('my collection')
option
search_last_version = 'true'
</query>
</documents>
Invoke the export tool like this:
daisy-export -t tm
-f exportset.xml
-l http://localhost:9263
-u testuser
-e exportdata.zip
The -t switch is for selecting the tm export format (tm stands for translation management).
The -l switch indicates the location of the server, change “localhost” by the appropriate host name. If it is localhost, you can drop the -l option altogether.
The -u option specifies the Daisy user to connect to the repository (you will be prompted for the password).
The -e option tells to do an export to the given location. If this location ends with “.zip”, a zip file will be created, otherwise a directory will be created.
To see all available options, execute:
daisy-export -h
7.5.2.3 The translation
Normally you will now send this exportdata.zip file to your translation agency, which will update the files and send you back the .zip file. The structure of the file should still be the same, but the content will have been replaced by the translated content.
7.5.2.4 Importing the translated content
Invoke the import tool like this:
daisy-import -t tm
-u testuser
-i exportdata.zip
--target-language fr
--htmlcleaner-config c:\daisy\daisywiki\webapp\daisy\resources\conf\htmlcleaner.xml
The target language fr should be an existing language variant. You can define these via the Administration console of the Daisy Wiki.
Specifying the HTML cleaner configuration file will make sure the HTML content gets formatted in the same way as when editing through the Daisy Wiki. This is optional, but highly recommended.
Previous