Sha256: 423d7aa84e790960ea30dde5227b10cf72d544e15a081d5aebc8b9eae0c3fbb8

Contents?: true

Size: 334 Bytes

Versions: 4

Compression:

Stored size: 334 Bytes

Contents

# frozen_string_literal: true
require 'i18n/backend/fallbacks'

module Agave
  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

4 entries across 4 versions & 1 rubygems

Version Path
agave-client-0.1.3 lib/agave/utils/locale_value.rb
agave-client-0.1.2 lib/agave/utils/locale_value.rb
agave-client-0.1.1 lib/agave/utils/locale_value.rb
agave-client-0.1.0 lib/agave/utils/locale_value.rb