From d127183b9774f6321e409acdb66bf8a85d8814be Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 4 Jun 2022 23:54:06 +0800 Subject: [PATCH] feat(PWA): add Service Worker update notification --- _data/locales/en.yml | 4 ++ _data/locales/es-ES.yml | 4 ++ _data/locales/fr-FR.yml | 4 ++ _data/locales/id-ID.yml | 4 ++ _data/locales/ko-KR.yml | 4 ++ _data/locales/my-MM.yml | 4 ++ _data/locales/pt-BR.yml | 4 ++ _data/locales/ru-RU.yml | 4 ++ _data/locales/uk-UA.yml | 4 ++ _data/locales/vi-VN.yml | 4 ++ _data/locales/zh-CN.yml | 4 ++ _layouts/default.html | 15 ++++++ _sass/addon/commons.scss | 45 ++++++++++++++++++ assets/js/pwa/app.js | 57 +++++++++++++++++++++-- assets/js/pwa/sw.js | 98 ++++++++++++++++++++-------------------- 15 files changed, 207 insertions(+), 52 deletions(-) diff --git a/_data/locales/en.yml b/_data/locales/en.yml index c4d5c79..d461f08 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -45,6 +45,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. +notification: + update_found: A new version of content is available. + update: Update + # ----- Posts related labels ----- post: diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml index a1e66ab..ee3a20f 100644 --- a/_data/locales/es-ES.yml +++ b/_data/locales/es-ES.yml @@ -45,6 +45,10 @@ meta: Hecho con :PLATFORM usando el tema :THEME. not_found: statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. +notification: + update_found: Hay una nueva versión de contenido disponible. + update: Actualizar + # ----- Posts related labels ----- post: diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml index 8b3cfb1..0d29a87 100644 --- a/_data/locales/fr-FR.yml +++ b/_data/locales/fr-FR.yml @@ -45,6 +45,10 @@ meta: Propulsé par :PLATFORM avec le thème :THEME not_found: statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. +notification: + update_found: Une nouvelle version du contenu est disponible. + update: Mise à jour + # ----- Posts related labels ----- post: diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml index 5a03406..59ec661 100644 --- a/_data/locales/id-ID.yml +++ b/_data/locales/id-ID.yml @@ -45,6 +45,10 @@ meta: Didukung oleh :PLATFORM dengan tema :THEME. not_found: statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. +notification: + update_found: Versi konten baru tersedia. + update: Perbarui + # ----- Posts related labels ----- post: diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml index 3580f14..2fb9391 100644 --- a/_data/locales/ko-KR.yml +++ b/_data/locales/ko-KR.yml @@ -45,6 +45,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: 해당 URL은 존재하지 않습니다. +notification: + update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. + update: 업데이트 + # ----- Posts related labels ----- post: diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml index 177d7db..9990c76 100644 --- a/_data/locales/my-MM.yml +++ b/_data/locales/my-MM.yml @@ -45,6 +45,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ +notification: + update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ + update: အပ်ဒိတ် + # ----- Posts related labels ----- post: diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml index cec7bf6..59209ae 100644 --- a/_data/locales/pt-BR.yml +++ b/_data/locales/pt-BR.yml @@ -45,6 +45,10 @@ meta: Feito com :PLATFORM usando o tema :THEME. not_found: statment: Desculpe, a página não foi encontrada. +notification: + update_found: Uma nova versão do conteúdo está disponível. + update: atualização + # ----- Posts related labels ----- post: diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml index 5e09211..3cd937c 100644 --- a/_data/locales/ru-RU.yml +++ b/_data/locales/ru-RU.yml @@ -45,6 +45,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Извините, эта ссылка указывает на ресурс который не существует. +notification: + update_found: Доступна новая версия контента. + update: Обновлять + # ----- Posts related labels ----- post: diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml index 566e25b..6925e42 100644 --- a/_data/locales/uk-UA.yml +++ b/_data/locales/uk-UA.yml @@ -45,6 +45,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Вибачте, це посилання вказує на ресурс, що не існує. +notification: + update_found: Доступна нова версія вмісту. + update: Оновлення + # ----- Posts related labels ----- post: diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml index 200baea..592000d 100644 --- a/_data/locales/vi-VN.yml +++ b/_data/locales/vi-VN.yml @@ -43,6 +43,10 @@ meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME. not_found: statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. +notification: + update_found: Đã có phiên bản mới của nội dung. + update: Cập nhật + # ----- Posts related labels ----- post: diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml index cbdaa20..42fcfbc 100644 --- a/_data/locales/zh-CN.yml +++ b/_data/locales/zh-CN.yml @@ -44,6 +44,10 @@ meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。 not_found: statment: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 +notification: + update_found: 发现新版本的内容。 + update: 更新 + # ----- Posts related labels ----- post: diff --git a/_layouts/default.html b/_layouts/default.html index 782c10a..2d34cef 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -48,6 +48,21 @@ layout: compress +
{{ site.data.locales[lang].notification.update_found }}
+ +