Narik Translate Service helps you to add localization to your applications. It uses ngx-translate and extends it on some ways.

To use Narik Translate Service you should register NarikTranslateLoader as translate loader.


      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient, ConfigService]


    export function HttpLoaderFactory(
    http: HttpClient,
    configService: ConfigService
    ) {
        return new NarikTranslateLoader(http, configService, ["app"]);

NarikTranslateLoader load translate files from path that specified in ConfigService ("translationsPath"). For example if "translationsPath" is "assets/i18n" you should have a folder for each language in "assets/i18n".

The third parameter in NarikTranslateLoader's constructor is default translate items. For example in this sample, if defaultLang is "en" the file "assets/i18n/en/app.json" loaded as translate items. Other translate resources will be loaded whenever they will be necessary. They are identified in metadata. The rule for metadata translateItems are the same as default resources.


Default lang also is identified in NarikCore import.

      configFilePath: "assets/app-config.json",
      defaultLang: "en",
      useDefaultLang: true

Last updated