Date: December 2, 2024 Scope: Complete Italian and English CLI translations Strings Translated: 746 strings (373 IT + 373 EN) Test Coverage: 26 tests (100% passing) Languages Completed: Italian English Languages Pending: Spanish, French, German
File: openfatture/i18n/locales/it/cli.ftl (373 lines)
Coverage:
Files Generated:
I18N_INDEX.md - Navigation hubI18N_EXTRACTION_SUMMARY.md - Executive summary (11 KB)I18N_STRINGS_EXTRACTION.md - Detailed extraction (22 KB)I18N_STRINGS_STRUCTURED.json - Machine-parseable (28 KB)I18N_MIGRATION_GUIDE.md - Implementation plan (19 KB)I18N_REFERENCE_QUICK.txt - Quick lookup (20 KB)Total Documentation: ~100 KB of comprehensive i18n documentation
File: scripts/generate_cli_ftl.py
All Rich console formatting is preserved in translations:
cli-fattura-create-title = [bold blue]Crea Nuova Fattura[/bold blue]
cli-fattura-created-success = [bold green]Fattura creata con successo![/bold green]
cli-cliente-added-success = [green]Cliente aggiunto con successo (ID: { $id })[/green]
Fluent variables with proper syntax:
cli-fattura-client-selected = [green]Cliente: { $client_name }[/green]
cli-fattura-invoice-header = [bold blue]Fattura { $numero }/{ $anno }[/bold blue]
cli-cliente-has-invoices = [yellow]Attenzione: Questo cliente ha { $count } fatture[/yellow]
Native Fluent pluralization:
cli-ai-forecast-results-title = [bold green]Previsione Cash Flow - Prossimi { $months } { $months ->
[one] mese
*[other] mesi
}[/bold green]
All emoji and special characters preserved:
cli-fattura-create-title = [bold blue]Crea Nuova Fattura[/bold blue]
cli-ai-voice-title = [bold cyan]Chat Vocale AI[/bold cyan]
cli-main-group-lightning = Lightning Network
All English CLI translations maintain the same structure and features as Italian:
month vs months)cli-fattura-create-title = [bold blue]Create New Invoice[/bold blue]
cli-fattura-client-selected = [green]Client: { $client_name }[/green]
cli-ai-forecast-results-title = [bold green]Cash Flow Forecast - Next { $months } { $months ->
[one] month
*[other] months
}[/bold green]
Italian tax terms are preserved in English where appropriate:
Test Suite: tests/i18n/test_cli_translations.py
from openfatture.i18n import _, set_locale
set_locale("it")
# Fattura translations
print(_("cli-fattura-create-title"))
# Output: [bold blue]Crea Nuova Fattura[/bold blue]
print(_("cli-fattura-client-selected", client_name="Acme Corp"))
# Output: [green]Cliente: Acme Corp[/green]
# Pluralization
print(_("cli-ai-forecast-results-title", months=1))
# Output: [bold green]Previsione Cash Flow - Prossimi 1 mese[/bold green]
print(_("cli-ai-forecast-results-title", months=3))
# Output: [bold green]Previsione Cash Flow - Prossimi 3 mesi[/bold green]
All 373 strings load correctly Rich markup preserved Variables interpolate correctly Pluralization works Emoji and special characters preserved
| Category | Strings | Characters | Complexity |
|---|---|---|---|
| Help texts | 59 | ~2,500 | Low |
| Console output | 181 | ~12,000 | Medium (Rich markup) |
| Prompts | 55 | ~2,000 | Low |
| Table labels | 44 | ~1,500 | Low |
| Main CLI | 16 | ~500 | Low |
| TOTAL | 373 | ~18,500 | Medium |
cli.ftl (373 strings) COMPLETEcli.ftl (automated or manual)_()help="Client ID" help=_("cli-fattura-help-cliente-id")console.print("[bold]...") console.print(_("cli-fattura-..."))The former frontend translation work is archived and is no longer part of the product surface. New translations target CLI commands, interactive terminal flows, emails, PDFs, and other maintained outputs.
openfatture/i18n/locales/
├── it/
│ ├── common.ftl (100+ strings)
│ ├── email.ftl (120+ strings)
│ └── cli.ftl (373 strings)
├── en/
│ ├── common.ftl
│ ├── email.ftl
│ └── cli.ftl (373 strings) NEW
├── es/
│ ├── common.ftl (base)
│ ├── email.ftl (base)
│ └── cli.ftl TODO
├── fr/
│ ├── common.ftl (base)
│ ├── email.ftl (base)
│ └── cli.ftl TODO
└── de/
├── common.ftl (base)
├── email.ftl (base)
└── cli.ftl TODO
Fluent adds and characters for bidirectional text isolation. This is standard behavior and ensures proper rendering in all languages.
Example:
_("cli-fattura-client-selected", client_name="Acme Corp")
# Returns: "[green]Cliente: Acme Corp[/green]"
Note: Rich console handles these correctly. If needed, we can strip them with:
result.replace("", "").replace("", "")
We keep Rich markup in translation strings for consistency and proper formatting:
cli-fattura-create-title = [bold blue]Crea Nuova Fattura[/bold blue]
Alternative (separate formatting from content):
cli-fattura-create-title = Crea Nuova Fattura
# Then in code: console.print(f"[bold blue]{_('cli-fattura-create-title')}[/bold blue]")
Decision: Keep markup in translations for simplicity and better translator context.
Use Fluent native pluralization for Italian, English, and other languages:
cli-message = { $count ->
[one] { $count } elemento
*[other] { $count } elementi
}
console.print("[bold blue]Create New Invoice[/bold blue]")
console.print(f"[green]Client: {cliente.denominazione}[/green]")
from openfatture.i18n import _
console.print(_("cli-fattura-create-title"))
console.print(_("cli-fattura-client-selected", client_name=cliente.denominazione))
# Before
@app.command()
def create(
cliente_id: int = typer.Option(None, help="Client ID"),
):
pass
# After
from openfatture.i18n import _
@app.command()
def create(
cliente_id: int = typer.Option(None, help=_("cli-fattura-help-cliente-id")),
):
pass
docs/I18N_IMPLEMENTATION_SUMMARY.mdI18N_EXTRACTION_SUMMARY.mdI18N_MIGRATION_GUIDE.mdopenfatture/i18n/README.mddocs/I18N_USER_GUIDE.md (TODO)Implementation Complete: Phase 2 (CLI Italian Translation) Next Phase: Phase 2B (CLI English Translation) and maintained-output coverage Developer: Gianluca Mazza + Claude Code Version: 2.0.0 (CLI i18n)