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

@@ -3,7 +3,7 @@
module Invidious::Routes::Misc
def self.home(env)
preferences = env.get("preferences").as(Preferences)
locale = LOCALES[preferences.locale]?
locale = preferences.locale
user = env.get? "user"
case preferences.default_home
@@ -29,12 +29,12 @@ module Invidious::Routes::Misc
end
def self.privacy(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
locale = env.get("preferences").as(Preferences).locale
templated "privacy"
end
def self.licenses(env)
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
locale = env.get("preferences").as(Preferences).locale
rendered "licenses"
end