Skip to content

feat(i18n): extract agent manager messages - #862

Open
thomwebb wants to merge 6 commits into
mpfaffenberger:mainfrom
thomwebb:feat/i18n-extract-agent-manager
Open

feat(i18n): extract agent manager messages#862
thomwebb wants to merge 6 commits into
mpfaffenberger:mainfrom
thomwebb:feat/i18n-extract-agent-manager

Conversation

@thomwebb

Copy link
Copy Markdown
Collaborator

Continues the CLI i18n extraction effort by localizing user-facing discovery, cloning, and deletion messages in code_puppy/agents/agent_manager.py.

  • Adds agent_manager.* catalog keys.
  • Adds Spanish and Canadian French translations.
  • Preserves dynamic placeholders and message grouping.
  • Adds focused catalog, pseudolocale, and placeholder tests.

@WSxDemise

Copy link
Copy Markdown
Collaborator

[Wes's CodePuppy Agent Review]

Agent-manager extraction and the three catalogs are in scope. The runtime locale-selection gap leaves the stated Spanish and Canadian French behavior unimplemented.

Qodo Merge Triage

Qodo: not configured for OSS/public GitHub.

Scope observations — not changes requested on this PR

  • [P1] [SCOPE] Redundant i18n reset fixture — tests/i18n/test_agent_manager_i18n.py:13
    • Impact: This duplicates the repository-wide autouse reset and can drift from the canonical i18n test isolation behavior.
    • Follow-up: File a test-hygiene follow-up; tests/i18n/conftest.py:15 already supplies this isolation.

Code Review Findings

Really Should Fix These

  • [P0] [UNIMPLEMENTED] Added messages never use the selected locale — code_puppy/agents/agent_manager.py:292
    • Impact: With CODE_PUPPY_LOCALE or puppy.cfg set to Spanish or French, every added call resolves in default English, so the advertised translations never reach users.
    • Fix: Seed the translator from get_value("locale") during CLI startup before the first t() call, and cover an environment-selected non-English message.

Nits

  • [P2] [COMMENT] Module docstring restates the file's purpose — tests/i18n/test_agent_manager_i18n.py:1
    • Impact: It repeats what the filename and test names state without recording a non-obvious decision.
    • Fix: Remove it, or replace it with the concise reason catalog-level tests are preferred here.

@thomwebb

Copy link
Copy Markdown
Collaborator Author

Addressed review feedback in commit 7fae7b14.

  • Added CLI-startup locale initialization via use_detected_locale(get_value("locale")), before main() can emit translated messages. Environment variables retain their documented precedence.
  • Added coverage for an environment-selected Spanish message.
  • Removed the duplicate i18n reset fixture and replaced the test module docstring with the rationale for catalog-level coverage.
  • Re-ran Ruff formatting, compilation, and diff checks successfully.

@thomwebb

Copy link
Copy Markdown
Collaborator Author

Follow-up fix pushed in commit e93b7277: corrected the Spanish assertion to match the translated sentence (agente is lowercase in context). The previous CI failure was only this case-sensitive test expectation; the implementation and locale initialization were working as intended.

@WSxDemise WSxDemise left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Wes's CodePuppy Agent Review]

Localizes agent-manager discovery, cloning, and deletion messages and adds startup locale selection. Qodo Merge Triage: not configured for OSS/public GitHub. Scope/parity: the extraction and supporting catalogs/tests are within the stated i18n work; the startup initialization is covered by the linked commit intent.

What you're being asked to change on this PR

  • [P1] Initialize locale after argparse handles help/version — code_puppy/cli_runner.py:1589

Comment thread code_puppy/cli_runner.py
"""Select the UI locale before any startup message is translated."""
from code_puppy.config import get_value

use_detected_locale(get_value("locale"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Initialize locale after argparse handles help/version

  • Why: A configuration I/O failure now prevents --help and --version, which previously exit through argparse before configuration access.
  • Do: Move locale initialization into main() immediately after parse_args() so argparse-only exits remain configuration-independent.
Evidence

code_puppy/cli_runner.py:1589 calls get_value("locale") before asyncio.run(main()); code_puppy/config_file.py:52 documents that ordinary filesystem errors propagate.

@thomwebb

Copy link
Copy Markdown
Collaborator Author

Updated in commits c74a20de and 859953c5. Merged the current upstream main and resolved the locale catalog conflicts. Moved _initialize_locale() into main() immediately after parse_args(), so --help and --version remain independent of config I/O while normal startup still honors environment/config locale selection. The branch is pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants