Fix et add translation

This commit is contained in:
2026-01-19 14:46:32 +01:00
parent 68891fe8c6
commit 20859f7f68
16 changed files with 290 additions and 153 deletions

View File

@@ -5,7 +5,7 @@ import {
ReactiveFormsModule,
Validators,
} from "@angular/forms";
import { TranslateModule } from "@ngx-translate/core";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
import { MatFormFieldModule } from "@angular/material/form-field";
import { MatInputModule } from "@angular/material/input";
import { MatButtonModule } from "@angular/material/button";
@@ -36,17 +36,26 @@ export class NewAircraftComponent implements OnInit {
constructor(
private serviceComm: ServiceComm,
private serviceApi: AircraftService
private serviceApi: AircraftService,
private translateService: TranslateService,
) {
this.addForm = new FormGroup(
{
aircraftName: new FormControl("", Validators.required),
},
{ updateOn: "blur" }
{ updateOn: "blur" },
);
}
ngOnInit() {}
ngOnInit() {
this.serviceComm.forceTranslateTitle.subscribe((data) => {
if (data === true) {
this.updateTitle();
}
});
this.updateTitle();
}
onSubmit(formData) {
if (formData.invalid) {
@@ -98,4 +107,10 @@ export class NewAircraftComponent implements OnInit {
}
};
}
private updateTitle() {
this.translateService.get("NewAircraft_Title").subscribe((data) => {
this.serviceComm.updatedComponentTitle(data);
});
}
}