From 2f54ec4e18d20a0d3a36e8e192389819b57d8dc3 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 15 May 2021 22:36:10 -0700 Subject: [PATCH] Fix locale consistency for err template redirects --- locales/ar.json | 5 +++- locales/bn_BD.json | 5 +++- locales/cs.json | 5 +++- locales/da.json | 5 +++- locales/de.json | 5 +++- locales/el.json | 5 +++- locales/eo.json | 5 +++- locales/es.json | 5 +++- locales/eu.json | 5 +++- locales/fa.json | 5 +++- locales/fi.json | 5 +++- locales/fr.json | 5 +++- locales/he.json | 5 +++- locales/hr.json | 5 +++- locales/hu-HU.json | 5 +++- locales/id.json | 5 +++- locales/is.json | 5 +++- locales/it.json | 5 +++- locales/ja.json | 5 +++- locales/nb-NO.json | 5 +++- locales/nl.json | 5 +++- locales/pl.json | 5 +++- locales/pt-BR.json | 5 +++- locales/pt-PT.json | 5 +++- locales/ro.json | 5 +++- locales/ru.json | 5 +++- locales/si.json | 5 +++- locales/sk.json | 5 +++- locales/sr.json | 5 +++- locales/sr_Cyrl.json | 5 +++- locales/sv-SE.json | 5 +++- locales/tr.json | 5 +++- locales/uk.json | 5 +++- locales/zh-CN.json | 5 +++- locales/zh-TW.json | 5 +++- src/invidious/helpers/errors.cr | 50 ++++++++++++++++----------------- 36 files changed, 164 insertions(+), 61 deletions(-) diff --git a/locales/ar.json b/locales/ar.json index 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 file diff --git a/locales/bn_BD.json b/locales/bn_BD.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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 file diff --git a/locales/pl.json b/locales/pl.json index 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.json index 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.json index 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.json index 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 file diff --git a/locales/ru.json b/locales/ru.json index 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 file diff --git a/locales/si.json b/locales/si.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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.json index 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 file diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 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.json index 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.cr index 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::A error_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") + 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") - 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 -

#{next_steps_text}

- - END_HTML - - return next_step_html + return <<-END_HTML +

#{next_steps_text}

+ + END_HTML + + return next_step_html else return "" end -end \ No newline at end of file +end