我有一个角度pwa应用程序使用@ngx-translate/core和@ngx-translate/http-loader的翻译。所以我想知道,如果设备离线,是否有可能让翻译工作。
有没有办法缓存http-loader请求,也许是在ngsw-config.json文件的dataGroup中?
发布于 2019-10-11 23:08:34
如果您遵循标准模式并使用json文件作为区域设置信息,那么您将使用资产组(见下文):
{
"name": "translate",
// Use lazy. You don't want to install unless they use the translation
"installMode": "lazy",
// Use prefetch because you want it to update every time the app updates
"updateMode": "prefetch",
"resources": {
"files": "/assets/i18n/*.json"
}
}请参阅https://christianlydemann.com/how-to-cache-http-requests-in-an-angular-pwa/和https://angular.io/guide/service-worker-config
https://stackoverflow.com/questions/58343811
复制相似问题