This commit is contained in:
2023-05-01 16:01:43 +02:00
5 changed files with 157 additions and 41 deletions

View File

@@ -6,6 +6,10 @@ import {ActivatedRoute} from "@angular/router";
import {LocationService} from "../../service/http/location.service";
import {UserService} from "../../service/http/user.service";
import {WaypointService} from "../../service/http/waypoint.service";
import {toNumbers} from "@angular/compiler-cli/src/version_helpers";
import {managementTranslations} from "../../interface/translations";
import {TranslateService} from "../../service/language/translate.service";
import {ReadTranslateJsonService} from "../../service/language/readTranslateJson.service";
@Component({
selector: 'app-home',
@@ -25,6 +29,9 @@ export class ManagementComponent implements OnInit {
locations: LocationEntity[] | undefined;
waypoints: WaypointsEntity[] | undefined;
users: UserEntity[] | undefined;
translations: managementTranslations = {} as managementTranslations
protected readonly String = String;
constructor(
@@ -32,10 +39,13 @@ export class ManagementComponent implements OnInit {
private locationService: LocationService,
private waypointService: WaypointService,
private userService: UserService,
private translateService: TranslateService,
private readTranslationJsonService: ReadTranslateJsonService,
) {
}
ngOnInit(): void {
this.translations = this.readTranslationJsonService.getManagementTranslations();
this.locationService.getLocations().subscribe(locations => {
this.locations = locations;
});
@@ -103,4 +113,28 @@ export class ManagementComponent implements OnInit {
closeWaypointForm() {
this.showWaypointForm = false;
}
async switchLanguage(lang: string) {
this.translations.users = await this.translateService.getData(this.translations.users, lang);
this.translations.locations = await this.translateService.getData(this.translations.locations, lang);
this.translations.waypoints = await this.translateService.getData(this.translations.waypoints, lang);
this.translations.name = await this.translateService.getData(this.translations.name, lang);
this.translations.username = await this.translateService.getData(this.translations.username, lang);
this.translations.password = await this.translateService.getData(this.translations.password, lang);
this.translations.location = await this.translateService.getData(this.translations.location, lang);
this.translations.region = await this.translateService.getData(this.translations.region, lang);
this.translations.lat = await this.translateService.getData(this.translations.lat, lang);
this.translations.lon = await this.translateService.getData(this.translations.lon, lang);
this.translations.description = await this.translateService.getData(this.translations.description, lang);
this.translations.locationName = await this.translateService.getData(this.translations.locationName, lang);
this.translations.image = await this.translateService.getData(this.translations.image, lang);
this.translations.translate = await this.translateService.getData(this.translations.translate, lang);
this.translations.addLocationButton = await this.translateService.getData(this.translations.addLocationButton, lang);
this.translations.addUserButton = await this.translateService.getData(this.translations.addUserButton, lang);
this.translations.addWaypointButton = await this.translateService.getData(this.translations.addWaypointButton, lang);
this.translations.add = await this.translateService.getData(this.translations.add, lang);
this.translations.close = await this.translateService.getData(this.translations.close, lang);
}
protected readonly String = String;
}