Module: Georgia::InternationalizationHelper
- Defined in:
- app/helpers/georgia/internationalization_helper.rb
Instance Method Summary collapse
- #available_locales ⇒ Object
- #link_to_available_locales ⇒ Object
- #link_to_locale(html_options = {}) ⇒ Object
Instance Method Details
#available_locales ⇒ Object
4 5 6 |
# File 'app/helpers/georgia/internationalization_helper.rb', line 4 def available_locales I18n.available_locales end |
#link_to_available_locales ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/georgia/internationalization_helper.rb', line 16 def link_to_available_locales return unless I18n.available_locales.any? links = I18n.available_locales.map do |locale| content_tag(:li, link_to(t("georgia.#{locale}"), locale: locale )) end content_tag(:p, class: 'hint') do content_tag(:div, class: 'dropdown') do link_to("Change language <span class='caret'></span>".html_safe, '#', class: 'btn btn-warning', data: {toggle: 'dropdown'}, role: :button) + content_tag(:ul, links.join('').html_safe, class: 'dropdown-menu', role: 'menu') end end end |
#link_to_locale(html_options = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/helpers/georgia/internationalization_helper.rb', line 8 def link_to_locale ={} if available_locales.length == 2 link_to_locale_single else link_to_locale_list end end |