- General Information
- Connecting Third-party Systems
- crossConnect for content systems
- crossConnect for External Editing
- Purpose and usage
- Requirements
- Implementation
- Across XLIFF format
- Across-specific Extensions
- <xliff> Element Attributes
- <file> Element Extensions
- <trans-unit> Element Extension
- Paragraph States
- Paragraph State Flags
- <source> and <target> Element Content
- <bpt> Element Attributes
- <ph> Element Attributes
- <x> Element Attributes
- Across-specific Properties
- Analysis Results
- Sample Files
- Across XLIFF - import, export and segmentation
- Context information
- Exporting best matches in Across XLIFF
- Hyperlinks to XLIFF
- Secure file handling with C#
- Secure file handling with JAVA
- Workflow and vendor configuration
- Sample code - Integrated solution
- Across XLIFF format
- Generic File Connector
- Display Texts
- APIs
- APIs - Technology
- crossTank API v1
- crossTank API v2
- crossTerm API v1
- crossTerm API v2
- crossAPI SI
- Requirements
- Function Return Types
- crossAPI SI and Java
- List of Objects in crossAPI SI
- Sample - transferring checkout files via FileManager
- Sample - VBS
- Text Preprocessing API
Formatting and Auto-Adjustment of Formatting and Numbers
crossTank API v2 supports passing formatting, tags/placeables, and numbers when creating or searching for translations. Auto-adjustment of formatting and tags and auto-changing of numbers can be enabled for searching translations.
In this topic, the usage of formatting, tags, and numbers is explained using basic examples.
Format Ranges
crossTank supports formatting of text by applying ranges of formatting (e.g. bold font, font size 18, etc.) over the text. Text which isn't covered by explicit format ranges is displayed in the base font style. Styles of format ranges are combined with the base font style of a sentence when a format range is displayed. In order to make the auto-adjustment algorithm work correctly on created translations, identical styles must have unique IDs in the scope of the sentence which are identical between source and target sentences. That way, the auto-adjustment algorithm can match source and target formatting ranges. The beginning of a format range includes the character, the end of a format range doesn't include the character, e.g., the format range begin:0, end:2 covers the first three characters of a segment.
Example
Source sentence | Target sentence |
This is the firstsentence. | Dies ist der ersteSatz. |
Format ranges example
"Source": { "Text": "This is the first sentence.", "Language": 9, "FormatRanges": [ { "Begin": 0, "End": 4, "FontStyle": { "StyleId": 0, "Bold": true } }, { "Begin": 12, "End": 17, "FontStyle": { "StyleId": 1, "Bold": true, "Italic": true } }, { "Begin": 18, "End": 27, "FontStyle": { "StyleId": 2, "Bold": true } } ], "BaseFontStyle": { "StyleId": 2, "FontSize": 12 } }, "Target": { "Text": "Dies ist der erste Satz.", "Language": 7, "FormatRanges": [ { "Begin": 0, "End": 4, "FontStyle": { "StyleId": 0, "Bold": true } }, { "Begin": 13, "End": 18, "FontStyle": { "StyleId": 1, "Bold": true, "Italic": true } }, { "Begin": 19, "End": 23, "FontStyle": { "StyleId": 2, "Bold": true } } ], "BaseFontStyle": { "StyleId": 2, "FontSize": 12 } }
Elements
crossTank supports elements inside text, which may be used to represent tags in markup formats or locked content. In order to make the auto-adjustment algorithm work correctly on created translations, elements must have IDs which are unique IDs in the scope of the sentence and identical between source and target sentences. That way the auto-adjustment algorithm can match source and target elements. Elements are not considered characters and therefore take no space in the text. If several elements have identical positions, they are displayed in the same order as they are specified. Moreoever, they are always displayed to the left side of the character at the same position. Elements which are placed at the end of a text have an index outside the text range. Please note that source or target segments cannot contain only placeables, but must also contain at least one character.
Example:
Elements example
"Source": { "Text": "This is the first sentence.", "Language": 9, "Elements": [ { "ElementId": 0, "Position": 0, "Text": "<ELM1>", }, { "ElementId": 1, "Position": 0, "Text": "<ELM2>", }, { "ElementId": 2, "Position": 22, "Text": "<ELM3>", } ] }, "Target": { "Text": "Dies ist der erste Satz.", "Language": 7, "Elements": [ { "ElementId": 1, "Position": 0, "Text": "<ELM2>", }, { "ElementId": 0, "Position": 0, "Text": "<ELM1>", }, { "ElementId": 2, "Position": 27, "Text": "<ELM3>", } ] }
If you want to store a translation with unlinked elements or styles, it is recommended that you set IsForceCheckLLSStyleAndPositions = true (allow storing of formatting as is); otherwise, it is recommended that you set this flag to false.
Numbers
crossTank processes numbers during storing and searching using the auto-change algorithm. This adds some limitations for storing and search options to preserve the correct behavior.
When translating sentences with numbers, there are several cases:
Case # | Source sentence (EN) | Target sentence (DE) | Number value | Number type | Number count | Number order | Result |
1 | Number 10 | Nummer 10 | |||||
2 | Number 1 | Nummer 2 | Adjustment of numbers impossible | ||||
3 | Number 10 | Nummer 10.0 | Adjustment of numbers impossible | ||||
4 | Numbers 1 2 | Nummer 1 2 3 | Adjustment of numbers impossible | ||||
5 | Numbers 1 2 | Nummer 2 1 | Adjustment of numbers impossible |
- When you store translation like in case 1, it is recommended that you set the following combination of flags:
- FieldProcessingMode = CheckTypeOnly (avoids creating translation duplicates "Test 1" → "Test 1", "Test 2" → "Test 2" etc.)
- IsUncontrolled = false (allow adjustment of numbers for this translation. "Test 1" → "Test 1" can be adjusted to "Test 2" → "Test 2" according to search pattern)
- For all other cases where the numbers do not match, it is recommended that you set the following combination of flags:
- FieldProcessingMode = CheckTypeAndValue (allows saving the translation as is)
- IsUncontrolled = true (allows searching for the translation as is without applying adjustment of numbers)
Auto-Adjustment
By default, the similar search performs auto-adjustment of numbers and formatting to return results maximally similar to the search pattern. The adjustments add a penalty to the similarity score of the respective search result.
Examples:
Source pattern | Original source | Original target | Adjusted source | Adjusted target |
Number 123,456 | Number 1 | Nummer 1 | Number 123,456 | Nummer 123.456 |
This is a test sentence | This is a test sentence | Das ist ein Testsatz | This is a test sentence | Das ist ein Testsatz |
This is a test sentence | Das ist ein Testsatz | |||