I all ;)
I'm new to angular and I want to use i18n from angular. But when I want to translate a text from angular class with use of interpolation {{}}, I don't know how to do this.
I have a component toolbar, this toolbar contains a title who change when an event is fired. this Event contain a title to display. But how can I translate this title with i18n ?
I tried with select: {title, select, title1 {my title is 1} title2 {my title is 2} title3 {my title is 3}} But I think is not a great solution
Component class :
@Component({ selector: 'toolbar', templateUrl: './toolbar.component.html', styles: [] }) export class StartComponent implements OnInit { public title : string; constructor(private communicate: CommunicateService) { } ngOnInit() { this.subscription = this.communicate.getTitle().subscribe( title => this.title = title, (err: any) => console.error(err) ); } } Html template :
<div class="toolbar">{{title}}</div> And so, my question is... How can I translate title ? I think there are some other problem like that so all advice is appreciated.
Thanks in advance to help me :)