diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b2bf3cef3..415e34232 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -40,9 +40,21 @@ import { PortalModule } from '@angular/cdk/portal'; /** Main Routing Module */ import { AppRoutingModule } from './app-routing.module'; import { DatePipe, LocationStrategy } from '@angular/common'; -import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { + TranslateLoader, + TranslateModule, + MissingTranslationHandler, + MissingTranslationHandlerParams +} from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; +export class CustomMissingTranslationHandler implements MissingTranslationHandler { + handle(params: MissingTranslationHandlerParams): string { + // Remove the 'labels.catalogs.' prefix and return the fallback value + return params.key.replace('labels.catalogs.', ''); + } +} + /** * App Module * @@ -66,7 +78,8 @@ export function HttpLoaderFactory(http: HttpClient) { HttpBackend, LocationStrategy ] - } + }, + missingTranslationHandler: { provide: MissingTranslationHandler, useClass: CustomMissingTranslationHandler } }), BrowserModule, BrowserAnimationsModule, diff --git a/src/app/clients/clients-view/address-tab/address-tab.component.ts b/src/app/clients/clients-view/address-tab/address-tab.component.ts index 441750600..a8ed42fa9 100644 --- a/src/app/clients/clients-view/address-tab/address-tab.component.ts +++ b/src/app/clients/clients-view/address-tab/address-tab.component.ts @@ -156,7 +156,7 @@ export class AddressTabComponent { for (let index = 0; index < this.clientAddressTemplate.addressTypeIdOptions.length; index++) { this.clientAddressTemplate.addressTypeIdOptions[index].name = this.translateService.instant( - `${this.clientAddressTemplate.addressTypeIdOptions[index].name}` + `labels.catalogs.${this.clientAddressTemplate.addressTypeIdOptions[index].name}` ); }