4.3 KiB
Gettext Migration Progress Notes
Current Status: Phase 2 Nearly Complete
✅ Completed Phases
-
Phase 1: Infrastructure - DONE (previous session)
- 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 (7/7)
-
Phase 2: 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 (87 tests)
-
Phase 2: Core Components - DONE ✅
- ConsentPrompt component migrated:
- Modal title, policy review message
- Policy acceptance labels
- Consent disclaimer text
- Accept button text
- ConsentPrompt component migrated:
-
Phase 2: Auth Flash Messages (user_auth.ex) - DONE ✅
- Migrated ALL remaining auth messages in user_auth.ex:
- Plug functions:
require_sudo_mode,require_authenticated_user,require_superuser load_current_organization(3 messages)- LiveView on_mount callbacks (all auth-related messages)
- Plug functions:
- Added
use Gettext, backend: ToweropsWeb.Gettextto user_auth.ex - Added
import ToweropsWeb.GettextHelpersto user_auth.ex
- Migrated ALL remaining auth messages in user_auth.ex:
🔄 Remaining Work
Still Need to Migrate
-
UserSettingsLive session management (lib/towerops_web/live/user_settings_live/session_manager.ex):
- Line 16: "Mobile device removed successfully."
- Line 20: "Failed to remove mobile device."
- Line 39: "Failed to update alert preferences."
-
Policy consent message (lib/towerops_web/user_auth.ex):
- Line 659: "Thank you for accepting the updated policies."
-
Other scattered flash messages - Need to grep for remaining untranslated strings
Final Steps (Phase 3)
- Extract new strings:
mix gettext.extract - Populate English:
mix populate_english - Run full test suite:
mix test - Run precommit:
mix precommit - Commit final changes
- Update design document status
Git Commits So Far
89a076f- Equipment features + sudo mode test fixesa995e62- Admin features migration2ef154e- Core components (consent prompt)- PENDING - Auth flash messages (user_auth.ex - just completed, not committed yet)
Files Modified (Not Yet Committed)
lib/towerops_web/user_auth.ex- All auth flash messages migrated to t_auth()
Next Steps to Resume
-
Migrate remaining 4 flash messages:
- session_manager.ex (3 messages)
- user_auth.ex line 659 (1 message)
-
Run
mix gettext.extract && mix populate_english -
Test everything:
mix test mix precommit -
Commit the auth messages:
mix format && git add -A && git commit -m "feat: migrate authentication flash messages to gettext" -
Migrate final remaining messages and create final commit
-
Update todo list to mark phase complete
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