Sha256: 47107b58deea2ae05406464362deefa56b087c847ee9211a38e2933d646a7b2d

Contents?: true

Size: 546 Bytes

Versions: 8

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module Localizable
    def all_locales
      result_set = case self
                   when Bridgetown::Resource::Base
                     collection.resources
                   when Bridgetown::GeneratedPage
                     site.generated_pages
                   else
                     []
                   end

      result_set.select { |item| item.data.slug == data.slug }.sort_by do |item|
        site.config.available_locales.index item.data.locale
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bridgetown-core-1.2.0.beta4 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.2.0.beta3 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.2.0.beta2 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.2.0.beta1 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.1.0 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.1.0.beta3 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.1.0.beta2 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.1.0.beta1 lib/bridgetown-core/concerns/localizable.rb