Search code examples
angularngx-translate

ngx-translate - Angular Version 11


export function TranslationLoaderFactory(http: HttpClient): any {
  return new TranslateHttpLoader(http, '/assets/i18n/');
  }

Works fine on local env, however receiving not found error for en.json during runtime in builds.


Solution

  • Try changing '/assets/i18n/' to './assets/i18n/'.

    I believe your build might not be putting your assets directly under /assets. One thing you can do is build locally and check if everything is built according to your expectation.