Sha256: 57d8c6045e325252275832d1f139b5b281001d73e0bdee6be16aaad7627a7c0a

Contents?: true

Size: 585 Bytes

Versions: 12

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  module Admin
    module LocalesHelper
      def locales_with_dir
        locales = PagesCore.config.locales || {}
        locales.each_with_object({}) do |(key, name), hash|
          hash[key] = { name: name, dir: locale_direction(key) }
        end
      end

      def locale_direction(locale)
        rtl_locale?(locale) ? "rtl" : "ltr"
      end

      def rtl_locale?(locale)
        rtl_locales.include?(locale.to_s)
      end

      def rtl_locales
        %w[ar arc dv fa ha he khw ks ku ps ur yi]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pages_core-3.12.7 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.6 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.5 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.4 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.3 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.2 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.1 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.12.0 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.11.3 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.11.2 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.11.1 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.11.0 app/helpers/pages_core/admin/locales_helper.rb