Skip to content

Instantly share code, notes, and snippets.

@ppowstanski
Last active March 7, 2022 17:33
Show Gist options
  • Select an option

  • Save ppowstanski/078e4118734aaff97d9572720b49939f to your computer and use it in GitHub Desktop.

Select an option

Save ppowstanski/078e4118734aaff97d9572720b49939f to your computer and use it in GitHub Desktop.
import {HttpClient} from "@angular/common/http";
import {TranslateLoader} from "@ngx-translate/core";
import {Observable} from 'rxjs';
export class TranslateHttpLoader implements TranslateLoader {
constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {}
/**
* Gets the translations from the server
*/
public getTranslation(lang: string): Observable<Object> {
return this.http.get(`${this.prefix}${lang}${this.suffix}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment