Invidious is an alternative front-end to YouTube
Fix locale consistency for err template redirects
syeopite2f54ec4e18d2
diff --git a/locales/ar.json b/locales/ar.jsonindex b12c4cb8..bc0c6830 100644--- a/locales/ar.json+++ b/locales/ar.json@@ -419,5 +419,8 @@"location": "الاماكن","hdr": "وضع التباين العالي","filter": "معامل الفرز",- "Current version: ": "الإصدار الحالي: "+ "Current version: ": "الإصدار الحالي: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}\ No newline at end of filediff --git a/locales/bn_BD.json b/locales/bn_BD.jsonindex 9de526d5..83bd6555 100644--- a/locales/bn_BD.json+++ b/locales/bn_BD.json@@ -358,5 +358,8 @@"Videos": "","Playlists": "","Community": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/cs.json b/locales/cs.jsonindex 3d59466a..c8320a07 100644--- a/locales/cs.json+++ b/locales/cs.json@@ -419,5 +419,8 @@"location": "umístění","hdr": "HDR","filter": "filtr",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/da.json b/locales/da.jsonindex 03b176f4..d207939c 100644--- a/locales/da.json+++ b/locales/da.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/de.json b/locales/de.jsonindex 606fbeb5..b602192b 100644--- a/locales/de.json+++ b/locales/de.json@@ -419,5 +419,8 @@"location": "Standort","hdr": "HDR","filter": "Filtern",- "Current version: ": "Aktuelle Version: "+ "Current version: ": "Aktuelle Version: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/el.json b/locales/el.jsonindex 94611e82..f7588c60 100644--- a/locales/el.json+++ b/locales/el.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Τρέχουσα έκδοση: "+ "Current version: ": "Τρέχουσα έκδοση: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/eo.json b/locales/eo.jsonindex 69811006..7ac38c35 100644--- a/locales/eo.json+++ b/locales/eo.json@@ -419,5 +419,8 @@"location": "loko","hdr": "granddinamikgama","filter": "filtri",- "Current version: ": "Nuna versio: "+ "Current version: ": "Nuna versio: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/es.json b/locales/es.jsonindex 25329d40..e160526e 100644--- a/locales/es.json+++ b/locales/es.json@@ -419,5 +419,8 @@"location": "ubicación","hdr": "hdr","filter": "filtro",- "Current version: ": "Versión actual: "+ "Current version: ": "Versión actual: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/eu.json b/locales/eu.jsonindex 426d721f..34820a50 100644--- a/locales/eu.json+++ b/locales/eu.json@@ -341,5 +341,8 @@"Videos": "","Playlists": "","Community": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/fa.json b/locales/fa.jsonindex 6b40af62..611cc57d 100644--- a/locales/fa.json+++ b/locales/fa.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "نسخه فعلی: "+ "Current version: ": "نسخه فعلی: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/fi.json b/locales/fi.jsonindex 24a4ec36..b446332c 100644--- a/locales/fi.json+++ b/locales/fi.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Tämänhetkinen versio: "+ "Current version: ": "Tämänhetkinen versio: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/fr.json b/locales/fr.jsonindex 75cd2be0..4a685d35 100644--- a/locales/fr.json+++ b/locales/fr.json@@ -419,5 +419,8 @@"location": "emplacement","hdr": "HDR","filter": "filtrer",- "Current version: ": "Version actuelle : "+ "Current version: ": "Version actuelle : ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/he.json b/locales/he.jsonindex 368a7e08..d4c70a36 100644--- a/locales/he.json+++ b/locales/he.json@@ -419,5 +419,8 @@"location": "מיקום","hdr": "HDR","filter": "סינון",- "Current version: ": "הגרסה הנוכחית: "+ "Current version: ": "הגרסה הנוכחית: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/hr.json b/locales/hr.jsonindex 5cadab8f..ab9dd54b 100644--- a/locales/hr.json+++ b/locales/hr.json@@ -419,5 +419,8 @@"location": "lokacija","hdr": "hdr","filter": "filtar",- "Current version: ": "Trenutačna verzija: "+ "Current version: ": "Trenutačna verzija: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/hu-HU.json b/locales/hu-HU.jsonindex 5c67b4e7..a0c6c17f 100644--- a/locales/hu-HU.json+++ b/locales/hu-HU.json@@ -340,5 +340,8 @@"Videos": "Videók","Playlists": "Lejátszási listák","Community": "Közösség",- "Current version: ": "Jelenlegi verzió: "+ "Current version: ": "Jelenlegi verzió: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/id.json b/locales/id.jsonindex 0ed116b8..07d252e6 100644--- a/locales/id.json+++ b/locales/id.json@@ -419,5 +419,8 @@"location": "lokasi","hdr": "hdr","filter": "saring",- "Current version: ": "Versi saat ini: "+ "Current version: ": "Versi saat ini: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/is.json b/locales/is.jsonindex d9ec4105..546d67f8 100644--- a/locales/is.json+++ b/locales/is.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Núverandi útgáfa: "+ "Current version: ": "Núverandi útgáfa: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/it.json b/locales/it.jsonindex 4105e83f..1a14f172 100644--- a/locales/it.json+++ b/locales/it.json@@ -419,5 +419,8 @@"location": "Posizione","hdr": "HDR","filter": "Filtra",- "Current version: ": "Versione attuale: "+ "Current version: ": "Versione attuale: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/ja.json b/locales/ja.jsonindex 3c6efb77..7a80955d 100644--- a/locales/ja.json+++ b/locales/ja.json@@ -419,5 +419,8 @@"location": "","hdr": "HDR","filter": "フィルタ",- "Current version: ": "現在のバージョン: "+ "Current version: ": "現在のバージョン: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/nb-NO.json b/locales/nb-NO.jsonindex 4b5eabd0..fec2637f 100644--- a/locales/nb-NO.json+++ b/locales/nb-NO.json@@ -419,5 +419,8 @@"location": "sted","hdr": "HDR","filter": "filtrer",- "Current version: ": "Gjeldende versjon: "+ "Current version: ": "Gjeldende versjon: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/nl.json b/locales/nl.jsonindex 16cdb427..30ddd49f 100644--- a/locales/nl.json+++ b/locales/nl.json@@ -419,5 +419,8 @@"location": "locatie","hdr": "HDR","filter": "verfijnen",- "Current version: ": "Huidige versie: "+ "Current version: ": "Huidige versie: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}\ No newline at end of filediff --git a/locales/pl.json b/locales/pl.jsonindex f8df837c..12177ce6 100644--- a/locales/pl.json+++ b/locales/pl.json@@ -419,5 +419,8 @@"location": "","hdr": "hdr","filter": "filtr",- "Current version: ": "Aktualna wersja: "+ "Current version: ": "Aktualna wersja: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/pt-BR.json b/locales/pt-BR.jsonindex 644aa34d..13f2c65f 100644--- a/locales/pt-BR.json+++ b/locales/pt-BR.json@@ -419,5 +419,8 @@"location": "localização","hdr": "hdr","filter": "filtro",- "Current version: ": "Versão atual: "+ "Current version: ": "Versão atual: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/pt-PT.json b/locales/pt-PT.jsonindex c02ca58e..acc08c65 100644--- a/locales/pt-PT.json+++ b/locales/pt-PT.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Versão atual: "+ "Current version: ": "Versão atual: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/ro.json b/locales/ro.jsonindex 5c984ab5..a1cbb270 100644--- a/locales/ro.json+++ b/locales/ro.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Versiunea actuală: "+ "Current version: ": "Versiunea actuală: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}\ No newline at end of filediff --git a/locales/ru.json b/locales/ru.jsonindex cd29f06a..9381c578 100644--- a/locales/ru.json+++ b/locales/ru.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Текущая версия: "+ "Current version: ": "Текущая версия: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}\ No newline at end of filediff --git a/locales/si.json b/locales/si.jsonindex 23cacc1e..cbc9bdde 100644--- a/locales/si.json+++ b/locales/si.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/sk.json b/locales/sk.jsonindex ed82fae6..9330232e 100644--- a/locales/sk.json+++ b/locales/sk.json@@ -358,5 +358,8 @@"Videos": "","Playlists": "","Community": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/sr.json b/locales/sr.jsonindex 0c64e176..4835e9a3 100644--- a/locales/sr.json+++ b/locales/sr.json@@ -417,5 +417,8 @@"location": "","hdr": "","filter": "",- "Current version: ": ""+ "Current version: ": "",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/sr_Cyrl.json b/locales/sr_Cyrl.jsonindex a76684b4..7ac90fc8 100644--- a/locales/sr_Cyrl.json+++ b/locales/sr_Cyrl.json@@ -341,5 +341,8 @@"Videos": "","Playlists": "","Community": "",- "Current version: ": "Тренутна верзија: "+ "Current version: ": "Тренутна верзија: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/sv-SE.json b/locales/sv-SE.jsonindex fe12f8d1..bc148143 100644--- a/locales/sv-SE.json+++ b/locales/sv-SE.json@@ -419,5 +419,8 @@"location": "plats","hdr": "hdr","filter": "",- "Current version: ": "Nuvarande version: "+ "Current version: ": "Nuvarande version: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/tr.json b/locales/tr.jsonindex ca36023a..6ada31b5 100644--- a/locales/tr.json+++ b/locales/tr.json@@ -419,5 +419,8 @@"location": "konum","hdr": "HDR","filter": "filtrele",- "Current version: ": "Şu anki sürüm: "+ "Current version: ": "Şu anki sürüm: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/uk.json b/locales/uk.jsonindex 9e9239d1..6580bb83 100644--- a/locales/uk.json+++ b/locales/uk.json@@ -419,5 +419,8 @@"location": "","hdr": "","filter": "",- "Current version: ": "Поточна версія: "+ "Current version: ": "Поточна версія: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}\ No newline at end of filediff --git a/locales/zh-CN.json b/locales/zh-CN.jsonindex 7f58d67c..fdd87687 100644--- a/locales/zh-CN.json+++ b/locales/zh-CN.json@@ -419,5 +419,8 @@"location": "位置","hdr": "hdr","filter": "过滤器",- "Current version: ": "当前版本: "+ "Current version: ": "当前版本: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/locales/zh-TW.json b/locales/zh-TW.jsonindex 61a9f118..3a060e63 100644--- a/locales/zh-TW.json+++ b/locales/zh-TW.json@@ -419,5 +419,8 @@"location": "位置","hdr": "HDR","filter": "篩選條件",- "Current version: ": "目前版本: "+ "Current version: ": "目前版本: ",+ "next_steps_error_message": "",+ "next_steps_error_message_refresh": "",+ "next_steps_error_message_go_to_youtube": ""}diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.crindex 714e0670..e1d02563 100644--- a/src/invidious/helpers/errors.cr+++ b/src/invidious/helpers/errors.cr@@ -108,35 +108,33 @@ def error_json_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::Aerror_json_helper(env, locale, status_code, message, nil)end-def error_redirect_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::Any) | Nil)+def error_redirect_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::Any) | Nil)request_path = env.request.path- if request_path.starts_with?("/search") || request_path.starts_with?("/watch") ||- request_path.starts_with?("/channel") || request_path.starts_with?("/playlist?list=PL")-- next_steps_text = translate(locale, "next_steps_error_message")- refresh = translate(locale, "next_steps_error_message_refresh")- go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube")- switch_instance = translate(locale, "Switch Invidious Instance")--- return <<-END_HTML- <p style="margin-bottom: 4px;">#{next_steps_text}</p>- <ul>- <li>- <a href="#{env.request.resource}">#{refresh}</a>- </li>- <li>- <a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>- </li>- <li>- <a href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>- </li>- </ul>- END_HTML-- return next_step_html+ if request_path.starts_with?("/search") || request_path.starts_with?("/watch") ||+ request_path.starts_with?("/channel") || request_path.starts_with?("/playlist?list=PL")+ next_steps_text = translate(locale, "next_steps_error_message")+ refresh = translate(locale, "next_steps_error_message_refresh")+ go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube")+ switch_instance = translate(locale, "Switch Invidious Instance")++ return <<-END_HTML+ <p style="margin-bottom: 4px;">#{next_steps_text}</p>+ <ul>+ <li>+ <a href="#{env.request.resource}">#{refresh}</a>+ </li>+ <li>+ <a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>+ </li>+ <li>+ <a href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>+ </li>+ </ul>+ END_HTML++ return next_step_htmlelsereturn ""end-end\ No newline at end of file+end