From 7596baf03b7101ef8d0b92e3da5ec571d1f2b69f Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 20 Dec 2018 16:59:46 -0600 Subject: [PATCH] Fix translation with non-existent locales --- src/invidious/helpers/i18n.cr | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index e79004d9..ec44604f 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -3,15 +3,11 @@ def load_locale(name) end def translate(locale : Hash(String, JSON::Any) | Nil, translation : String, text : String | Nil = nil) - if !locale - return translation - end - # if !locale[translation]? # puts "Could not find translation for #{translation}" # end - if locale[translation]? && !locale[translation].as_s.empty? + if locale && locale[translation]? && !locale[translation].as_s.empty? translation = locale[translation].as_s end