Skip to main content

Module i18n

Module i18n 

Source
Expand description

Bilingual internationalisation (EN/PT-BR) for user-facing messages.

Language resolution order:

  1. CLI flag --lang en|pt
  2. Environment variable CONTEXT7_LANG
  3. sys_locale::get_locale() — locale starting with "pt" → Portuguese
  4. Default: English

Call set_language once at startup (in run()), then call current_language or t anywhere to retrieve localised strings.

Enums§

Language
Supported display languages.
Message
All user-facing messages indexed by variant.

Functions§

current_language
Returns the currently configured language.
resolve_language
Resolves the language from CLI flag, env var, or system locale.
set_language
Sets the global language. Silently ignored if already set (OnceLock semantics).
t
Returns the localised string for a message in the current language.