Skip to content

Latest commit

 

History

History
97 lines (82 loc) · 4.57 KB

Translation-Validation.asciidoc

File metadata and controls

97 lines (82 loc) · 4.57 KB

In order to prevent ill-format translation be putted to Zanata which might break on build stage or execution time, a project maintainer can suggest or even enforced the translation validation.

Related bug:

1. Test Basis

1.1. Terminology

  • Validators: Validation to be performed.

    • HTML/XML tags: HTML/XML tags should be consistent.

    • XML entity reference: XML entry in correct format.

    • Java variables: java style ('{x}') variables are consistent.

    • Positional printf (XSI extension): positional printf style (%n$x) variables are consistent. It is conflict with printf.

    • Printf variables: print style (%x) variables are consistent. It is conflict with positional printf.

    • Leading/trailing newline (\n): Number of leading and trailing newline should be the same.

    • Tab characters: Number of tab character (\t) should be the same.

  • Validation levels: The degree of the validation is enforced. Default is Warning, except positional printf, which is Off.

    1. Off: Validator is disabled.

    2. Warning: Validation is recommended and enabled by default, translator can turn it off.

    3. Error: Validation is enforced. Translator cannot save invalid messages.

  • Translator Validation Toggle: A toggle for translator to enable/disable Validator.

  • Invalid translation: A translation message that did not pass at least one enabled Validator.

1.2. Permission

  • Only project maintainer role can set the validation level for each validator.

  • Only translator role can toggle translator validation toggle.

Table 1. Decision Table of Translator Validation Toggle
Validation Level Translation Validation Toggle Default Can Translator Toggle

Off

Disabled

Yes

Warning

Enabled

Yes

Error

Enabled

No

1.3. Invalid Translation Handling

1.3.1. Invalid Translation Handling in Translation Editor

Table 2. Decision Table of Invalid Translation Handling in Translation Editor
Validation Level Translation Validation Toggle Show Invalid Message Save as Translated

Off

Disabled

No

Yes

Off

Enabled

As Warning

Yes

Warning

Disabled

No

Yes

Warning

Enabled

As Warning

Yes

Error

Enabled Only

As Error

No

1.3.2. Invalid Translation Handling with Upload and Push

During WebUI upload or client push, if an invalid translation is detected, depending on the validation level, following actions should be taken:

  • Level Off: No validation is executed, thus save as original state (Fuzzy is saved as fuzzy, Translated is saved as translated).

  • Level Warning: Warning is displayed, but still save as original state.

  • Level Error: Error is displayed, and invalid translation is skipped.

Error Message Template
[Error] Validation <ValidatorName> failed: File: <Filename>, Message:  "message"
Warning Message Template
[Warn] Validation <ValidatorName> failed: File: <Filename>, Message:  "message"

However, valid translations in the same file should be save as original state. Following decision table summarizes the behavior:

Table 3. Decision Table of Invalid Translation Handling with Upload and Push
Validation Level Message State Show Invalid Message Save as

Off

Fuzzy

No

Fuzzy

Off

Translated

No

Translated

Warning

Fuzzy

As Warning

Fuzzy

Warning

Translated

As Warning

Translated

Error

Fuzzy

As Error

Not Saved

Error

Translated

As Error

Not Saved

1.3.3. Existing Invalid Translations After Changing Validation Level to "Error" or "Warning"

Translations of the Project-Version are not automatically rescan for system performance reason. However, validators should be run during the pull and download.

Table 4. Decision Table of Invalid Translation Download and Pull
Validation Level Show Invalid Message Save to File

Off

No

Yes

Warning

As Warning

Yes

Error

As Error

No