Skip to main content

Usage

validate checks source and target text with the same 12-check policy as Hyperlocalise Cloud QA. Pass --policy-file for a custom policy, or omit it to use the built-in defaults. The qa.policy_file key in i18n.yml applies to check. Pass text on the command line, point at files, or send a JSON batch with --input-file.

Checks

Each check is enabled or disabled and has severity error or warning. The default policy enables the first nine checks. Numbers, ending punctuation, and capitalization stay off until a policy file turns them on. Spelling runs when hunspell is on PATH and the locale dictionary is installed. Set DICPATH to the dictionary directory, or install the dictionaries under /usr/share/hunspell. Otherwise the result lists spelling under skippedChecks, and text output prints a skipped spelling line. Skipped checks leave the exit code unchanged. Each segment reports up to five distinct misspelled words. acceptedWordsByLocale in the policy skips those words. Locale keys match case-insensitively, and _ is treated as -.

Policy file

--policy-file loads a JSON policy. Omit it to use the defaults in the table above. The file must set "version": 1 and include every check. Severity is error or warning. Unknown fields are rejected.
A glossary term applies when targetLocale matches the segment and the source contains sourceTerm. The target must then contain targetTerm. Set forbidden to true when the target must stay free of targetTerm. Matching is a substring. Set caseSensitive to true to keep case. An empty target skips glossary checks.

Flags

  • --source-text: source text. Use this or --source-file
  • --source-file: file containing the source text
  • --target-text: target text. Use this or --target-file
  • --target-file: file containing the target text
  • --target-locale: target locale for a single segment. Required for that mode
  • --source-path: path used for format detection. Defaults to --source-file when that flag is set
  • --max-length: maximum target length in Unicode characters. 0 means no limit
  • --input-file: JSON batch path, or - for stdin. Use this flag on its own, without the source and target flags
  • --policy-file: QA policy JSON file
  • --format: text (default) or json
  • --no-fail: text output exits 0 when findings exist
For one segment, pass one source flag and one target flag. Text output prints one line per finding:
Text output exits 1 when it prints a finding. --no-fail exits 0. JSON output writes the report and exits 0 when findings are the only result. A policy or input the command cannot read still exits nonzero.

Batch input

--input-file reads an object with a segments array. Each segment needs a unique id, a targetLocale, and a nonnegative maxLength. Omit maxLength or set it to 0 for no limit. sourceText, targetText, and sourcePath are optional.

Examples

See also