import { TranslateService } from '@ngx-translate/core'; constructor(private translateService: TranslateService) { } ngOnInit() { this.translateService.use('en'); // set the default language to English this.translateService.get('GREETING').subscribe((greeting: string) => { console.log(greeting); // Output: 'Hello!' }); }
this.translateService.get('WELCOME_MSG', { username: 'John' }).subscribe((msg: string) => { console.log(msg); // Output: 'Welcome, John!' });
this.translateService.get('ITEMS_SELECTED', { count: 2 }).subscribe((msg: string) => { console.log(msg); // Output: '2 items selected' });In conclusion, the package library is @ngx-translate/core.