GlossaryRule class
For each entry whose source value contains a glossary term, every target translation must contain a recognizable form of the canonical translation.
The escape hatch for non-literal uses (e.g. "Book club", where "Book"
means a physical book rather than the verb) is @key.glossary_exempt
on the SOURCE entry, in either of two shapes:
"glossary_exempt": ["take", "sentence"] // waive exactly these terms
"glossary_exempt": true // waive every term (blunt)
The list form is preferred and is what the hint suggests. One string can
use two locked terms non-literally for two different, both-correct
reasons while still needing the rest of the glossary applied — the
blanket true silently waives those too, and it tells a reviewer
nothing about what was waived, which is precisely what a waiver should
make visible.
Match strategy (deliberately a heuristic — this is a warning):
- Source side: whole-word case-insensitive match of
termagainst a word-tokenized source value. - Translation side: case-insensitive substring match of a prefix of the canonical translation. The prefix is the lowercased canonical with the last 2 chars dropped when length > 4 (handles suffix-based inflection: "Reservar" → search "reserv", which also matches "Reserva"/"Reservamos"/"Reservación"). Languages with little suffix inflection (CJK) get the full canonical.
The match is intentionally permissive. False positives are dismissed
per-term via @key.glossary_exempt; the warning hint says so, and
names the specific term to add.
Constructors
- GlossaryRule()
-
const
Properties
- defaultSeverity → IssueSeverity
-
Default severity. May be overridden per-issue.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Stable rule identifier (snake_case). Used by the report formatter
to group findings and by users to silence/ack via state file
(post-v1.0).
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
DialectProject project) → List< Issue> -
Inspect
projectand return findings. May return an empty list. Should NOT throw — turn unexpected conditions into Issues so the report surfaces them rather than crashing.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited