Skip to content

TranslateLoader API

The loader is responsible for providing translations to your application. It can deliver either embedded translations or load them from a server.

export abstract class TranslateLoader {
abstract getTranslation(lang: string): Observable<any>;
}

The getTranslation() method receives the language code as input and needs to return an Observable that resolves to a translation object.

{
"app.hello": "Hello World!"
}

There are several loaders already available as plugins. So in most cases, you’ll not need to create your own. See Installation on how to use the default loader @ngx-translate/http-loader.

You might also find 3rd party loaders in the plugins section.

For detailed examples and step-by-step instructions on building and registering custom loaders, see Write & use your own loader.

You can configure ngx-translate with a loader that loads translation files at runtime.

Imprint Privacy