Import / Export Translations XLIFF
XLIFF is the XML Localization Interchange File Format designed by a group of software providers, localization service providers and localization tools providers. It is intended to give any software provider a single interchange file format that can be understood by any localization provider. It is loosely based on the OpenTag version 1.2 specification and borrows from the TMX 1.2 specification. However, it is different enough from either one to be its own format. The full specification of XLIFF 2.0 can be found here:
https://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html
Perfion supports a basic import/export of XLIFF. Please read this documentation carefully to learn about the requirements and limitations of the XLIFF support in Perfion.
Perfion only supports XLIFF version 2.0
Export
Export to XLIFF 2.0 Format via ‘Output to file’
This is a step-by-step guide on how to export data from Perfion into XLIFF 2.0 format.
Step 1: Find the data to export
XLIFF export is supported through the grid in Perfion.
On any grid in Perfion you’ll find the Output button.
Click the button to export the contents of the grid to XLIFF – Note that only localizable features are exported. See the section “Limitations” to learn which feature types are supported.
Step 2: Export data into XLIFF
When the decided set of data is displayed in the grid, press the Output button and choose XLIFF 2.0.
You will then be asked to select a target language. The target language is the language you wish to have your data translated into.
Once a target language is selected click the “OK” button.
Checking the ‘Include Existing Translations’ check box will include all already existing translations of the target language.
As a last step, you are asked to save the file to disk. Once done the export is finished.
Export to XLIFF 2.0 via Perfion API
Using the ‘targetlanguage’ and ‘exportformat’ attributes
It is possible to output a Perfion Query’s result as XLIFF instead of XML. This is done by adding the targetlanguage and exportformat attributes in the select tag. When adding these attributes, the query will be executed as always, but the final result will be transformed into valid XLIFF.
The targetlanguage attribute takes one parameter which will be interpreted as the target language and the exportformat tells the query to get the result as XLIFF.
Example (good):
<Query>
<Select languages='EN' targetlanguage=’DA’ exportformat='xliff'>
<Feature id='**' view='Config' />
</Select>
<From id ='100'/>
<Where>
<Clause id='Manufacturer' operator='=' value='Volvo' />
</Where>
</Query>
In the above example, the data result will be outputted as XLIFF, because targetlanguage and exportformat is specified in the <Select> tag. The source language will be ‘EN’, as this is the first language specified in the languages attribute. The target language will be ‘DE’, because this is specified in the targetlanguage attribute.
Example (bad):
<Query>
<Select languages='EN,DE' targetlanguage=’’ exportformat='xliff'>
<Feature id='**' view='Config' />
</Select>
<From id ='100'/>
<Where>
<Clause id='Manufacturer' operator='=' value='Volvo' />
</Where>
</Query>
In the above example, no target language is specified in the targetlanguage attribute, which will result in an error when the query is executed.
Using the ‘IncludeExistingTranslations’ option
When outputting as XLIFF, the ‘IncludeExisitingTranslations’ option can be used to include already existing translations of the target language in the result. If no translation exists, the <target> tag will just be empty.
NOTE: To use this option, the targetlanguage and exportformat must be set according to the correct example shown above.
Example (good):
<Query>
<Select languages='EN' targetlanguage=’DE’ exportformat='xliff' options=’IncludeExistingTranslations’>
<Feature id='**' view='Config' />
</Select>
<From id ='100'/>
<Where>
<Clause id='Manufacturer' operator='=' value='Volvo' />
</Where>
</Query>
In this example, the already existing German translation will be included in the result because ‘IncludeExistingTranslations’ in specified in the options attribute and ‘DE’ is included in the targetlanguage attribute.
Example (bad):
In this example no ‘DE’ translations will be included, even though ‘IncludeExistingTranslations’ is specified as an option. This is because exporformat contains no value and will therefore be interpreted as XML-output.
Limitations
Import/Export: All XLIFF documents going in and out of Perfion must be XLIFF Version 2.0
Perfion’s XLIFF integration only supports XLIFF 2.0 documents. These XLIFF versions will not work:
XLIFF 1.2 and below.
Import/Export: Supported feature types
In general, Perfion support features that are localizable, with a few restrictions through. Lean more from the overview below.
Feature Characteristic | Is support in Perfion XLIFF 2.0 import/export? | Comments |
Localizable | Yes |
|
Remote | No |
|
Data Type is String | Yes |
|
Data Type is Text | Yes |
|
Data Type is Link | Yes |
|
Data Type is Number | No |
|
Data Type is File | No |
|
Data Type is Date | No |
|
Data Type is Compound | No |
|
Data Type is Image | No |
|
Data Type is Search | No |
|
Allows Formulas | Yes | The following comment/note is added to the XLIFF document to instruct the translator to handle formulas with care: “NOTE: This content may contain Perfion Formulas” |
Export: XLIFF translations only support one target language
It is currently only possible to select one target language for your XLIFF export. The target language is the language that you translate your data into.
A XLIFF document exported from Perfion has a single <file>-element that holds all exported data. The source- and targetlanguage are defined on this <xliff>-element.
Example:
Import
Import: Only one target language is imported
When importing translated XLIFF documents into Perfion it is required to have source and target languages defined inside the <xliff>-element. If the imported document contains one or more <unit> with one or more <target>-translations on language(s) other than the one defined on <xliff>, these translations will not be imported.
Example (good):
Example (bad):
NOTE: Import of XLIFF documents with more than one target language will not cause any errors. Translation not in the main target language will just be ignored.
For supported languages which can be used with ‘targetMSCodeXP’ parameter refer to Perfion Language Codes.
Import: State-attribute on <target>-element is ignored
The XLIFF standard supports a state-attribute on the <target>-element to indicate where in the translation workflow a given translation is. In Perfion this state is ignored. All valid XLIFF data will be accepted into Perfion upon import.
For example, this means that XLIFF documents containing <target>-elements with state “needs-adaption” will be imported into Perfion even though the state indicates that the translation is not complete.
Note that the related state-qualifier attribute is also ignored.
Special Requirements
Format of the unit id
The id-attribute of the <unit>-element is constructed like this:
[ROW_ID]_[FEATURE_ID]_[VALUE_INDEX]
Explanation
ROW_ID | This is the ID of the row in the “grid”/”view” that is used to export the Perfion data to XLIFF |
FEATURE_ID | The Id of the feature whose value is translated |
VALUE_INDEX | For multi-value features this indicates the local index of the value being translation in the trans-unit.
Example: the feature “COLOR” has values “Red”, “Green” and “Blue”. The three color values will have index 0, 1 and 2 respectively and will be split into three trans-unit tags. The id of these trans-units will then be “1_123_0”, “1_123_1” and “1_123_1”, assuming that “COLOR” has id 123 and ROW_ID=1.
For features with a single value, “VALUE_INDEX” will always be 0 (zero). |
Example: