[英]ngx translate not working on iOS device
I have an ionic 3 project and I want to use ngx translate.我有一个 ionic 3 项目,我想使用 ngx translate。 It works in the browser and the iOS simulator but not on a real device (tested on iPhone SE, iOS 11.1).
它适用于浏览器和 iOS 模拟器,但不适用于真实设备(在 iPhone SE、iOS 11.1 上测试)。
app.module.ts app.module.ts
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpClient, HttpClientModule } from '@angular/common/http';
export function HttpLoaderFactory (http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
@NgModule({
[...],
imports: [
[...]
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (HttpLoaderFactory),
deps: [HttpClient]
}
})
],
[...]
})
export class AppModule { }
My files are here:我的文件在这里:
src/assets/i18n/DE.json源代码/资产/i18n/DE.json
src/assets/i18n/EN.json源代码/资产/i18n/EN.json
I translate it this way:我是这样翻译的:
<ion-title translate>
{{ 'LOGIN.HEADER' | translate }}
</ion-title>
Does someone know why it won't be translated on a device?有人知道为什么它不会在设备上翻译吗?
it might be a bit late, but for those who still experience this issue please do either of the following solutions:可能有点晚了,但对于那些仍然遇到此问题的人,请执行以下任一解决方案:
npm install @ngx-translate/core
& npm install @ngx-translate/http-loader
npm install @ngx-translate/core
和npm install @ngx-translate/http-loader
更新到最新版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.