You can use ngx-translate-core for translation (read the doc to install it).
In your component you can try something like this :
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
import { Component } from '@angular/core';
@Component({
selector: 'app-contact',
templateUrl: './contact.component.html'
})
export class YourComponent {
settings: any;
constructor(private translateService: TranslateService) {
// we will set the default lang to 'fr' but this part is generally done
// in your app.component.
this.translateService.setDefaultLang('fr');
this.translateService.use('fr');
// we launch manually a table settings here with the default lang setted
this.initTableSettings();
// listening on the lang changements
this.translateService.onLangChange.subscribe((event: LangChangeEvent) => {
this.translateService.use(event.lang);
// every time the languages will change, we reload the settings
this.initTableSettings();
});
}
initTableSettings(): void {
this.settings = {
actions: {
add: false,
edit: false,
delete: false
},
columns: {
date: {
title: this.translateService.instant('column_date')
},
sent: {
title: this.translateService.instant('column_sent')
},
billed: {
title: this.translateService.instant('column_billed')
}
}
};
}
}
And in your i18n file (fr.json here) :
{
"column_date": "<< your traduction in french here >>",
"column_sent": "<< your traduction in french here >>",
"column_billed": "<< your traduction in french here >>"
}
You can see in the doc how to install and configure the TranslateService of Angular, basically how to import the service in your app module, where to put your i18n files, etc.