Title: Support for PWA together with localized app serving all languages on same url · Issue #56910 · angular/angular · GitHub
Open Graph Title: Support for PWA together with localized app serving all languages on same url · Issue #56910 · angular/angular
X Title: Support for PWA together with localized app serving all languages on same url · Issue #56910 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Some use-cases require a localized ng app to have all translated bundles served on the same URL. A prominent example is https://google.co...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Some use-cases require a localized ng app to have all translated bundles served on the same URL. ...
X Description: Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Some use-cases require a localized ng app to have all translated bundles served on the same URL. ...
Opengraph URL: https://github.com/angular/angular/issues/56910
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support for PWA together with localized app serving all languages on same url","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\nservice-worker\r\n\r\n### Description\r\n\r\nSome use-cases require a localized ng app to have all translated bundles served on the same URL. A prominent example is https://google.com which serves all locales on the same url. \r\n\r\nSetting that up with an Angular app is not easy but can be done – although combining it with PWA support seems impossible.\r\n\r\nThis is a wish/request for either **support for a localized PWA serving all locales on the same url** or **documentation for how to implement it**.\r\n\r\n### Background: Serving localized on same url\r\nUsing fx express we can serve the right bundle according to the preferred language. But because of https://github.com/angular/angular-cli/issues/17416, it is required to serve all js-files with language in the url. I do what https://github.com/angular/angular-cli/issues/17416#issuecomment-1158205744 suggests, and serves the index.html at fx. https://server/index.html and the js-files at fx. https://server/{locale}/main.44242342.js. (https://github.com/angular/angular-cli/issues/17416#issuecomment-1158205744 gives more details into how to make it work with routing and all)\r\n\r\nWe have this working quite nicely at https://app.previsto.com serving 5 different languages on the same url and all deep links goes to the same content just with the app language in the user's preferred language.\r\n\r\n### Adding PWA\r\nWe cannot get PWA working though. We have tried to create a very simple app with `ng new` at https://github.com/michaelkrog/i18n-pwa-test. We have then:\r\n* added the localize package (`ng add @angular/localize`)\r\n* added the pwa package (`ng add @angular/pwa`)\r\n* adjusted angular.json to build `en-US` and `da` for production builds\r\n* added an express script for serving both languages (defaults to `en-US`)\r\n\r\nThe app serves fines, the service-worker registers itself, I can see files cached.\r\nBut the files are not served by the service-worker at any time.\r\n\r\n\r\n\u003cimg width=\"1524\" alt=\"Skærmbillede 2024-07-09 kl 11 06 18\" src=\"https://github.com/angular/angular/assets/681472/6b73fc53-1414-4403-9faf-55e19aae0a87\">\r\n\r\n\u003cimg width=\"1087\" alt=\"Skærmbillede 2024-07-09 kl 11 21 46\" src=\"https://github.com/angular/angular/assets/681472/76e87657-1598-46fa-9cda-6f3a56f6ee2a\">\r\n\u003cimg width=\"1497\" alt=\"Skærmbillede 2024-07-09 kl 11 23 55\" src=\"https://github.com/angular/angular/assets/681472/8c2b4527-71dd-4cbd-ac6d-7e5cb76c6cdf\">\r\n\r\n\r\n### Getting the test app running\r\nTo get the test app running, do this:\r\n\r\n1. Check out https://github.com/michaelkrog/i18n-pwa-test\r\n2. `cd i18n-pwa-test`\r\n3. `npm i` and `npm run serve`\r\n\r\n\r\n\r\n\r\n### Proposed solution\r\n\r\nAdd documentation for how to serving multiple locales on the same url while preserving angulars PWA support.\r\n\r\n### Alternatives considered\r\n\r\nngx-translate to ensure just one build - but I prefer to stick with Angulars native i18n.","author":{"url":"https://github.com/michaelkrog","@type":"Person","name":"michaelkrog"},"datePublished":"2024-07-09T09:28:48Z","url":"https://github.com/angular/angular/issues/56910"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:53d32dec-7224-e2a0-2f12-95b808bd402a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C83A:1D20B7:56F489:6D9661:6B010FAB |
| html-safe-nonce | c528dffa7e77569ebcd75a19be3f0a11d2ae5994686cf12294d4498ca36a6835 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODNBOjFEMjBCNzo1NkY0ODk6NkQ5NjYxOjZCMDEwRkFCIiwidmlzaXRvcl9pZCI6IjgwMTE0MTg4NjI4NDk0Mjk0MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6666eba19317ccef97ab51b85ac793e06d59f3f4010345e4656a887a6cff2d84 |
| hovercard-subject-tag | issue:2397654199 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/56910/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4221e4b77a1c113a35e863adf0268b7e6a8b4a47142feb654c4a07b57bb00dcd/angular/angular/issues/56910 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4221e4b77a1c113a35e863adf0268b7e6a8b4a47142feb654c4a07b57bb00dcd/angular/angular/issues/56910 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? service-worker Description Some use-cases require a localized ng app to have all translated bundles served on the same URL. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | michaelkrog |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width