Sha256: eefd3c142b3f7d6a022160e500c641fd888b05c022d486d2bfa11933c8139d8e
Contents?: true
Size: 803 Bytes
Versions: 7
Compression:
Stored size: 803 Bytes
Contents
module Georgia module InternationalizationHelper def available_locales I18n.available_locales end def link_to_locale html_options={} if available_locales.length == 2 link_to_locale_single html_options else link_to_locale_list html_options end end protected def link_to_locale_list html_options content_tag :ul, html_options do available_locales.each do |lang| concat(content_tag(:li, link_to(t('locale_name', locale: lang), url_for(params.merge(locale: lang))))) end end end def link_to_locale_single html_options lang = (available_locales - [current_locale]).first link_to t('locale_name', locale: lang), url_for(params.merge(locale: lang)), html_options end end end
Version data entries
7 entries across 7 versions & 1 rubygems