Sha256: 5cde88b25bb514d77d659ecb61c86fb177d24ddae7ac62b336e39ee7344f2d13

Contents?: true

Size: 745 Bytes

Versions: 62

Compression:

Stored size: 745 Bytes

Contents

module Workarea
  module Storefront
    module LocalesHelper
      def alternate_locales_tags
        return if I18n.configured_locales.one?

        alternate_locale_urls.reduce('') do |memo, (locale, url)|
          memo << tag(:link, href: url, rel: 'alternate', hreflang: locale)
        end.html_safe
      end

      def alternate_locale_urls
        I18n.configured_locales.reduce({}) do |memo, locale|
          next memo if locale == I18n.locale || locale.blank?

          memo[locale] = if locale == I18n.default_locale
                           url_for(locale: nil)
                         else
                           url_for(locale: locale)
                         end

          memo
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.26 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.45 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.25 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.23 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.44 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.22 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.43 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.21 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.42 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.20 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.41 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.19 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.40 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.18 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.39 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.17 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.38 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.16 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.37 app/helpers/workarea/storefront/locales_helper.rb