From bd0b4f1117cfec841351f50fc6ccba5dda96036d Mon Sep 17 00:00:00 2001 From: Monica Mateiu Date: Wed, 6 Oct 2021 16:53:58 +0100 Subject: [PATCH] Tokenize settings menu and add French translations (#14905) * tokenize settings menu and add French translations * add quotes around tokens * add tokens in alphabetical order Co-authored-by: Ben Halpern --- app/controllers/users_controller.rb | 2 +- app/lib/constants/settings.rb | 13 ------------- app/lib/settings.rb | 13 +++++++++++++ app/views/users/edit.html.erb | 4 ++-- config/locales/en.yml | 8 ++++++++ config/locales/fr.yml | 8 ++++++++ spec/requests/user/user_settings_spec.rb | 2 +- 7 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 app/lib/constants/settings.rb create mode 100644 app/lib/settings.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0123c94dd..df47576e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -267,7 +267,7 @@ class UsersController < ApplicationController handle_integrations_tab handle_response_templates_tab else - not_found unless @tab.in?(Constants::Settings::TAB_LIST.map { |t| t.downcase.tr(" ", "-") }) + not_found unless @tab.in?(Settings.tab_list.map { |t| t.downcase.tr(" ", "-") }) end end diff --git a/app/lib/constants/settings.rb b/app/lib/constants/settings.rb deleted file mode 100644 index 3e8dda9bf..000000000 --- a/app/lib/constants/settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Constants - module Settings - TAB_LIST = %w[ - Profile - Customization - Notifications - Account - Billing - Organization - Extensions - ].freeze - end -end diff --git a/app/lib/settings.rb b/app/lib/settings.rb new file mode 100644 index 000000000..39b6e273b --- /dev/null +++ b/app/lib/settings.rb @@ -0,0 +1,13 @@ +module Settings + def self.tab_list + [ + I18n.t("settings_menu.profile"), + I18n.t("settings_menu.customization"), + I18n.t("settings_menu.notifications"), + I18n.t("settings_menu.account"), + I18n.t("settings_menu.billing"), + I18n.t("settings_menu.organization"), + I18n.t("settings_menu.extensions"), + ] + end +end diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index b261e9181..17c67a4b2 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -44,7 +44,7 @@