added translation in management page
This commit is contained in:
@@ -7,6 +7,9 @@ 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',
|
||||
@@ -27,16 +30,21 @@ export class ManagementComponent implements OnInit {
|
||||
waypoints: WaypointsEntity[] | undefined;
|
||||
users: UserEntity[] | undefined;
|
||||
|
||||
translations: managementTranslations = {} as managementTranslations
|
||||
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
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;
|
||||
});
|
||||
@@ -96,5 +104,27 @@ export class ManagementComponent implements OnInit {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user