Export to TBX

Use this method to export segments to a TBX file (as a ZIP archive). You can export projects, jobs, resources and even multiple resources and apply a wide range of filters.

The zip archive contains the .tbx file as well as the .xcs schema file:

URL

(POST) /api/resources/segments/io/tbx3
(POST) /api/resources/segments/io/tbx

Choice of tbx and tbx3:


PARAMETERS

The message body contains a JSON object.


Generic export properties:


scope

The scope object tells the system what data to export. Examples:

Export a project memory, translation memory or term base by specifying its resource ID:

{ "type": "DocumentSet", "dsid": 157 }

Export a project memory by specifying its project ID:

{ "type": "Project", "projectid": 7726 }

See all available scopes here.


Mandatory

object

locales

The list of all locales that you want to export.

"locales": [ "de-DE", "de-AT", "fr-FR" ]
Mandatory, string[]
query

An optional filter to apply to the exported data. Sample use cases are:

  • Exclude any translations in red status
  • Export translations with certain custom fields only
  • etc.

The query properties and features are described here. Example of exporting texts in neutral (0) or green (1) status thus excluding red status (2):

"query": {
    "languages": [
       { "loc": ["en", "de", "fr"], "status": { 0, 1 } }
    ]
}

IMPORTANT:

The query has 2 functions: On the one hand it filters the segments and on the other hand it removes any translations that do not match the filter.

In the example above, the query first identifies segments where at least one of the 3 languages is not in red status. In a second step, the system removes any languages that are in red status.


Optional,

object

src

The source locale. It is highly recommended to set this value if you know it. Otherwise, the system chooses the first entry in locales.

Optional, string

minimumTexts

Optional number of languages a segment must have at a minimum to be exported. By default this is 1.

  • 1: Includes monolingual (untranslated) segments
  • 2: The segment must have at least 2 language versions
  • ...


Optional, int
skipTargetIsSource

Optional, default is false. If true then translations are removed from the export if the text is identical to the source text.


Optional, bool
excludeCommentTypes

Optional. List of numeric comments categories. If set then only comments of these categories are included in the export.

Categories are sequentially numbered and start at 0.

Optional, int[]

markupRemoveOptional, default is false. If true then markup is removed from texts. See also property below.Optional, bool
markupReplaceChar

Optional, default is null. When you set markupRemove to true then any markup will be replaced by this character.

Note: You must specify a single character such as: "markupReplaceChar": " "

Optional, char
localesMappings

Optional dictionary to transform or modify language codes prior to saving to file. The following example, transforms fully qualified locales from the resource into simpler ones:

"localesMappings": {
    "de-DE": "de",
    "fr-FR": "fr"
}


Locales not in the dictionary are left unchanged. If you map multiple original locales to the same output locale, the system will retain only one of the "clashing" languages.


Optional, object

TBX specific options


extractWordbeeProperties

Optional, default is false.

If true then the system includes Wordbee specific properties in the TMX file. These properties are saved as <descripGrp> nodes:

<descripGrp>
    <descrip type="Status">1</descrip>
</descripGrp>


Term entry level:

  • x-wb-context
  • x-wb-cfs{custom field id} : For example "x-wb-cfs10"

Text level properties in "tuv" node:

  • x-wb-status
  • x-wb-bookmark
  • x-wb-locked
  • x-wb-editor
  • x-wb-cft{custom field id} : For example "x-wb-cft10"


Optional, bool
extractComments

Optional, default is false. Set to true if you want to include comments attached to the texts.

These are saved as notes inside <tig>:

<tig>
	<termid="6386438-en-GB">kkkk</term>
	<auxInfo>
		<note id="529">This is a comment [23/11/2018 08:30:17,187,0]</note>
	</auxInfo>


The note includes the date, the user identifier and the numeric category of the comment.

Optional, bool


TBX version 3 specific options


extractCreationData

Optional, default is 0.

Available options:

  • 0: Don't export transacGrp creation data
  • 1: Export using Wordbee data
  • 2: Export using TBX fields fetched on import

If not "0" then the system includes "creation" data from "Wordbee fields" if set to "1", or from "Originally imported data" if set to "2". These properties are saved as <transacGrp> nodes:

<transacGrp>
  <transac type="transactionType">creation</transac>
  <transacNote type="responsibility" target="511">Rageh Aly</transacNote>
  <date>2021-03-08</date>
</transacGrp>
Optional, int
extractModificationData

Optional, default is 0.

Available options:

  • 0: Don't export transacGrp modification data
  • 1: Export using Wordbee data
  • 2: Export using TBX fields fetched on import

If not "0" then the system includes "creation" data from "Wordbee fields" if set to "1", or from "Originally imported data" if set to "2". These properties are saved as <transacGrp> nodes:

<transacGrp>
  <transac type="transactionType">modification</transac>
  <transacNote type="responsibility" target="511">Rageh Aly</transacNote>
  <date>2021-03-08</date>
</transacGrp>
Optional, int

RESULTS

This API method is an "asynchronous" operation. It either immediately returns the result or instead an operation ID which you need to periodically poll until the operation has finished.

Upon the first call you typically get an "operationid". Use this to further poll the operation status. See full explanation here: Asynchronous operation

When the operation is finished you get the reference to the file:

{
    "trm": {
        "status": "Finished"
		...
    },
    "custom": {
        "fileref": "52e77705f6904233b0c33b2e5d7c4a80",
        "filename": "export.zip",
        "segments": 10
    }
}


Once the operation is finished, download the file with fileref and this API method:

(GET) /api/media/get/{fileref}


EXAMPLES - TBX version 1

Submit request to export term base 112334:

(POST) /api/resources/segments/io/tbx


BODY:
{
	"scope": { "type": "DocumentSet", "dsid": 112334 },
	"locales": [ "en", "fr" ]
}


The resulting TBX file:

<?xml version="1.0" encoding="utf-8"?>
<martif type="TBX" xml:lang="en-GB">
  <martifHeader>
    <fileDesc>
      <titleStmt>
        <title>My term base</title>
      </titleStmt>
      <sourceDesc>
        <title>Project memory</title>
      </sourceDesc>
    </fileDesc>
  </martifHeader>
  <text>
    <body>
      <termEntry id="6386440">
        <descripGrp>
          <descrip type="Context">p</descrip>
        </descripGrp>
        <langSet xml:lang="en-GB">
          <tig>
            <term id="6386440-en-GB">Hello world</term>
            <descripGrp>
              <descrip type="Status">0</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Bookmark">0</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Locked">No</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Editor">0</descrip>
            </descripGrp>
          </tig>
        </langSet>
        <langSet xml:lang="de-DE">
          <tig>
            <term id="6386440-de-DE">Hallo Welt</term>
            <descripGrp>
              <descrip type="Status">1</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Bookmark">0</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Locked">No</descrip>
            </descripGrp>
            <descripGrp>
              <descrip type="Editor">1</descrip>
            </descripGrp>
          </tig>
        </langSet>
      </termEntry>
...


The resulting schema file:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TBXXCS SYSTEM "tbxxcsdtd.dtd">
<TBXXCS name="master" version="0.4" lang="en" xml:lang="en">
  <header>
    <title>TBX XCS file</title>
  </header>
  <languages>
    <langInfo>
      <langCode>en-GB</langCode>
      <langName>English (United Kingdom) (en-GB)</langName>
    </langInfo>
    <langInfo>
      <langCode>de-DE</langCode>
      <langName>German (Germany) (de-DE)</langName>
    </langInfo>
  </languages>
  <datCatSet>
    <descripSpec name="Context" datcatId="x-wb-context">
      <contents datatype="plainText" />
      <levels>plainText</levels>
    </descripSpec>
    <descripSpec name="Status" datcatId="x-wb-cfs-5">
      <contents datatype="plainText" />
      <levels>plainText</levels>
    </descripSpec>
    <descripSpec name="Category" datcatId="x-wb-cfs-11">
      <contents datatype="plainText" />
      <levels>plainText</levels>
    </descripSpec>
    <descripSpec name="NSR unit" datcatId="x-wb-cfs-12">
      <contents datatype="plainText" />
      <levels>plainText</levels>
    </descripSpec>
...


Additional information

TBX specifications: https://www.gala-global.org/sites/default/files/uploads/pdfs/tbx_oscar_0.pdf







Copyright Wordbee - Buzzin' Outside the Box since 2008