After encountering the same issue, I discovered that constantly loading and unloading stylesheets can cause a jarring effect as the page refreshes. It's more efficient to target rtl and ltr rather than individual languages or define a variable in scss based on language.
Instead, consider adding a class to your head, body, pages, or components that signifies the language. Then, build queries for rtl languages using these constants. In my case, I only needed this functionality for a custom button-bar component, which was easily achieved by:
Global Singleton Service (Liveservice)
// Value can be "rtl" or "ltr"
public rtlClass: string;
Component Structure
<top-button-bar>
<div [ngClass]="liveService.options.rtlClass">
<ion-button>this will always be centered</ion-button>
<ion-segment>
<ion-segment-button>1</ion-segment-button>
<ion-segment-button>2</ion-segment-button>
<ion-segment-button>3</ion-segment-button>
</ion-segment>
</div>
</top-button-bar>
The intended layout is:
ltr: ___B123
rtl: 321B___
SCSS Styling:
top-button-bar {
.ltr {
// SCSS code for ltr layout here
}
.rtl {
// SCSS code for rtl layout here
}
}