Module: PagesCore::Admin::LocalesHelper

Included in:
AdminHelper, LocalizedFormBuilder
Defined in:
app/helpers/pages_core/admin/locales_helper.rb

Instance Method Summary collapse

Instance Method Details

#locale_direction(locale) ⇒ Object



13
14
15
# File 'app/helpers/pages_core/admin/locales_helper.rb', line 13

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

#locales_with_dirObject



6
7
8
9
10
11
# File 'app/helpers/pages_core/admin/locales_helper.rb', line 6

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

#rtl_locale?(locale) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/helpers/pages_core/admin/locales_helper.rb', line 17

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

#rtl_localesObject



21
22
23
# File 'app/helpers/pages_core/admin/locales_helper.rb', line 21

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