change path

This commit is contained in:
2023-04-29 12:31:22 +02:00
parent 4fb1254728
commit 5e1062593a
3 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {homeTranslations} from "../../interface/translations";
import {listTranslations} from "../../interface/translations";
@Injectable({
providedIn: 'root'
})
export class ReadTranslateJsonService {
private homeTranslations: homeTranslations = {} as homeTranslations; // declares a private object to hold the home translations
private listTranslation: listTranslations = {} as listTranslations; // declares a private object to hold the list translations
constructor(private http: HttpClient) {
// loads the home translations from the assets file for the English language
this.http.get<homeTranslations>('assets/i18n/home/en.json').subscribe(data => {
this.homeTranslations.alertMessage = data.alertMessage;
this.homeTranslations.translate = data.translate;
this.homeTranslations.searchButton = data.searchButton;
this.homeTranslations.searchPlaceholder = data.searchPlaceholder;
this.homeTranslations.menuPlaces = data.menuPlaces;
console.log("data loaded", this.homeTranslations)
});
// loads the list translations from the assets file for the English language
this.http.get<listTranslations>('assets/i18n/list/en.json').subscribe(data => {
this.listTranslation.translate = data.translate;
this.listTranslation.distance = data.distance;
this.listTranslation.locationName = data.locationName;
this.listTranslation.positionNotFoundErrorMessage = data.positionNotFoundErrorMessage;
console.log("data loaded", this.homeTranslations)
});
}
// returns the home translations object
getHomeTranslations(): homeTranslations {
return this.homeTranslations;
}
// returns the list translations object
getListTransaltions(): listTranslations {
return this.listTranslation;
}
}