Simplify setting the options in language selector

This commit is contained in:
Javi Martín
2021-06-30 18:08:37 +02:00
parent 9ccfabcbda
commit 477c67efd8
2 changed files with 7 additions and 4 deletions

View File

@@ -10,4 +10,10 @@ class Layout::LocaleSwitcherComponent < ApplicationComponent
def locales
I18n.available_locales
end
def language_options
locales.map do |locale|
[name_for_locale(locale), current_path_with_query_params(locale: locale), lang: locale]
end
end
end