question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single PWA with i18n

See original GitHub issue

Which @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:open
  • Created 2 years ago
  • Reactions:50
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Kamshakcommented, Jan 18, 2022

@Kamshak Thank you for pointing that out, I had no idea that this loadTranslations function exists. I guess I have to try out whether the performance is still alright. At least it keeps the PWA size smaller. Have you ever worked with that approach?

Have a PWA in production with this, it’s working great so far

1reaction
petebacondarwincommented, Oct 21, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable installation of the multi language Angular PWA ...
I would like my application to be installed once as PWA and provide both language versions using a (single?) service worker. Unfortunately all...
Read more >
Angular PWA Internationalization
Internationalization, sometimes referenced as i18n, is the process of designing and preparing your project for use in different locales ...
Read more >
Part Two — Using the i18next library | by Leejjon
Supporting multiple languages in a PWA — Part Two — Using the i18next library. You can find the first part of this post...
Read more >
Internationalization - Adobe Developer
The i18n feature in PWA Studio is an implementation of the react-intl library. The LocaleProvider component in PWA Studio wraps around the ...
Read more >
Concept - Intershop Progressive Web App - Localization
In addition to using pluralization for specific numbers, the Intershop PWA supports the following pluralization cases: zero , one , two ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found