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.15 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.36 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.14 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.35 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.13 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.34 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.12 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.33 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.11 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.10 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.32 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.9 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.31 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.8 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.30 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.7 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.29 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.6 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.4.28 app/helpers/workarea/storefront/locales_helper.rb
workarea-storefront-3.5.5 app/helpers/workarea/storefront/locales_helper.rb