best_engine_ai_helper.i18n module

i18n — shared loader for locales/i18n.yaml, the human-language source of truth.

Every GUI-visible string and every model-facing prompt template used by this package is authored once, in locales/i18n.yaml (package root), under two top-level namespaces:

gui

UI strings keyed by a stable semantic name, each with a value per supported locale (fr / en). Consumed by best_engine_ai_helper.gui.

prompts

Model-facing prompt templates (system / user text sent to the local LLM or VLM by best_engine_ai_helper.ralph, best_engine_ai_helper.validate_llm, and best_engine_ai_helper.validate_vlm), authored in a single language declared at meta.model_prompt_locale (English here) rather than translated — see locales/i18n.yaml’s header and CODING.md section 21.3.3 for why prompt wording is not localized like GUI copy.

This module owns parsing and caching the file; it does not know what any individual key means to its caller.

Author

Warith Harchaoui <warith.harchaoui@deraison.ai>

best_engine_ai_helper.i18n.gui_strings()[source]

Return the gui namespace: semantic key -> {locale: text}.

Returns:

One entry per GUI string; each value maps a locale code to its text.

Return type:

dict

Examples

>>> "hero_title" in gui_strings()
True
best_engine_ai_helper.i18n.meta()[source]

Return the meta block: locale defaults and the model-prompt language.

Returns:

Keys default_locale, supported_locales, model_prompt_locale.

Return type:

dict

Examples

>>> sorted(meta().keys())
['default_locale', 'model_prompt_locale', 'supported_locales']
best_engine_ai_helper.i18n.prompt(key, field='user')[source]

Return one field of a model-facing prompt template.

Parameters:
  • key (str) – Top-level key under prompts: in locales/i18n.yaml (e.g. "eyeball_critique").

  • field (str) – Which sub-field to return: "system", "user", or "text" for a fragment with no role split. Defaults to "user".

Returns:

The raw template text, with any {placeholder} markers intact for the caller to fill via str.format.

Return type:

str

Raises:

KeyError – If key or field is not present — a missing prompt must fail loudly rather than silently send an empty string to a model.

Examples

>>> prompt("writing_charter_excerpt", "text").startswith("Rule 5")
True