diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5d65f3..f40a4ac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,4 +2,8 @@ module ApplicationHelper def format_utc(time, format: :default) l(time.utc, format: format) end + + def available_locales_collection + I18n.available_locales.map { |k| [t("shared.locales.#{k}"), k]} + end end diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 367c124..8207e04 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -24,7 +24,7 @@ <%= f.input :password_confirmation, autocomplete: "off" %> - <%= f.input :locale, label: t('.locale'), collection: I18n.available_locales, selected: resource.locale %> + <%= f.input :locale, label: t('.locale'), collection: available_locales_collection, selected: resource.locale %> <%= f.input :notifications_enabled %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 0c5150d..a7de793 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -9,7 +9,7 @@ <%= f.input :password_confirmation, autocomplete: "off" %> - <%= f.input :locale, label: t('.locale'), collection: I18n.available_locales, selected: I18n.default_locale %> + <%= f.input :locale, label: t('.locale'), collection: available_locales_collection, selected: I18n.default_locale %> <%= f.input :tos_accepted, label: t('.tos_acceptance_html') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 805fee2..d2c4c13 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -40,6 +40,9 @@ en: shared: + locales: + en: English + fr: French navbar: sign_up: "Sign up" sign_in: "Sign in" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 87ba44c..007f979 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -40,6 +40,9 @@ fr: shared: + locales: + en: Anglais + fr: Français navbar: sign_up: "Enregistrement" sign_in: "Connexion"