Ionic 4.0.0 can't change the DIR dynamically as before with platfrom.sitDir('rtl') in ionic 3

With Ionic v4.0.0 I can’t change the direction from LTR to RTL by using platform.sitDir('rtl') as before in ionic 3!!

I have searched a lot and didn’t find a replacement for platform.sitDir('rtl') from ionic 4 docs!! or even instructions for RTL support!

I actually have done something with the following code document.documentElement.setAttribute('dir', 'rtl') as an experiment it works but with a lot of issues too like the sidemenu position still on the left side not on the right! as it should.

I’m building a multi-language app ( English, Arabic ) so this a real pain for me!

I’m facing this same issue. Hope we find something ASAP.

I facing the same Issues.

I am stuck in one styeschee css. i would like to have one for arabic and one for English. different font and so on.

Any news here? For now, I’m saving the dir to a variable and set it on app.component.html. that requires a reload when changing and creates a very bad user experience.

I have same issue with the menu. is there any work around for it?

Hello try this:

1-

 constructor(
    @Inject(DOCUMENT) private document: Document,
  ) {}

2-

if (language === 'ar') {
      this.document.documentElement.dir = 'rtl';
    } else {
      this.document.documentElement.dir = 'ltr';
    }
1 Like

This works like charm! Thanks for saving my hours!