lib/grape/exceptions/base.rb in grape-1.7.1 vs lib/grape/exceptions/base.rb in grape-1.8.0
- old
+ new
@@ -71,14 +71,14 @@
def translate(key, **options)
options = options.dup
options[:default] &&= options[:default].to_s
message = ::I18n.translate(key, **options)
- message.present? ? message : fallback_message(key, **options)
+ message.presence || fallback_message(key, **options)
end
def fallback_message(key, **options)
- if ::I18n.enforce_available_locales && !::I18n.available_locales.include?(FALLBACK_LOCALE)
+ if ::I18n.enforce_available_locales && ::I18n.available_locales.exclude?(FALLBACK_LOCALE)
key
else
::I18n.translate(key, locale: FALLBACK_LOCALE, **options)
end
end