Skip to content

solvi.i18n

Languages of rendering: the audit, solvi.show and the safeguard report in English (default) or Russian.

Languages for what solvi renders for people: the audit, solvi.show, the safeguard report and the messages solvi writes itself (safeguard labels, the why of an answer, rejection and escalation reasons).

system = System(cat, QUESTIONS, lang="ru")      # res.audit(), show(res), system.safeguard_summary() in Russian
print(res.audit(lang="ru"))                     # or per call; show(res, lang="ru"); system.safeguard_summary(lang="ru")

English is the default and is what solvi records: every message that enters a trace, a stored response or a hash — a rejection reason, Result.why, an escalation message, the plan — is written in English, and a language other than English changes only the rendering. So traces, hashes, to_dict() and replay are the same whatever the language.

What is translated: solvi's own words — headings and labels, safeguard names, statuses and provenance kinds, and the messages solvi builds from templates (msg). What is never translated: anything that came from you — fact, part and question names, values, options, quoted text, the text of your exceptions and validators. A message solvi does not know (a template added later, a message from your own code) is shown as it is, in English.

Languages: "en", "ru". A catalog for another language is a dict like RU below, added to LANGS.

check

check(lang)

A language code → itself; None → the default ("en"); an unknown code → ValueError.

t

t(key, lang=None, **kw)

A word or template of the catalog, in a language, formatted with kw.

label

label(kind, lang=None)

A safeguard's label (grounding → "grounding rejected").

width

width(keys, lang=None, en=12)

The column width for a set of labels: the English width as it always was; in another language, the longest label plus a space (at least the English width).

msg

msg(text, lang=None, scope='msg', _depth=0)

A message solvi wrote (in English, as recorded) → the same message in a language. Unknown messages, and the parts of a message that came from you, stay as they are; English returns the text unchanged.