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": "الاماكن",
"hdr": "وضع التباين العالي",
"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": "",
"Playlists": "",
"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í",
"hdr": "HDR",
"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": "",
"hdr": "",
"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",
"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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

View File

@ -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": ""
}

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)
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")
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
<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 <<-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
return next_step_html
else
return ""
end