Button text of filter menu not getting translated in local language.

UI Components for Angular
Post Reply
Trupti_Kawale
Posts: 1
Joined: 12 Oct 2021, 17:46

12 Oct 2021, 18:19

Button text of filter menu not getting translated in local language

I am using filters in p-table with menu options, button text of menu (Apply and Clear) not getting translated in local language. In Html we do not have access to these button property so not able do customization in angular.

below is code snippet of filter in p-table

HTML:
<th >
<div class="p-d-flex p-jc-between p-ai-center">
{{ 'header.download' | cxTranslate }}
<p-columnFilter field="fileTypeLabel" matchMode="equals" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
<ng-template pTemplate="filter" let-value let-filter="filterCallback">
<p-dropdown [(ngModel)]="dropdownNgmodel" [options]="dsaFileTypeLabel" placeholder="{{ 'dropdownOption.all' | cxTranslate }}"
(onChange)="onFilterChange($event.value)" [optionLabel]="label" styleClass="filter-md" >
<ng-template let-option pTemplate="item">{{option.label}}
</ng-template>
</p-dropdown>
</ng-template>
</p-columnFilter>
</div>
</th>


TS:
constructor(
private translateNgx: TranslateService,
protected languageService: LanguageService, ){
this.languageService.getActive().subscribe((locale) => {
this.translateNgx.use(locale ? locale : 'en');
});


module.js:

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}


export function createRegistrationTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, '../../../assets/i18n-assets/', '/translations.json');
}
@NgModule({
imports: [
CommonModule,
I18nModule,
NgSelectModule,
DatepickerModule,
ErrorMessageModule,
TableModule,
DropdownModule,
ButtonModule,
MultiSelectModule,
InputTextModule,
FormsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createRegistrationTranslateLoader,
deps: [HttpClient]
},
// missingTranslationHandler: {provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler},
isolate: true
}),

],
providers: [
provideDefaultConfig(<CmsConfig>{
cmsComponents: {
FeatureComponent: {
component: FeatureComponent,
},
},
}),
],
declarations: [
FeatureComponent],
exports: [FeatureComponent],
bootstrap: [FeatureComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
]
})
export class FeatureModule {}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests