Quality Check tool
The Quality Check tool compares each block's source with its translation
in the language --target-lang names, and reports what it finds. --mode
selects how:
rules, the default, runs deterministic checks locally. They cover empty and identical targets, whitespace, doubled words, inline codes, span constraints, characters, length, and, when enabled, consistency across the run.aisends each translated block's source and translation to the provider--providernames, which reviews the dimensions in--checks. A hosted provider needs a credential.--providerand--modelapply only in this mode.
The tool reads a file that holds both languages, such as XLIFF, or a source
file with its translation passed as --target <file>. Findings print on
standard output as a table, or as a JSON report with --json. The run writes
no file unless -o or --output-dir names one. Each finding is marked as
failing or reported, and the run exits 0 whatever it finds. It exits 4 when it
compared no translation and reported nothing.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
absoluteMaxCharLength | integer | 255 | Maximum number of characters allowed in any target segment |
apiKey | string | API key for the AI provider | |
charset | string | ISO-8859-1 | Name of the character set encoding to check against (e.g. ISO-8859-1) |
checkAbsoluteMaxCharLength | boolean | false | Flag target segments that exceed an absolute character count limit |
checkCharset | boolean | false | Warn if a target character is not included in the specified character set encoding |
checkCodeDifference | boolean | true | Verify that target segments have the same inline codes as source segments |
checkCorruptedCharacters | boolean | true | Check for patterns indicating encoding corruption (mojibake |
checkDoubledWord | boolean | true | Check for consecutive repeated words in target text |
checkDoubleSpaces | boolean | true | Check for double spaces in target text |
checkEmptySource | boolean | true | Check for non-empty target when source is empty |
checkEmptyTarget | boolean | true | Check for empty target when source has content |
checkLeadingWhitespace | boolean | true | Check for leading whitespace mismatches between source and target |
checkMaxCharLength | boolean | true | Flag targets longer than a percentage of source character length |
checkMaxWords | boolean | false | Flag target segments that exceed an absolute limit on the number of words |
checkMinCharLength | boolean | true | Flag targets shorter than a percentage of source character length |
checkPatterns | boolean | true | Verify that source patterns have expected corresponding content in the target |
checks | string[] | Quality checks to perform (e.g. terminology fluency accuracy consistency) | |
checkSourceInconsistency | boolean | false | Flag when different source texts share the same translation |
checkSpanConstraints | boolean | true | Check non-deletable and non-cloneable span constraint violations |
checkTargetInconsistency | boolean | false | Flag when the same source text is translated differently across the run |
checkTargetSameAsSource | boolean | true | Check when target text is identical to source text |
checkTrailingWhitespace | boolean | true | Check for trailing whitespace mismatches between source and target |
consistencyCaseSensitive | boolean | true | Whether consistency comparison is case-sensitive |
doubledWordExceptions | string | sie;vous;nous | Semicolon-separated list of words allowed to repeat (e.g. sie;vous;nous) |
forbiddenChars | string | Characters that must not appear in target text (e.g. {}[]) | |
maxCharLengthAbove | integer | 200 | Maximum allowed percentage of source length for long text |
maxCharLengthBelow | integer | 350 | Maximum allowed percentage of source length for short text |
maxCharLengthBreak | integer | 20 | Character count above which text is considered long for the maximum length check |
maxWords | integer | 0 | Maximum number of words allowed in any target segment |
minCharLengthAbove | integer | 45 | Minimum required percentage of source length for long text |
minCharLengthBelow | integer | 30 | Minimum required percentage of source length for short text |
minCharLengthBreak | integer | 20 | Character count above which text is considered long for the minimum length check |
mode | string | rules | How to check quality: deterministic local rules, or an AI provider's review |
model | string | AI model name | |
provider | string | anthropic | AI provider |
requiredChars | string | Characters that must appear in target if present in source (e.g. punctuation) | |
strictCodeOrder | boolean | false | Flag differences when codes appear in a different order between source and target |
targetSameAsSourceWithCodes | boolean | true | Include inline codes when comparing source and target for identity |
targetSameAsSourceWithNumbers | boolean | true | Include number-only segments in same-as-source comparison |
Configure it live
Examples
Inline-code and whitespace checks only
Focus on code preservation and whitespace, disabling the length-ratio checks.
checkCodeDifference: true
checkLeadingWhitespace: true
checkTrailingWhitespace: true
checkMaxCharLength: false
checkMinCharLength: false
Enforce an absolute character cap
Report any target longer than 200 characters.
checkAbsoluteMaxCharLength: true
absoluteMaxCharLength: 200
Review with an AI provider
Ask the provider to review fluency and accuracy.
mode: ai
provider: anthropic
checks: [fluency, accuracy]
Processing notes
Operates on translatable blocks; non-translatable structure passes through unchanged.
When a block has no translation in the target language, only the empty-target check applies.
Findings are recorded on the block as a findings annotation, which
kapi exec qaprints as its report.The consistency checks compare each block with the blocks before it in the same run.
Limitations
Length and ratio checks compare character lengths only when source and target are both non-empty.
The regex pattern pairs used by
checkPatternsare supplied programmatically, not as schema parameters.Requires a target language. The tool compares translations in that one language per run.
Run on a translation file alone, the
rulesmode reads each block as untranslated and reports it as an empty target. Name the source file and pass the translation with--target.A run with
--targetpairs one source file with one translation and refuses-oand--output-dir.
← Back to the Tool Reference