Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Usage and configuration

Usage overview

In short words

  1. Optionally do definitions in xliff 1.2
  2. Define
    1. task-template.xml
    2. pixel-mapping.xlsx (only if pixel-length check)
  3. Use ZIP import package and include task-template.xml and optionally pixel-mapping.xlsx

More in detail

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).

...

You can define for the length check the following parameters in the task-template and may overwrite them in xliff 1.2

  • size-unit
    • If the length check
    If it
    • should be character-length based or pixel-length based
    • Possible values:
      • pixel
      • char
  • minLength
    • Minimum length in number of pixel / characters
    • Refers to the length of a complete trans-unit of an xliff file, even if it spans multiple segments.
    • This means for min-length set in a task template for let's say a word document, that the length restriction refers to a whole paragraph.
    • If maxNumberOfLines is set, minLength is not supported so far (ask translate5's development team, if you need it)
  • maxLength
    • Maximum length in number of pixel / characters
    • Refers to the length of a complete
    If the min-length, the max-length or both should be checked
    • The length restrictions always refer to the whole trans-unit of an xliff file, even if it spans multiple segments.
    • This means for length restrictions maxLength set in a task template for let's say a word document, that the length restriction for the word refers to a whole paragraph, for example.
    How long min- and max-length are
    • .
    • If maxNumberOfLines is set, maxLength refers to the length of each line, otherwise maxLength refers to the trans-unit
  • translate5:maxNumberOfLines
    • How many lines a segment (not a trans-unit) should maximally have
    • If maxNumberOfLines is set,
      • maxLength refers to the length of each line, otherwise maxLength refers to the trans-unit
      • minLength is not supported so far (ask translate5's development team, if you need it)
  • For pixel-based length check:
    • The pixel-width of For each character for a certain font and a certain font-size the assumed pixel-width
      • Definitions in pixel-mapping.xlsx
    • What font-size and what font should be assumed for the current task

...

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 nameTypeDefaultDescription

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"}

pixel-mapping.xlsx: Pixel-length definitions by character

...

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.

Explanation of

...

columns in pixel-mapping.xlsx

  • font: Contains the font-name as used in the task-template
  • fontSize: Contains the font-size as used in the task-template
  • unicodeChar: Contains the value unicode code point value for the character, for which you want to define a pixel width. An easy way to find the code point is to use the site https://onlineutf8tools.com/convert-utf8-to-code-points and to enter the char you want to know the code point of in the left field.
  • pixelWidth: The pixel width you want to define for the listed character, with the listed font in the listed font-size
  • Character: This is just a reference column to be easily able to know, what the current row defines. It is not used during the length check.

Example pixel-mapping.xlsx file
View file
namepixel-mapping.xlsx
height250

...

Definitions in xliff 1.2

(overwrite corresponding definitons in task template)

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>

...

...