Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Remember the selected lanuage

$
0
0

@a7mdFo2ad wrote:

hi
I wanna to make my app remember the selected language even he closed the app and open it again
html

    <ion-item class="settings-items" no-border ion-item>
      <ion-icon class="img-view" item-start name="ios-globe">
      </ion-icon>
      <ion-label [ngClass]="(this.Platform.isRTL ) ? 'settings-textAr': 'settings-text' ">{{'LANG' | translate:param}}</ion-label>
      <ion-select mode="ios" [(ngModel)]="lang" item-end (ionChange)="switchLanguage()">
        <ion-option class="options" value="en">
          {{'ENG' | translate:param}}
        </ion-option>
        <ion-option class="options" value="ar">
          {{'ARAB' | translate:param}}
        </ion-option>
      </ion-select>
    </ion-item>

ts

  switchLanguage() {

    if (this.lang === 'en') {
      
      this.translate.use(this.lang)
      this.Platform.setDir('ltr', true)
    } else {

      
      this.Platform.setDir('rtl', true)
      this.translate.use(this.lang);


    }
  }

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>