checkDefinitionTexts
Checks a host's own definition text against its translations, for a
host's own tests: lists the HostText keys the definitions use and
reports each that definitionTexts lacks or holds blank. A missing entry
falls back to the source text without a warning, so this is how a host
finds untranslated text before it ships. It only reports: it never throws
and does not change how resolveText falls back.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { checkDefinitionTexts } from "@mapcairn/core";
function checkDefinitionTexts(definitions: readonly unknown[], definitionTexts: Readonly<Record<string, unknown>> | null | undefined): readonly DefinitionTextProblem[];
Description
A plain string and a shipped MessageKey are not reported, and neither is
a layer template (a card's title and lines, a list's secondary, a
control's or colour's unit and a label's template), whose keys belong
to MessageCatalogue.layerTemplates. Any other { key, text } object is
read as a HostText, wherever it is. definitions can hold anything that
carries definition text: layer definitions, basemap definitions, keyboard
help lines. The walk reads own properties (getters are read) and the items
of lists; a Map or a Set is not visited. Keys are read as the record's
own properties only.
Parameters
definitions(readonly unknown[]): Every definition the host ships. An entry for a definition that is not in the list shows up asunused, so a test that passes only some of its definitions leavesunusedout of what it compares.definitionTexts(Readonly<Record<string, unknown>> | null | undefined): A catalogue'sdefinitionTextsfor one language. With none (or a value that is not an object) every key ismissing. An entry that isundefinedcounts as missing, and one that is not text, or only space, asblank.
Returns
readonly DefinitionTextProblem[]: The problems: each used key that is missing or blank, in the
order the definitions first use it, then each unused entry in the
record's order. An empty list means every key is translated.
See also
Source: packages/core/src/messages/checkDefinitionTexts.ts:129