Fix translation with non-existent locales

pull/267/head
Omar Roth 2018-12-20 16:59:46 -06:00
rodzic 0feb414a1d
commit 7596baf03b
1 zmienionych plików z 1 dodań i 5 usunięć

Wyświetl plik

@ -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