Module: LocalesHelper
- Defined in:
- app/helpers/locales_helper.rb
Instance Method Summary collapse
- #formatted_locale(current_locale = I18n.locale) ⇒ Object
- #i18n_helper ⇒ Object
- #i18n_helper_link ⇒ Object
Instance Method Details
#formatted_locale(current_locale = I18n.locale) ⇒ Object
3 4 5 |
# File 'app/helpers/locales_helper.rb', line 3 def formatted_locale current_locale = I18n.locale I18n.t('helpers.links.locale', current_locale: t("languages.#{current_locale}", locale: current_locale)) end |
#i18n_helper ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/locales_helper.rb', line 7 def i18n_helper @i18n_helper = begin [].tap do |locales| I18n.available_locales.each do |locale| locales << [ locale.to_s, I18n.t("languages.#{locale}").capitalize ] end end end end |
#i18n_helper_link ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/locales_helper.rb', line 17 def i18n_helper_link @i18n_helper_link = begin [].tap do |links| i18n_helper.each do |locale, title| links << link_to(title, set_locale_path(locale: locale), method: :post) end end end end |