0

I am using action sheet and transloco translate plugin in my ionic 5 angular app.

When I use transloco on text the APP is considering as string.

buttons: [{
    text: "{{'channel.edit' | transloco}}",
    icon: 'create-outline',

enter image description here

So what should be the correct way to pass the translated text?

RRV
  • 143
  • 10

1 Answers1

2

Use TranslateService to translate any variables alertTitle;

 constructor(translate: TranslateService) {
    translateService.get('channel.edit').subscribe(
      value => {
        this.alertTitle = value;
      }
    )

then

buttons: [{
    text: this.alertTitle,
    icon: 'create-outline',
Neha Shah
  • 1,147
  • 6
  • 14
  • Thanks @Neha .. In my case I had to use constructor(private translocoService: TranslocoService ) { } this.others_close = this.translocoService.translate('others.close'); – RRV May 13 '20 at 15:17