lib/dato/local/site.rb in dato-0.3.17 vs lib/dato/local/site.rb in dato-0.3.18
- old
+ new
@@ -1,9 +1,10 @@
# frozen_string_literal: true
require 'forwardable'
require 'active_support/inflector/transliterate'
require 'active_support/hash_with_indifferent_access'
+require 'dato/utils/locale_value'
module Dato
module Local
class Site
extend Forwardable
@@ -54,13 +55,10 @@
def read_attribute(method, type_klass, localized)
value = if localized
obj = entity.send(method) || {}
- locale_with_value = I18n.fallbacks[I18n.locale]
- .find { |locale| obj[locale] }
-
- obj[locale_with_value || I18n.locale]
+ Utils::LocaleValue.find(obj)
else
entity.send(method)
end
type_klass.parse(value, @items_repo)