Module: Lit::LocalizationsHelper
- Included in:
- LocalizationKeysHelper
- Defined in:
- app/helpers/lit/localizations_helper.rb
Instance Method Summary collapse
- #allow_wysiwyg_editor?(key) ⇒ Boolean
- #available_locales_with_default_first ⇒ Object
- #draw_icon(icon, opts = {}) ⇒ Object
- #ejs(val) ⇒ Object
- #locale_flag(locale) ⇒ Object
Instance Method Details
#allow_wysiwyg_editor?(key) ⇒ Boolean
21 22 23 |
# File 'app/helpers/lit/localizations_helper.rb', line 21 def allow_wysiwyg_editor?(key) Lit.all_translations_are_html_safe || key.to_s =~ /(\b|_|\.)html$/ end |
#available_locales_with_default_first ⇒ Object
25 26 27 |
# File 'app/helpers/lit/localizations_helper.rb', line 25 def available_locales_with_default_first I18n.available_locales.sort_by { |l| l == I18n.default_locale ? 0 : 1 } end |
#draw_icon(icon, opts = {}) ⇒ Object
3 4 5 6 |
# File 'app/helpers/lit/localizations_helper.rb', line 3 def draw_icon(icon, opts = {}) raw "<i class=\"fa fa-#{icon} #{opts[:class]}\" " \ "title=\"#{opts[:title]}\" ></i>" end |
#ejs(val) ⇒ Object
8 9 10 |
# File 'app/helpers/lit/localizations_helper.rb', line 8 def ejs(val) escape_javascript val.to_s end |
#locale_flag(locale) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/helpers/lit/localizations_helper.rb', line 12 def locale_flag locale locale = locale.to_s.upcase[0,2] locale = case locale when 'EN' then 'GB' else locale end locale.tr('A-Z', "\u{1F1E6}-\u{1F1FF}") end |