Single PWA with i18n
See original GitHub issueWhich @angular/* package(s) are relevant/releated to the feature request?
localize, service-worker
Description
Following up on this post on stackoverflow.
After adding internationalization (i18n
) to our app we run into the big problem of backwards compatibility. Before adding i18n
we had our service worker at the root folder and after adding i18n
we now have a separate service worker for each language we translated the app into. This is a problem because a user that installed the app prior to this change will not correctly get updates because the old service worker will not be able to find the new service worker.
This is the default behavior of Angular and left us with the decision that we either have to tell all our users that they will have to uninstall and re-install the app or add a service worker in the root folder that automatically takes care of the migration and leave it deployed until all users are migrated. Theses solutions are rather unsatisfying, poorly documented and mean that a we would have to go through the same struggle again if we decide to remove the i18n
or take a different approach for it.
Proposed solution
It would be great if Angular would not enforce to use the one-PWA-per-language approach but rather leave this as a choice to the developer. This would make the transition from a single- to a multi-language app much easier and leaves the option open to also go back to the previous approach (no i18n
).
This could be configured through the compiler options in the angular.json
file. E.g. rootServiceWorker: true
.
Alternatives considered
Alternatively, it would be great if Angular provided a guide or a predefined service worker (similar to the safety-worker.js
) that allows a easy migration of the PWAs when i18n
is introduced.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:50
- Comments:12 (4 by maintainers)
Top GitHub Comments
Have a PWA in production with this, it’s working great so far
Hi @TheSlimvReal - sorry not to respond so far on this issue. It is a bit tricky to implement on our side. I need to talk with @gkalpak about how this could work - I am not sure if it is something we would do. I am glad that for the time being you appear to have a workaround.