Sha256: 21b2f5cf9090f92a3b8770895b3863fb1fe2cf01baa5bfdf78097dc1efb26b61

Contents?: true

Size: 334 Bytes

Versions: 3

Compression:

Stored size: 334 Bytes

Contents

# frozen_string_literal: true

require "i18n/backend/fallbacks"

module Dato
  module Utils
    module LocaleValue
      def self.find(obj)
        locale_with_value = I18n.fallbacks[I18n.locale]
                                .find { |locale| obj[locale] }

        obj[locale_with_value || I18n.locale]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.8.3 lib/dato/utils/locale_value.rb
dato-0.8.2 lib/dato/utils/locale_value.rb
dato-0.8.1 lib/dato/utils/locale_value.rb