Sha256: 4c251c93ce15873ba002552f83d7ed32ad9babdb7c2130126fc0a51cf77b4947

Contents?: true

Size: 334 Bytes

Versions: 26

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

26 entries across 26 versions & 1 rubygems

Version Path
dato-0.6.16 lib/dato/utils/locale_value.rb
dato-0.6.15 lib/dato/utils/locale_value.rb
dato-0.6.14 lib/dato/utils/locale_value.rb
dato-0.6.12 lib/dato/utils/locale_value.rb
dato-0.6.11 lib/dato/utils/locale_value.rb
dato-0.6.10 lib/dato/utils/locale_value.rb