Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
429 changes: 383 additions & 46 deletions cortex/cli.py

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions cortex/i18n/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""
Internationalization (i18n) module for Cortex Linux CLI.

Provides multi-language support with:
- Message translation with interpolation
- OS language auto-detection
- Language preference persistence
- Locale-aware date/time and number formatting

Usage:
from cortex.i18n import t, get_translator, set_language, get_language

# Simple translation
print(t("install.success"))

# Translation with variables
print(t("install.package_installed", package="docker", version="24.0.5"))

# Change language
set_language("es")

Supported languages:
- en: English (default)
- es: Spanish
- fr: French
- de: German
- zh: Chinese (Simplified)
"""

from cortex.i18n.config import LanguageConfig
from cortex.i18n.detector import detect_os_language
from cortex.i18n.formatter import LocaleFormatter
from cortex.i18n.translator import (
SUPPORTED_LANGUAGES,
get_language,
get_language_info,
get_supported_languages,
get_translator,
set_language,
t,
)

__all__ = [
# Core translation
"t",
"get_translator",
"set_language",
"get_language",
"get_language_info",
"get_supported_languages",
"SUPPORTED_LANGUAGES",
# Configuration
"LanguageConfig",
# Detection
"detect_os_language",
# Formatting
"LocaleFormatter",
]
Loading
Loading