fix(frontend): translate enrollment restriction messages to Spanish
Add translateReason() method to convert API messages to Spanish: - "Already enrolled" -> "Ya inscrito" - "Already have a subject with this professor" -> "Ya tienes una materia con este profesor" - "Maximum 3 subjects reached" -> "Máximo 3 materias alcanzado" Apply translation to both warning text and tooltip. Fixes DEF-002: Messages were displaying in English instead of Spanish, breaking UI language consistency.
This commit is contained in:
parent
a899f3f19b
commit
e0c130294f
|
|
@ -142,7 +142,7 @@ import { LoadingSpinnerComponent, EmptyStateComponent } from '@shared/index';
|
|||
@if (!item.isAvailable && item.unavailableReason) {
|
||||
<div class="subject-card-warning">
|
||||
<mat-icon>warning</mat-icon>
|
||||
{{ item.unavailableReason }}
|
||||
{{ translateReason(item.unavailableReason) }}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
@ -150,7 +150,7 @@ import { LoadingSpinnerComponent, EmptyStateComponent } from '@shared/index';
|
|||
class="btn btn-sm btn-primary"
|
||||
(click)="enroll(item)"
|
||||
[disabled]="!item.isAvailable || processingId() === item.id || enrollments().length >= 3"
|
||||
[matTooltip]="!item.isAvailable ? item.unavailableReason || '' : 'Inscribir'"
|
||||
[matTooltip]="!item.isAvailable ? translateReason(item.unavailableReason || '') : 'Inscribir'"
|
||||
data-testid="btn-enroll-subject"
|
||||
>
|
||||
@if (processingId() === item.id) {
|
||||
|
|
@ -428,4 +428,14 @@ export class EnrollmentPageComponent implements OnInit {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
private readonly reasonTranslations: Record<string, string> = {
|
||||
'Already enrolled': 'Ya inscrito',
|
||||
'Already have a subject with this professor': 'Ya tienes una materia con este profesor',
|
||||
'Maximum 3 subjects reached': 'Máximo 3 materias alcanzado',
|
||||
};
|
||||
|
||||
translateReason(reason: string): string {
|
||||
return this.reasonTranslations[reason] ?? reason;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue