Skip to main content

Module i18n

Module i18n 

Source
Expand description

Bilingual message layer for human-facing stderr progress (--lang en|pt, SQLITE_GRAPHRAG_LANG). Bilingual human-readable message layer.

The CLI uses --lang en|pt (global flag) or SQLITE_GRAPHRAG_LANG (env var) to choose the language of stderr progress messages. JSON stdout is deterministic and identical across languages — only strings intended for humans pass through this module.

Detection (highest to lowest priority):

  1. Explicit --lang flag
  2. Env var SQLITE_GRAPHRAG_LANG
  3. OS locale (LANG, LC_ALL) with pt prefix
  4. Fallback English

Modules§

errors_msg
Localized error messages for AppError variants.
validation
Localized validation messages for memory fields.

Enums§

Language

Functions§

current
Returns the active language, or fallback English if init was never called.
error_prefix
Localized prefix for error messages displayed to the end user.
init
Initializes the global language. Subsequent calls are silently ignored (OnceLock semantics) — guaranteeing thread-safety and determinism.
tr
Translates a bilingual message by selecting the active variant.