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. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ca2edeca86
commit
4f5610974f
|
|
@ -142,7 +142,7 @@ import { LoadingSpinnerComponent, EmptyStateComponent } from '@shared/index';
|
||||||
@if (!item.isAvailable && item.unavailableReason) {
|
@if (!item.isAvailable && item.unavailableReason) {
|
||||||
<div class="subject-card-warning">
|
<div class="subject-card-warning">
|
||||||
<mat-icon>warning</mat-icon>
|
<mat-icon>warning</mat-icon>
|
||||||
{{ item.unavailableReason }}
|
{{ translateReason(item.unavailableReason) }}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -150,7 +150,7 @@ import { LoadingSpinnerComponent, EmptyStateComponent } from '@shared/index';
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
(click)="enroll(item)"
|
(click)="enroll(item)"
|
||||||
[disabled]="!item.isAvailable || processingId() === item.id || enrollments().length >= 3"
|
[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"
|
data-testid="btn-enroll-subject"
|
||||||
>
|
>
|
||||||
@if (processingId() === item.id) {
|
@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