Sha256: ac0fb37ce606fd7241c12ac6a9e883cd19ca118ddeb2aa4e933c844f29fc8f83

Contents?: true

Size: 663 Bytes

Versions: 7

Compression:

Stored size: 663 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

      matching_resources = result_set.select do |item|
        item.relative_path.parent == relative_path.parent && item.data.slug == data.slug
      end

      matching_resources.sort_by do |item|
        site.config.available_locales.index item.data.locale
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bridgetown-core-1.3.1 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.3.0 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.3.0.beta3 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.3.0.beta2 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.3.0.beta1 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.2.0 lib/bridgetown-core/concerns/localizable.rb
bridgetown-core-1.2.0.beta5 lib/bridgetown-core/concerns/localizable.rb