Skip to main content

Module i18n

Module i18n 

Source
Expand description

ssh-cli internationalization system (Rules Rust multi-idioma).

Provides bilingual Language with Message as the single source of human UI strings. Locale detection / BCP47 negotiation lives in crate::locale.

§Design (agent-first one-shot)

  • MVP locales: neutral en + pt-BR (100% key parity via exhaustive match).
  • Not Fluent FTL at runtime: size-sensitive CLI; compiler-enforced enum translations are the embedded equivalent of i18n-embed for two locales.
  • JSON / agent wire: stable English field names and technical crate::errors::SshCliError Display (not locale-dependent).
  • Human UX (success/status/cancel lines): always via Message / t.
  • Optional top-20 locales: Cargo features i18n-* (stubs until translations land).

§Precedence (see crate::locale)

  1. CLI --lang → 2. persisted XDG lang (locale set) →
  2. sys_locale → 4. Language::English.

SSH_CLI_LANG is historical only — not read as a product store.

Enums§

Language
Languages supported by the internationalization system.
Message
All system UI messages.
TextDirection
Text direction for terminal rendering (LTR MVP; RTL reserved for i18n-rtl).

Functions§

current_language
Returns the currently configured language.
initialize_language
Initializes i18n by resolving locale (5-layer precedence) and publishing once to the global crate::locale OnceLock.
t
Returns the message string in the current global language.