I'm using Angular material component and ngx-translate.
On a same page using natif select work correctly, but when you tried to use mat-select it doesn't work.
if you have on the same page 1 natif select and 1 mat-select, switch the language with the mat-select will update the natif select value, but text stay at the original lang.
## Expected behavior
Change the Language of the text
Bellow the html code, only 2 select (1 natif and 1 with Angular material)
<div>
<h2>{{ 'HOME.TITLE' | translate }}</h2>
</div>
<mat-select #langSelect class="text_uppercase" [(value)]="translate.currentLang" (selectionChange)="translate.use(langSelect.value)">
<mat-option class="text_uppercase" *ngFor="let lang of translate.getLangs()" [value]="lang" [selected]="lang === translate.currentLang">
{{ lang }}
</mat-option>
</mat-select>
<br>
<select #langSelect2 (change)="translate.use(langSelect2.value)">
<option *ngFor="let lang of translate.getLangs()" [value]="lang" [selected]="lang === translate.currentLang">{{ lang }}</option>
</select>
and the TS
```
export class myComponent {
constructor(
public translate: TranslateService) {
translate.addLangs(['fr', 'en']);
let browserLang = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
}
ngOnInit() {
}
public switchLanguage(lang: string) {
console.log('UPDATE');
this.translate.use(lang);
}
}
```
method switchLanguage is correcty called.
When you select on option with the mat-select, natif select is correctly but the text is not translate.
When you select on option with the natif select, mat-select is correctly and the text is translate.
"@ngx-translate/core": "^10.0.2",
"@angular/material": "^6.3.2",
"@angular/animations": "^6.0.3",
"@angular/cdk": "^6.3.2",
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [x] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Others:
Mac OSX Mojave
+1
Most helpful comment
+1