1

I'm trying to translate the multiselect-dropdown settings, but my function it doesn't work as the other things that I've applied.

Here is my translation function to use in TS:

  getTranslation(toTransalate: string): string {
    let translation;
    this.translateSvc.get(toTransalate).subscribe((response: string) => {
      translation = response;
    }, error => {
      return error;
    });
    return translation;
  }

And Here is what I'm trying to translate:

this.countryDropdownSettings = {
      singleSelection: false,
      idField: 'countryId',
      textField: 'name',
      selectAllText: this.getTranslationSvc.getTranslation('Selecionar tudo'),
      unSelectAllText: this.getTranslationSvc.getTranslation('Limpar'),
      itemsShowLimit: 1,
      allowSearchFilter: true,
      searchPlaceholderText: this.getTranslationSvc.getTranslation('Buscar')
    };

this is what happen when I run this: dropdownUndefined

Thasumi
  • 11
  • 1

1 Answers1

0

Better use:

this.translationSvc.instant('YOUR KEY');