diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2019-04-08 13:13:19 +0200 |
---|---|---|
committer | Martin Wortschack <mwortschack@gitlab.com> | 2019-04-08 13:13:29 +0200 |
commit | 6a0035d273deffd67506230d3776812e045d59cc (patch) | |
tree | f9b9787d3761fc0456b28a4656453c366a610c20 /app/controllers/profiles | |
parent | 942ce36a72b460f8cac2091008869d845fd365e3 (diff) | |
download | gitlab-ce-6a0035d273deffd67506230d3776812e045d59cc.tar.gz |
Externalize strings in flash messagesmw-i18n-flashes
- Externalize strings in controllers
- Update PO file
Diffstat (limited to 'app/controllers/profiles')
4 files changed, 12 insertions, 12 deletions
diff --git a/app/controllers/profiles/chat_names_controller.rb b/app/controllers/profiles/chat_names_controller.rb index 2e78b9e6dc7..80b8279e91e 100644 --- a/app/controllers/profiles/chat_names_controller.rb +++ b/app/controllers/profiles/chat_names_controller.rb @@ -15,9 +15,9 @@ class Profiles::ChatNamesController < Profiles::ApplicationController new_chat_name = current_user.chat_names.new(chat_name_params) if new_chat_name.save - flash[:notice] = "Authorized #{new_chat_name.chat_name}" + flash[:notice] = _("Authorized %{new_chat_name}") % { new_chat_name: new_chat_name.chat_name } else - flash[:alert] = "Could not authorize chat nickname. Try again!" + flash[:alert] = _("Could not authorize chat nickname. Try again!") end delete_chat_name_token @@ -27,7 +27,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController def deny delete_chat_name_token - flash[:notice] = "Denied authorization of chat nickname #{chat_name_params[:user_name]}." + flash[:notice] = _("Denied authorization of chat nickname %{user_name}.") % { user_name: chat_name_params[:user_name] } redirect_to profile_chat_names_path end @@ -36,9 +36,9 @@ class Profiles::ChatNamesController < Profiles::ApplicationController @chat_name = chat_names.find(params[:id]) if @chat_name.destroy - flash[:notice] = "Deleted chat nickname: #{@chat_name.chat_name}!" + flash[:notice] = _("Deleted chat nickname: %{chat_name}!") % { chat_name: @chat_name.chat_name } else - flash[:alert] = "Could not delete chat nickname #{@chat_name.chat_name}." + flash[:alert] = _("Could not delete chat nickname %{chat_name}.") % { chat_name: @chat_name.chat_name } end redirect_to profile_chat_names_path, status: :found diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index 4b6ec2697b7..213d900a563 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -11,7 +11,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController if @personal_access_token.save PersonalAccessToken.redis_store!(current_user.id, @personal_access_token.token) - redirect_to profile_personal_access_tokens_path, notice: "Your new personal access token has been created." + redirect_to profile_personal_access_tokens_path, notice: _("Your new personal access token has been created.") else set_index_vars render :index @@ -22,9 +22,9 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController @personal_access_token = finder.find(params[:id]) if @personal_access_token.revoke! - flash[:notice] = "Revoked personal access token #{@personal_access_token.name}!" + flash[:notice] = _("Revoked personal access token %{personal_access_token_name}!") % { personal_access_token_name: @personal_access_token.name } else - flash[:alert] = "Could not revoke personal access token #{@personal_access_token.name}." + flash[:alert] = _("Could not revoke personal access token %{personal_access_token_name}.") % { personal_access_token_name: @personal_access_token.name } end redirect_to profile_personal_access_tokens_path diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 0227af2c266..0e30df1b15b 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -11,13 +11,13 @@ class Profiles::PreferencesController < Profiles::ApplicationController result = Users::UpdateService.new(current_user, preferences_params.merge(user: user)).execute if result[:status] == :success - flash[:notice] = 'Preferences saved.' + flash[:notice] = _('Preferences saved.') else - flash[:alert] = 'Failed to save preferences.' + flash[:alert] = _('Failed to save preferences.') end rescue ArgumentError => e # Raised when `dashboard` is given an invalid value. - flash[:alert] = "Failed to save preferences (#{e.message})." + flash[:alert] = _("Failed to save preferences (%{error_message}).") % { error_message: e.message } end respond_to do |format| diff --git a/app/controllers/profiles/u2f_registrations_controller.rb b/app/controllers/profiles/u2f_registrations_controller.rb index e6a154fb6aa..866c4dee6e2 100644 --- a/app/controllers/profiles/u2f_registrations_controller.rb +++ b/app/controllers/profiles/u2f_registrations_controller.rb @@ -4,6 +4,6 @@ class Profiles::U2fRegistrationsController < Profiles::ApplicationController def destroy u2f_registration = current_user.u2f_registrations.find(params[:id]) u2f_registration.destroy - redirect_to profile_two_factor_auth_path, status: 302, notice: "Successfully deleted U2F device." + redirect_to profile_two_factor_auth_path, status: 302, notice: _("Successfully deleted U2F device.") end end |