Replaces locales helper which returns an array by another which returns select options
This commit is contained in:
@@ -14,7 +14,13 @@ module ApplicationHelper
|
|||||||
home_page? ? '' : 'results'
|
home_page? ? '' : 'results'
|
||||||
end
|
end
|
||||||
|
|
||||||
def available_locales_to_switch
|
def available_locale_options_for_select
|
||||||
I18n.available_locales - [I18n.locale]
|
options_for_select(available_locales_array, I18n.locale)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def available_locales_array
|
||||||
|
I18n.available_locales.map { |loc| [I18n.t('locale', locale: loc), loc] }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user