i18n: pass only the ISO code string to 'translate()'

Don't use the whole Hash everywhere.
Also fall back nicely to english string if no translation exists.
This commit is contained in:
Samantaz Fox
2021-11-08 23:52:55 +01:00
parent 301444563b
commit 139786b9ef
23 changed files with 133 additions and 126 deletions

View File

@@ -2,7 +2,7 @@
module Invidious::Routes::PreferencesRoute
def self.show(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
locale = env.get("preferences").as(Preferences).locale
referer = get_referer(env)
@@ -12,7 +12,7 @@ module Invidious::Routes::PreferencesRoute
end
def self.update(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
locale = env.get("preferences").as(Preferences).locale
referer = get_referer(env)
video_loop = env.params.body["video_loop"]?.try &.as(String)
@@ -227,7 +227,7 @@ module Invidious::Routes::PreferencesRoute
end
def self.toggle_theme(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
locale = env.get("preferences").as(Preferences).locale
referer = get_referer(env, unroll: false)
redirect = env.params.query["redirect"]?