Added Translations
This commit is contained in:
27
src/app/service/readTranslateJsonService.ts
Normal file
27
src/app/service/readTranslateJsonService.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {translations} from "../interface/translations";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ReadTranslateJsonService {
|
||||
private translationData: translations = {} as translations;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
this.http.get<translations>('assets/i18n/en.json').subscribe(data => {
|
||||
this.translationData.alertMessage = data.alertMessage;
|
||||
this.translationData.translate = data.translate;
|
||||
this.translationData.searchButton = data.searchButton;
|
||||
this.translationData.searchPlaceholder = data.searchPlaceholder;
|
||||
this.translationData.menuPlaces = data.menuPlaces;
|
||||
this.translationData.menuNear = data.menuNear;
|
||||
console.log("data loaded", this.translationData)
|
||||
});
|
||||
}
|
||||
|
||||
getData(): translations {
|
||||
console.log("data loaded", this.translationData)
|
||||
return this.translationData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user