docs: mark gettext migration as complete

This commit is contained in:
Graham McIntire 2026-02-02 13:24:27 -06:00
parent 9a60bfec58
commit 17348bb7e3
No known key found for this signature in database

View file

@ -1,10 +1,10 @@
# Gettext Migration Progress Notes
## Current Status: Phase 2 Nearly Complete
## Current Status: ✅ COMPLETE
### ✅ Completed Phases
### ✅ All Phases Completed
1. **Phase 1: Infrastructure** - DONE (previous session)
1. **Phase 1: Infrastructure** - DONE
- Created gettext helpers with domain-specific functions
- Set up pot files for each domain
- Created `mix populate_english` task
@ -16,84 +16,63 @@
- AlertLive.Index: alert acknowledgment messages
- SiteLive.Show: site discovery messages
- SiteLive.Form: site CRUD and SNMP/agent propagation
- All equipment tests passing (7/7)
- All equipment tests passing
3. **Phase 2: Admin Features** - DONE ✅
3. **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 (87 tests)
- All admin tests passing
4. **Phase 2: Core Components** - DONE ✅
4. **Phase 4: Core Components** - DONE ✅
- ConsentPrompt component migrated:
- Modal title, policy review message
- Policy acceptance labels
- Consent disclaimer text
- Accept button text
5. **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)
5. **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.Gettext` to user_auth.ex
- Added `import ToweropsWeb.GettextHelpers` to user_auth.ex
### 🔄 Remaining Work
6. **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)
#### Still Need to Migrate
7. **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)
1. **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."
### Final Test Results
2. **Policy consent message** (lib/towerops_web/user_auth.ex):
- Line 659: "Thank you for accepting the updated policies."
- **Tests**: 4165 tests, 0 failures ✅
- **Precommit**: All checks passed ✅
- **Extraction**: All strings extracted and populated ✅
3. **Other scattered flash messages** - Need to grep for remaining untranslated strings
#### Final Steps (Phase 3)
4. Extract new strings: `mix gettext.extract`
5. Populate English: `mix populate_english`
6. Run full test suite: `mix test`
7. Run precommit: `mix precommit`
8. Commit final changes
9. Update design document status
### Git Commits So Far
### Git Commits
1. `89a076f` - Equipment features + sudo mode test fixes
2. `a995e62` - Admin features migration
3. `2ef154e` - Core components (consent prompt)
4. *PENDING* - Auth flash messages (user_auth.ex - just completed, not committed yet)
4. `0d85e85` - Session manager mobile and policy consent messages
5. `9a60bfe` - User settings and agent management (final commit)
### Files Modified (Not Yet Committed)
### Migration Complete! 🎉
- `lib/towerops_web/user_auth.ex` - All auth flash messages migrated to t_auth()
### Next Steps to Resume
1. Migrate remaining 4 flash messages:
- session_manager.ex (3 messages)
- user_auth.ex line 659 (1 message)
2. Run `mix gettext.extract && mix populate_english`
3. Test everything:
```bash
mix test
mix precommit
```
4. Commit the auth messages:
```bash
mix format && git add -A && git commit -m "feat: migrate authentication flash messages to gettext"
```
5. Migrate final remaining messages and create final commit
6. Update todo list to mark phase complete
All user-facing flash messages have been successfully migrated to use gettext with domain-specific helper functions:
- `t_equipment()` - Equipment/agent/site domain
- `t_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