Skip to content

Commit

Permalink
Tracking of new language signal to compute new tooltip for different …
Browse files Browse the repository at this point in the history
…language
  • Loading branch information
laxerhd committed Dec 6, 2024
1 parent 565a910 commit 326fc94
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ACCEPTED_FILE_EXTENSIONS_FILE_BROWSER, ALLOWED_FILE_EXTENSIONS_HUMAN_RE
import { CompetencyLectureUnitLink } from 'app/entities/competency.model';
import { MAX_FILE_SIZE } from 'app/shared/constants/input.constants';
import { toSignal } from '@angular/core/rxjs-interop';
import { of } from 'rxjs';
import { map, of } from 'rxjs';
import { FormDateTimePickerComponent } from 'app/shared/date-time-picker/date-time-picker.component';
import { TranslateService } from '@ngx-translate/core';

Expand Down Expand Up @@ -83,6 +83,8 @@ export class AttachmentUnitFormComponent implements OnChanges {
}
}

private readonly currentLanguage = toSignal(this.translateService.onLangChange.pipe(map((event) => event.lang)));

onFileChange(event: Event): void {
const input = event.target as HTMLInputElement;
if (!input.files?.length) {
Expand All @@ -101,6 +103,7 @@ export class AttachmentUnitFormComponent implements OnChanges {
}

tooltipText = computed(() => {
this.currentLanguage();
if (!this.fileName() && !this.name()) {
return this.translateService.instant('artemisApp.attachmentUnit.createAttachmentUnit.nameAndFileRequiredValidationError');
}
Expand Down

0 comments on commit 326fc94

Please sign in to comment.