ngx-joyride icon indicating copy to clipboard operation
ngx-joyride copied to clipboard

Not working with ngx-translate

Open iCodr8 opened this issue 6 years ago • 6 comments
trafficstars

We are using the ngx-translate module to translate all contents of the angular app. The problem is, that it is not working with the title and text attributes of ngx-joyride.

To Reproduce

<div joyrideStep="dashboardStatistics"
         [title]="'TOUR.DASHBOARD_STATISTICS.TITLE' | translate"
         [text]="'TOUR.DASHBOARD_STATISTICS.TEXT' | translate">
    ... more content ...
</div>

Expected behavior The translated text should be visible in the tour window.

Screenshots Bildschirmfoto 2019-09-20 um 15 05 01

Details:

  • Browser chrome 76
  • @angular/core 7.2.15
  • ngx-joyride 2.2.10
  • ngx-translate 11.0.1

iCodr8 avatar Sep 20 '19 13:09 iCodr8

I was/am using it like [title]="TOUR.DASHBOARD_STATISTICS.TITLE"

rtcimi avatar Sep 26 '19 08:09 rtcimi

No, that's not working. I want the translated string and not the translation key.

iCodr8 avatar Oct 07 '19 17:10 iCodr8

I'm using ngx-translate too and I can't reproduce your error

shifenis avatar Oct 08 '19 14:10 shifenis

I think it is a timing problem. Sometimes it will be shown, but the most time not.

iCodr8 avatar Oct 17 '19 21:10 iCodr8

I have found the problem! Joyride is not working with observables or async operations. The translation is loaded after some milliseconds and joyride uses the empty value before. When I am adding an if condition than it is working, because joyrideStep will be initialized only after the if-condition is true (translation loaded).

But this is a bad solution. Can this be fixed by joyride please?

<div *ngIf="'TOUR.DASHBOARD_STATISTICS.TITLE' | translate"
         joyrideStep="dashboardStatistics"
         [title]="'TOUR.DASHBOARD_STATISTICS.TITLE' | translate"
         [text]="'TOUR.DASHBOARD_STATISTICS.TEXT' | translate">
    ... more content ...
</div>

iCodr8 avatar Oct 17 '19 21:10 iCodr8

Hi @iCodr8 ,

I've tried but I'm not able to reproduce your bug. Could you please reproduce it on a small app?

tnicola avatar Mar 14 '20 16:03 tnicola