2.9 KiB
2.9 KiB
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:
# 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
_('Text to translate')
2. Strings with Variables (using % formatting)
_('Update Appointment: %(number)s') % {'number': appointment_number}
_('Invalid date format: %(error)s') % {'error': str(e)}
3. Success Messages with .format()
success_message = _("Appointment created successfully! Number: {appointment_number}")
# Later formatted with:
self.success_message.format(appointment_number=self.object.appointment_number)
Next Steps
- ✅ Complete appointments/views.py
- ⏳ Update core/views.py
- ⏳ Update finance/views.py
- ⏳ Update medical/views.py
- ⏳ Update slp/views.py
- ⏳ Update aba/views.py
- ⏳ Update hr/views.py
- ⏳ Generate Arabic translation files with
python manage.py makemessages -l ar - ⏳ 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%)