每个人我都有关于ngx翻译的问题。当我用“离子服务”检查翻译时,一切正常。但是,当我运行“ ionic cordova构建浏览器”并上传到服务器时,它会生成
"GET http://xxxxx.xxxxxxxx.xxxx/assets/i18n/en.json 404 (Not Found)"
http错误响应
"Http failure response for http://xxxxx.xxxxxxxx.xxxx/assets/i18n/en.json: 404 Not Found"
app.modlue.ts
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
我还设置了
translate.setDefaultLang((localStorage.getItem('LANG')) ? localStorage.getItem('LANG') : 'en');
但相同的错误。请帮助我。