(For information on how length restrictions are configured, please scroll down)
Pixel-count based and character-count based length restrictions per segment and max line counts per segment currently can be defined for any file format, that translate5 can import.
Yet if used in such a generalistic way, the defined length for each segment of one task has to be the same and has to be defined in the task template (see below).
If you need different counts per segment within the same task, you need to define them directly in the xliff file before importing it into translate5 (see below).
Pixel-count based length restrictions for a segment or a line within a segment are useful for the translation of display texts, where a certain display text must not exceed a certain number of pixel. For example the letter "i" might only need 3px width, while the letter "M" might need 12px width. translate5 can count the used pixel, if it is fed with enough information (see below).
In some cases instead of counting pixel-length it is important to count the number of used characters in a segment or a line. translate5 supports this also.
With translate5 you can set a min-width and/or a max-width for a segment.
A display text can have multiple lines. translate5 supports to check, that a max number of lines is not exceeded and a max number of pixel or characters per line is not exceeded. Minimum count of characters or pixel is only supported so far, if no max line count is defined.
For length restrictions to be used in any case a task-template (task-template.xml) has to be provided for a task and length restrictions have to be activated there for the task (details see below).
For pixel-based length restrictions to work some default settings also have to be provided in the Zf_configuration database table (system configuration; see below). Also the pixel-width definitions have to be provided as an Excel file (pixel-mapping.xml ) that is fed alongside the task-template to the import zip for the task.
All length restrictions can also be provided directly in xliff 1.2 format on trans-unit level. If they are present, they overwrite definitions made in the task template (different font-sizes and fonts for pixel-based length check for different segments of the same task can currently only be used with custom file filters written by translate5s developers. It would also be possible to implement the definition of differently used fonts and font-sizes on segment-level within an xliff file. Currently only one font-size and one font per task is possible without custom import file filters).
To use other custom formats that already contain all length restriction definitions on segment level please ask the translate5 development team to develop a custom import file filter.
You can define for the length check the following parameters in the task-template and may overwrite them in xliff 1.2
For length restrictions to be activated, in any case a task template has to be used. The <lengthRestriction></lengthRestriction> tag has to be present in the task template and the task template has to be provided to the imported zip package.
Please see Task Templates for how to use that and ZIP import package format for how to include the task-template.xml into the import zip package.
For this check to work somewhere the pixel length of each character of a used font in the used font-size has to be defined.
For this definitions in translate5s system configuration and in the pixel-mapping.xlsx file have to be made (see below).
For every font-size that might be used, default pixel width have to be defined in the Zf_configuration table in case of characters that are missing in the pixel-mapping.xlsx file.
Config name | Type | Default | Description |
runtimeOptions.lengthRestriction.pixelMapping | map | {"8":"7", "9":"8", "10":"9", "11":"10", "12":"11", "13":"12", "14":"13", "15":"14", "16":"15", "17":"16", "18":"17", "19":"18", "20":"19"} | Default pixel-widths for font-sizes. First the font-size and after the colon the default pixel-width is listed. Example: {"12":"3", "13":"4", "14":"5"} |
The pixel-mapping.xlsx file has to be provided within the ZIP import package (please go here for more information on the zip package format).
Please find an example for pixel-mapping.xlsx below.
Example:
<trans-unit id="4" translate5:maxNumberOfLines="2" minwidth="100" maxwidth="300" size-unit="pixel">
<source>Example for maximal 2 lines, minwidth 100, maxWidth 300.</source>
<target></target>
</trans-unit>
Please note:
translate5:maxNumberOfLines
, not the maxheight
-Element! (http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#maxheight).maxheight
would refer to the pixel-height of the trans-unit, not to the number of lines.