Documentation Center

Definition of XML Rules

If the visual selection of localizable data elements and attributes is not sufficient to specify all the rules for the localization of an XML file, further details can be defined in expert mode.

The settings made in expert mode are an extension of the settings in visual mode. Expert mode is required if you want to localize multilingual XML files, work with data elements that have an ID, group certain data elements, or extract and process metadata.

The Expert Mode dialog contains a list of all the defined processing rules and a preview display of the selected XML file with color highlighting of the relevant data elements and attributes:

blackA localizable data element or attribute
redID of a localizable data element or attribute
violetLanguage elements
blueMetadata
grayAll other elements that are not processed by any processing rule

You can activate an entry in the list and click Edit or Delete to edit or delete the corresponding settings.

The language, group, or data elements are specified by means of a path to the appropriate node in the XML tree. The notation used in SDL Passolo to specify nodes in the XML tree is derived from the XPath standard. For further details on this notation see Specifying Elements and Attributes in the XML Tree.

New Language Element

If there is a data element in the XML file that contains the language, Passolo can automatically read this data from the XML file. The specification of a language element is optional. If no language element is specified, you will have to set the language to be extracted manually when the XML file is parsed or aligned.

Click New language element to call up the XML Language Element dialog box.

Enter the name of the XML data element in the Element Name field and the language attribute in the ID Attribute field, and choose the coding used for the data from the Language Coding list.

The element in the following example contains a language attribute as well as an attribute for grouping.



<file original="Prompts2.xml"  source-language="EN">

Both attributes can be read from the same element based on different settings.

New Group Element

Data elements in the XML file can be used to group the extracted text elements or extend their IDs. Examples for the grouping of data elements might be menus, dialogs, and string lists. If you define group elements, Passolo will make use of this grouping, which is useful for the navigation and processing of data within Passolo.

Click New group element to call up the XML Group Element dialog box.

Enter the name of the XML data element in the Element Name field, and in the ID Attribute field the name of the attribute to be used for grouping. The Group Action setting defines how Passolo will process a new group. If you choose Create new resource, Passolo will create a new resource in the source string list, the name of which is based on the content of the specified attribute. If you choose Create new prefix for IDs, Passolo will use the value of the specified attribute as a prefix for the text IDs. The prefix is separated from the ID by a dot.

New Data Element

The text to be translated is contained in further data elements within the XML file. If available, it is also possible to reference the ID of a data element and use the ID for further processing in Passolo.

Click New data element to call up the XML Data Element dialog box.

Enter the name of the XML data element in the Element Name field, and in the ID Attribute field the name of the attribute to be used to generate the ID. If the ID attribute or other metadata is contained in a parent data element, the two data element names can be separated by a slash (/). Passolo will first search for the attributes or metadata at the element's own level - if it doesn't find them there, the search continues at the next parent level.

To save the translated text in a separate new element, activate the Translation element checkbox. Enter a label for the element in the corresponding field. When the target file is generated, Passolo will save the translation, including any relevant metadata, in this element.

Metadata

Metadata refers to attributes in the specified elements (and the values assigned to these attributes) that can be used to control the processing of data in Passolo. Passolo can scan these metadata attributes. They are then displayed on the Properties tab in the translation window. In addition, it is possible to edit these user-defined properties when parsing an XML file.

Enter the Attribute Name and select the associated Action from the list. If the action you want to use is not available in the list, it can be performed by means of a macro that is automatically carried out after parsing. The following example illustrates the different possibilities:


<trans-unit id="1" translate="yes" max-len="8" comment="This is a unit of time"">

<source>sec</source>

<target xml:lang="IT">seg.</target>

</trans-unit>

For any entries in the source list that contain translate="no" the status will be set to Read only and the text contained in the comment attribute will be inserted into the comment field for the entry. The max-len attribute can be used in a macro to check the length of the translated text.

Handling Spaces

Data elements in XML files often contain extra spaces. You can use the Leading & trailing white spaces setting to specify how Passolo should handle these extra spaces. If you choose Edit, the spaces are included in the text which means they can be edited by the translator. If you choose Mask, the spaces are not included in the editable text, but reinserted into the target file. If you choose Remove, the extra spaces are deleted completely from the editable text.

Handling Embedded Elements

The data elements in XML files can contain subordinate elements. You can use the Embedded elements setting to specify how Passolo should handle these elements. If you choose Include elements, the entry remains intact and the embedded elements are inserted as tags. If you choose Split data, each new element creates a new entry. The following example would transform the element


<source>Normal text<bold>Bold text</bold>Normal text</source>

into either
Normal text <bold>Bold text </bold>Normal text

or

Normal text

Bold text

Normal text 

depending on this setting. If you select Split data and evaluate elements the partial elements are not necessarily added to the translation list, but are treated as separate data elements. These sub-elements have to be specified in the configuration if they are to be added to the translation list.

Sentence level sub-segmentation

With this option you can specify that the data elements extracted from the XML file should be segmented at sentence level according to the currently active segmentation rules. For data elements that comprise several sentences, such as longer error messages or help texts, there are then several lines in the translation list that can be translated and processed separately. For further information about the segmentation of strings please refer to The SRX Segmenter.

New Processing Instruction

Data from processing instructions in XML files can also be processed by Passolo. The content of these processing instructions is passed to the subsequent element for further processing. Thus, you can make use of comments, for example, that are stored separate from the data element.

Click New processing instruction to call up the XML Processing Instruction dialog.

Enter the processing instruction to be applied to the following element and choose the associated Action from the list box.