My code:
login.html:
<ion-item class="select-item" *ngIf="languages">
<ion-select cancelText="{{ 'Cancel' | translate }}" (ionChange)="applyLanguage()" [(ngModel)]="selectedLanguage" interface="action-sheet">
<ion-option value= {{item.code}} *ngFor="let item of languages">{{ item.name | translate }} </ion-option>
</ion-select>
</ion-item>
login.ts
ionViewDidLoad() {
this.storage.get('selectedLanguage').then((selectedLanguage) => {
if (selectedLanguage) {
this.selectedLanguage = selectedLanguage;
console.log('lang1',this.selectedLanguage);
} else {
this.selectedLanguage = sysOptions.systemLanguage;
console.log('lang2',this.selectedLanguage);
}
this.translate.use(this.selectedLanguage);
});
}
It’s work when I tap ion-select ( applyLanguage funtion) but before I reload brower and login view reload and ion-option not translate.