[PR #817] [MERGED] fix(web-push): re-init i18n on each sw message #1435

Closed
opened 2026-05-07 01:02:05 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/817
Author: @nihalgonsalves
Created: 7/10/2023
Status: Merged
Merged: 7/11/2023
Merged by: @binwiederhier

Base: mainHead: ng/fix-web-push-i18n


📝 Commits (2)

  • c7f85e6 fix(web-push): re-init i18n on each sw message
  • 86cc3b9 chore(build): bump Dockerfile-build go version

📊 Changes

4 files changed (+33 additions, -25 deletions)

View changed files

📝 Dockerfile-build (+1 -1)
📝 web/public/sw.js (+12 -7)
📝 web/src/app/i18n.js (+17 -16)
📝 web/src/components/App.jsx (+3 -1)

📄 Description

It looks like the context that Safari runs the service worker in does not have the global i18n initialisation. This changes the push handler to get a new i18n TFunction when handling each message.

Before:

iOS screenshot with a notification showing i18n key instead of actual text

After:

iOS screenshot with a notification showing actual translated text


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/817 **Author:** [@nihalgonsalves](https://github.com/nihalgonsalves) **Created:** 7/10/2023 **Status:** ✅ Merged **Merged:** 7/11/2023 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `ng/fix-web-push-i18n` --- ### 📝 Commits (2) - [`c7f85e6`](https://github.com/binwiederhier/ntfy/commit/c7f85e6283f359f4bc24dada08e116d0ac0615f3) fix(web-push): re-init i18n on each sw message - [`86cc3b9`](https://github.com/binwiederhier/ntfy/commit/86cc3b9607717b6108d180478281d29322db02d8) chore(build): bump Dockerfile-build go version ### 📊 Changes **4 files changed** (+33 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile-build` (+1 -1) 📝 `web/public/sw.js` (+12 -7) 📝 `web/src/app/i18n.js` (+17 -16) 📝 `web/src/components/App.jsx` (+3 -1) </details> ### 📄 Description It looks like the context that Safari runs the service worker in does not have the global i18n initialisation. This changes the push handler to get a new i18n TFunction when handling each message. Before: ![iOS screenshot with a notification showing i18n key instead of actual text](https://github.com/binwiederhier/ntfy/assets/10807310/484df628-5c42-44df-b561-498e905ecbd4) After: ![iOS screenshot with a notification showing actual translated text](https://github.com/binwiederhier/ntfy/assets/10807310/a52d628a-806c-4f8a-b7a0-f81ec6ffbec7) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:02:05 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1435
No description provided.