有人可以帮我吗?我想通过跟随父类的每种语言(英语,法语,高棉语)来呈现细节。我在构造函数中将变量初始化为英语。我尝试按照每种语言显示现有文档,但它仍然没有看到我的代码!
初始化变量
this.events.subscribe('renderViewLang-' + this.documentId, (lang: any) => {
this.currentViewlanguage = lang;
setTimeout(() => {
this.buildContentAsHTML();
}, 1000);
});
显示首次加载
public ionViewDidLoad() {
console.log('ionViewDidLoad DetailTabContentPage[' + this.documentId + ']');
this.alertService.showLoading();
this.docSRV.getDocument(this.documentId, 1)
.subscribe((data: any) => {
this.docContentDTO = data;
setTimeout(() => {
if(this.currentViewlanguage === 'en'){
if(this.docContentDTO !== null) {
this.currentViewlanguage = 'en';
this.buildContentAsHTML();
}
} else if (this.currentViewlanguage === 'fr') {
if(this.docContentDTO !== null) {
this.currentViewlanguage = 'fr';
this.buildContentAsHTML();
}
} else if (this.currentViewlanguage === 'kh') {
if(this.docContentDTO != null) {
this.currentViewlanguage = 'kh';
this.buildContentAsHTML();
}
}
}, 1000);
},
error => {
this.alertService.showError(error);
},
() => { // complete
this.alertService.dismissLoading();
});
}