4.1 KiB
4.1 KiB
Gettext Migration Progress Notes
Current Status: ✅ COMPLETE
✅ All Phases Completed
-
Phase 1: Infrastructure - DONE ✅
- Created gettext helpers with domain-specific functions
- Set up pot files for each domain
- Created
mix populate_englishtask
-
Phase 2: Equipment Features - DONE ✅
- DeviceLive.Index: device discovery, reordering, error messages
- DeviceLive.Show: backup messages, permission errors
- DeviceLive.Form: device CRUD operations
- AlertLive.Index: alert acknowledgment messages
- SiteLive.Show: site discovery messages
- SiteLive.Form: site CRUD and SNMP/agent propagation
- All equipment tests passing
-
Phase 3: Admin Features - DONE ✅
- Admin.UserLive.Index: user deletion messages
- Admin.OrgLive.Index: organization deletion messages
- UserAuth: impersonation start/stop messages (3 strings)
- All admin tests passing
-
Phase 4: Core Components - DONE ✅
- ConsentPrompt component migrated:
- Modal title, policy review message
- Policy acceptance labels
- Consent disclaimer text
- Accept button text
- ConsentPrompt component migrated:
-
Phase 5: Authentication Flash Messages - DONE ✅
- user_auth.ex: All auth-related plugs and LiveView callbacks
- user_auth.ex: Policy consent acceptance message
- Added
use Gettext, backend: ToweropsWeb.Gettextto user_auth.ex - Added
import ToweropsWeb.GettextHelpersto user_auth.ex
-
Phase 6: User Settings - DONE ✅
- session_manager.ex: Mobile device removal (2 messages)
- session_manager.ex: Alert preferences (2 messages)
- session_manager.ex: Browser session revocation (5 messages)
- session_manager.ex: Revoke all sessions (1 message)
- totp_manager.ex: Device creation, verification, deletion (6 messages)
- api_token_manager.ex: Token creation and deletion (5 messages)
-
Phase 7: Agent Management - DONE ✅
- agent_live/edit.ex: Agent update success (1 message)
- agent_live/index.ex: Agent/cloud poller creation (3 messages)
- agent_live/index.ex: Token regeneration (3 messages)
- agent_live/index.ex: Agent deletion (2 messages)
- agent_live/index.ex: Global default cloud poller settings (2 messages)
Final Test Results
- Tests: 4165 tests, 0 failures ✅
- Precommit: All checks passed ✅
- Extraction: All strings extracted and populated ✅
Git Commits
89a076f- Equipment features + sudo mode test fixesa995e62- Admin features migration2ef154e- Core components (consent prompt)0d85e85- Session manager mobile and policy consent messages9a60bfe- User settings and agent management (final commit)
Migration Complete! 🎉
All user-facing flash messages have been successfully migrated to use gettext with domain-specific helper functions:
t_equipment()- Equipment/agent/site domaint_admin()- Admin domain (user/org management, impersonation)t_auth()- Authentication domain (login, TOTP, sudo mode, sessions)gettext()- Default domain (generic UI strings)
Helper Functions Reference
t_equipment(msg)- Equipment domain (devices, sites, alerts, agents)t_admin(msg)- Admin domain (user management, org management, impersonation)t_auth(msg)- Auth domain (login, TOTP, sudo mode, permissions)gettext(msg)- Default domain (generic UI strings)
All helpers support interpolation: t_equipment("Device %{name} created", name: device.name)
User Question Answered
Agent WebSocket Connection Issue:
User tried connecting agent to http://localhost:4000 but got WebSocket errors.
Solution provided:
- Agent auto-converts
http://localhost:4000tows://localhost:4000/socket/agent/websocket - Suggested troubleshooting:
- Verify Phoenix running with
mix phx.server - Test WebSocket with
wscat -c ws://localhost:4000/socket/agent/websocket - Create valid agent token in UI at
/agents - Run agent with debug:
RUST_LOG=debug cargo run -- --api-url http://localhost:4000 --token <token>
- Verify Phoenix running with
- Common issues: expired token, Phoenix not running, wrong port
Design Document Location
docs/plans/2026-02-02-gettext-internationalization-design.md