Fix locale consistency for err template redirects

This commit is contained in:
syeopite 2021-05-15 22:36:10 -07:00
parent b9cd40fe1e
commit 2f54ec4e18
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
36 changed files with 164 additions and 61 deletions

View File

@ -419,5 +419,8 @@
"location": "الاماكن", "location": "الاماكن",
"hdr": "وضع التباين العالي", "hdr": "وضع التباين العالي",
"filter": "معامل الفرز", "filter": "معامل الفرز",
"Current version: ": "الإصدار الحالي: " "Current version: ": "الإصدار الحالي: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -358,5 +358,8 @@
"Videos": "", "Videos": "",
"Playlists": "", "Playlists": "",
"Community": "", "Community": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "umístění", "location": "umístění",
"hdr": "HDR", "hdr": "HDR",
"filter": "filtr", "filter": "filtr",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "Standort", "location": "Standort",
"hdr": "HDR", "hdr": "HDR",
"filter": "Filtern", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "Τρέχουσα έκδοση: " "Current version: ": "Τρέχουσα έκδοση: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "loko", "location": "loko",
"hdr": "granddinamikgama", "hdr": "granddinamikgama",
"filter": "filtri", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "ubicación", "location": "ubicación",
"hdr": "hdr", "hdr": "hdr",
"filter": "filtro", "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": ""
} }

View File

@ -341,5 +341,8 @@
"Videos": "", "Videos": "",
"Playlists": "", "Playlists": "",
"Community": "", "Community": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "نسخه فعلی: " "Current version: ": "نسخه فعلی: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "emplacement", "location": "emplacement",
"hdr": "HDR", "hdr": "HDR",
"filter": "filtrer", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "מיקום", "location": "מיקום",
"hdr": "HDR", "hdr": "HDR",
"filter": "סינון", "filter": "סינון",
"Current version: ": "הגרסה הנוכחית: " "Current version: ": "הגרסה הנוכחית: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "lokacija", "location": "lokacija",
"hdr": "hdr", "hdr": "hdr",
"filter": "filtar", "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": ""
} }

View File

@ -340,5 +340,8 @@
"Videos": "Videók", "Videos": "Videók",
"Playlists": "Lejátszási listák", "Playlists": "Lejátszási listák",
"Community": "Közösség", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "lokasi", "location": "lokasi",
"hdr": "hdr", "hdr": "hdr",
"filter": "saring", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "Posizione", "location": "Posizione",
"hdr": "HDR", "hdr": "HDR",
"filter": "Filtra", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "HDR", "hdr": "HDR",
"filter": "フィルタ", "filter": "フィルタ",
"Current version: ": "現在のバージョン: " "Current version: ": "現在のバージョン: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "sted", "location": "sted",
"hdr": "HDR", "hdr": "HDR",
"filter": "filtrer", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "locatie", "location": "locatie",
"hdr": "HDR", "hdr": "HDR",
"filter": "verfijnen", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "hdr", "hdr": "hdr",
"filter": "filtr", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "localização", "location": "localização",
"hdr": "hdr", "hdr": "hdr",
"filter": "filtro", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "Текущая версия: " "Current version: ": "Текущая версия: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -358,5 +358,8 @@
"Videos": "", "Videos": "",
"Playlists": "", "Playlists": "",
"Community": "", "Community": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -417,5 +417,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "" "Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -341,5 +341,8 @@
"Videos": "", "Videos": "",
"Playlists": "", "Playlists": "",
"Community": "", "Community": "",
"Current version: ": "Тренутна верзија: " "Current version: ": "Тренутна верзија: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "plats", "location": "plats",
"hdr": "hdr", "hdr": "hdr",
"filter": "", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "konum", "location": "konum",
"hdr": "HDR", "hdr": "HDR",
"filter": "filtrele", "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": ""
} }

View File

@ -419,5 +419,8 @@
"location": "", "location": "",
"hdr": "", "hdr": "",
"filter": "", "filter": "",
"Current version: ": "Поточна версія: " "Current version: ": "Поточна версія: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "位置", "location": "位置",
"hdr": "hdr", "hdr": "hdr",
"filter": "过滤器", "filter": "过滤器",
"Current version: ": "当前版本: " "Current version: ": "当前版本: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -419,5 +419,8 @@
"location": "位置", "location": "位置",
"hdr": "HDR", "hdr": "HDR",
"filter": "篩選條件", "filter": "篩選條件",
"Current version: ": "目前版本: " "Current version: ": "目前版本: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
} }

View File

@ -108,34 +108,32 @@ def error_json_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::A
error_json_helper(env, locale, status_code, message, nil) error_json_helper(env, locale, status_code, message, nil)
end 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 request_path = env.request.path
if request_path.starts_with?("/search") || request_path.starts_with?("/watch") || if request_path.starts_with?("/search") || request_path.starts_with?("/watch") ||
request_path.starts_with?("/channel") || request_path.starts_with?("/playlist?list=PL") 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") return <<-END_HTML
refresh = translate(locale, "next_steps_error_message_refresh") <p style="margin-bottom: 4px;">#{next_steps_text}</p>
go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube") <ul>
switch_instance = translate(locale, "Switch Invidious Instance") <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
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
else else
return "" return ""
end end