Sha256: 4f5a4b75053984bcc91dda49f5299dafb82fef6ceb1501883950dd838595dd76

Contents?: true

Size: 580 Bytes

Versions: 7

Compression:

Stored size: 580 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:, 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

7 entries across 7 versions & 1 rubygems

Version Path
pages_core-3.15.5 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.15.4 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.15.3 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.15.2 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.15.1 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.14.0 app/helpers/pages_core/admin/locales_helper.rb
pages_core-3.13.0 app/helpers/pages_core/admin/locales_helper.rb