我用这个教程没有翻译
https://ionicframework.com/docs/developer-resources/ng2-translate/
运行的一切,我可以把JSON格式,但不能打印输出
en.json
{
"HELLO": "hola",
"hi":"sa"
}
NGX-转换输出的回报。 ts构造函数;
constructor(public navCtrl: NavController, public navParams: NavParams, public translate: TranslateService) {
translate.setDefaultLang('en');
}
.html block;
<div style="width: 100%;">
<p class="baslik">ACCOUNT</p>
<button ion-item>
<ion-label>{{ 'hi' | translate }}</ion-label>
</button>
<button ion-item>
<ion-label>{{ 'hi' | translate }}</ion-label>
</button>
</div>
但是输出;
喜
喜
当添加按钮点击事件,该代码块;
this.translate.use('en').subscribe(
value => {
// value is our translated string
console.log(value);
}
en.json return log;
我已经添加了教程中的所有代码,但返回的是输出 –
您正在使用哪个角度版本? – Daniomi
4.1.3 ---------------- –