105 lines
2.9 KiB
Markdown
105 lines
2.9 KiB
Markdown
# Translation Fixes Summary
|
|
|
|
## Overview
|
|
This document tracks the progress of wrapping untranslated strings with Django's translation functions across all apps.
|
|
|
|
## Completed Files
|
|
|
|
### ✅ appointments/views.py
|
|
**Status:** Complete
|
|
**Strings Fixed:** 63
|
|
**Changes Made:**
|
|
- Added `from django.utils.translation import gettext_lazy as _` import
|
|
- Wrapped all success/error/warning messages with `_()`
|
|
- Wrapped form titles and submit button text
|
|
- Wrapped error titles and messages for patient-facing views
|
|
- Wrapped API error messages
|
|
- Used proper string formatting with `%` operator for dynamic content
|
|
|
|
**Examples:**
|
|
```python
|
|
# Before
|
|
messages.success(request, 'Appointment confirmed successfully!')
|
|
context['form_title'] = 'Create New Appointment'
|
|
|
|
# After
|
|
messages.success(request, _('Appointment confirmed successfully!'))
|
|
context['form_title'] = _('Create New Appointment')
|
|
```
|
|
|
|
## Pending Files
|
|
|
|
### ⏳ core/views.py
|
|
**Estimated Strings:** 105
|
|
**Priority:** High (core functionality)
|
|
|
|
### ⏳ finance/views.py
|
|
**Estimated Strings:** 37
|
|
**Priority:** High (user-facing invoices)
|
|
|
|
### ⏳ medical/views.py
|
|
**Estimated Strings:** 33
|
|
**Priority:** High (clinical documentation)
|
|
|
|
### ⏳ slp/views.py
|
|
**Estimated Strings:** 32
|
|
**Priority:** High (clinical documentation)
|
|
|
|
### ⏳ aba/views.py
|
|
**Estimated Strings:** 18
|
|
**Priority:** High (clinical documentation)
|
|
|
|
### ⏳ hr/views.py
|
|
**Estimated Strings:** 23
|
|
**Priority:** Medium (mostly already translated)
|
|
|
|
## Translation Patterns Used
|
|
|
|
### 1. Simple Strings
|
|
```python
|
|
_('Text to translate')
|
|
```
|
|
|
|
### 2. Strings with Variables (using % formatting)
|
|
```python
|
|
_('Update Appointment: %(number)s') % {'number': appointment_number}
|
|
_('Invalid date format: %(error)s') % {'error': str(e)}
|
|
```
|
|
|
|
### 3. Success Messages with .format()
|
|
```python
|
|
success_message = _("Appointment created successfully! Number: {appointment_number}")
|
|
# Later formatted with:
|
|
self.success_message.format(appointment_number=self.object.appointment_number)
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
1. ✅ Complete appointments/views.py
|
|
2. ⏳ Update core/views.py
|
|
3. ⏳ Update finance/views.py
|
|
4. ⏳ Update medical/views.py
|
|
5. ⏳ Update slp/views.py
|
|
6. ⏳ Update aba/views.py
|
|
7. ⏳ Update hr/views.py
|
|
8. ⏳ Generate Arabic translation files with `python manage.py makemessages -l ar`
|
|
9. ⏳ Compile translations with `python manage.py compilemessages`
|
|
|
|
## Notes
|
|
|
|
- All CSV export column headers should be translated
|
|
- Form titles and submit button text should be translated
|
|
- Error messages for both staff and patients should be translated
|
|
- API error responses should be translated
|
|
- Default values (like 'Patient declined') should be translated
|
|
- File names in Content-Disposition headers can remain in English
|
|
|
|
## Statistics
|
|
|
|
- **Total Apps:** 7
|
|
- **Completed:** 1 (14%)
|
|
- **Remaining:** 6 (86%)
|
|
- **Total Estimated Strings:** ~308
|
|
- **Strings Fixed:** 63 (20%)
|
|
- **Strings Remaining:** ~245 (80%)
|