diff options
Diffstat (limited to 'app')
143 files changed, 300 insertions, 300 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb index 68e14f0c2e5..7d8016f763d 100644 --- a/app/controllers/abuse_reports_controller.rb +++ b/app/controllers/abuse_reports_controller.rb @@ -16,7 +16,7 @@ class AbuseReportsController < ApplicationController if @abuse_report.save @abuse_report.notify - message = "Thank you for your report. A GitLab administrator will look into it shortly." + message = _("Thank you for your report. A GitLab administrator will look into it shortly.") redirect_to @abuse_report.user, notice: message else render :new @@ -37,9 +37,9 @@ class AbuseReportsController < ApplicationController @user = User.find_by(id: params[:user_id]) if @user.nil? - redirect_to root_path, alert: "Cannot create the abuse report. The user has been deleted." + redirect_to root_path, alert: _("Cannot create the abuse report. The user has been deleted.") elsif @user.blocked? - redirect_to @user, alert: "Cannot create the abuse report. This user has been blocked." + redirect_to @user, alert: _("Cannot create the abuse report. This user has been blocked.") end end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb index e3226c86b0b..b53c98ad937 100644 --- a/app/controllers/admin/appearances_controller.rb +++ b/app/controllers/admin/appearances_controller.rb @@ -14,7 +14,7 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance = Appearance.new(appearance_params) if @appearance.save - redirect_to admin_appearances_path, notice: 'Appearance was successfully created.' + redirect_to admin_appearances_path, notice: _('Appearance was successfully created.') else render action: 'show' end @@ -22,7 +22,7 @@ class Admin::AppearancesController < Admin::ApplicationController def update if @appearance.update(appearance_params) - redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.' + redirect_to admin_appearances_path, notice: _('Appearance was successfully updated.') else render action: 'show' end @@ -33,21 +33,21 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance.save - redirect_to admin_appearances_path, notice: 'Logo was successfully removed.' + redirect_to admin_appearances_path, notice: _('Logo was successfully removed.') end def header_logos @appearance.remove_header_logo! @appearance.save - redirect_to admin_appearances_path, notice: 'Header logo was successfully removed.' + redirect_to admin_appearances_path, notice: _('Header logo was successfully removed.') end def favicon @appearance.remove_favicon! @appearance.save - redirect_to admin_appearances_path, notice: 'Favicon was successfully removed.' + redirect_to admin_appearances_path, notice: _('Favicon was successfully removed.') end private diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 8f267eccc8a..daa0d002e7a 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -70,13 +70,13 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController def reset_registration_token @application_setting.reset_runners_registration_token! - flash[:notice] = 'New runners registration token has been generated!' + flash[:notice] = _('New runners registration token has been generated!') redirect_to admin_runners_path end def reset_health_check_token @application_setting.reset_health_check_access_token! - flash[:notice] = 'New health check access token has been generated!' + flash[:notice] = _('New health check access token has been generated!') redirect_back_or_default end @@ -85,7 +85,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController redirect_to( admin_application_settings_path, - notice: 'Started asynchronous removal of all repository check states.' + notice: _('Started asynchronous removal of all repository check states.') ) end diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index 6fc336714b6..3648c8be426 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -34,7 +34,7 @@ class Admin::ApplicationsController < Admin::ApplicationController def update if @application.update(application_params) - redirect_to admin_application_path(@application), notice: 'Application was successfully updated.' + redirect_to admin_application_path(@application), notice: _('Application was successfully updated.') else render :edit end @@ -42,7 +42,7 @@ class Admin::ApplicationsController < Admin::ApplicationController def destroy @application.destroy - redirect_to admin_applications_url, status: 302, notice: 'Application was successfully destroyed.' + redirect_to admin_applications_url, status: 302, notice: _('Application was successfully destroyed.') end private diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index a91d9a534cd..6e5dd1a1f55 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -19,7 +19,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController @broadcast_message = BroadcastMessage.new(broadcast_message_params) if @broadcast_message.save - redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.' + redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully created.') else render :index end @@ -27,7 +27,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController def update if @broadcast_message.update(broadcast_message_params) - redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully updated.' + redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully updated.') else render :edit end diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb index 49ce275ad14..180f7d4c803 100644 --- a/app/controllers/admin/deploy_keys_controller.rb +++ b/app/controllers/admin/deploy_keys_controller.rb @@ -25,7 +25,7 @@ class Admin::DeployKeysController < Admin::ApplicationController def update if deploy_key.update(update_params) - flash[:notice] = 'Deploy key was successfully updated.' + flash[:notice] = _('Deploy key was successfully updated.') redirect_to admin_deploy_keys_path else render 'edit' diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 46e85e1424f..26b88127f24 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -44,7 +44,7 @@ class Admin::GroupsController < Admin::ApplicationController def update if @group.update(group_params) - redirect_to [:admin, @group], notice: 'Group was successfully updated.' + redirect_to [:admin, @group], notice: _('Group was successfully updated.') else render "edit" end @@ -55,7 +55,7 @@ class Admin::GroupsController < Admin::ApplicationController result = Members::CreateService.new(current_user, member_params.merge(limit: -1)).execute(@group) if result[:status] == :success - redirect_to [:admin, @group], notice: 'Users were successfully added.' + redirect_to [:admin, @group], notice: _('Users were successfully added.') else redirect_to [:admin, @group], alert: result[:message] end diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb index d0abdec50ae..51b0f45c5be 100644 --- a/app/controllers/admin/hooks_controller.rb +++ b/app/controllers/admin/hooks_controller.rb @@ -14,7 +14,7 @@ class Admin::HooksController < Admin::ApplicationController @hook = SystemHook.new(hook_params.to_h) if @hook.save - redirect_to admin_hooks_path, notice: 'Hook was successfully created.' + redirect_to admin_hooks_path, notice: _('Hook was successfully created.') else @hooks = SystemHook.all render :index @@ -26,7 +26,7 @@ class Admin::HooksController < Admin::ApplicationController def update if hook.update(hook_params) - flash[:notice] = 'System hook was successfully updated.' + flash[:notice] = _('System hook was successfully updated.') redirect_to admin_hooks_path else render 'edit' diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb index b51c2f678ca..f518f7a657f 100644 --- a/app/controllers/admin/identities_controller.rb +++ b/app/controllers/admin/identities_controller.rb @@ -13,7 +13,7 @@ class Admin::IdentitiesController < Admin::ApplicationController @identity.user_id = user.id if @identity.save - redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully created.' + redirect_to admin_user_identities_path(@user), notice: _('User identity was successfully created.') else render :new end @@ -29,7 +29,7 @@ class Admin::IdentitiesController < Admin::ApplicationController def update if @identity.update(identity_params) RepairLdapBlockedUserService.new(@user).execute - redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.' + redirect_to admin_user_identities_path(@user), notice: _('User identity was successfully updated.') else render :edit end @@ -38,9 +38,9 @@ class Admin::IdentitiesController < Admin::ApplicationController def destroy if @identity.destroy RepairLdapBlockedUserService.new(@user).execute - redirect_to admin_user_identities_path(@user), status: 302, notice: 'User identity was successfully removed.' + redirect_to admin_user_identities_path(@user), status: 302, notice: _('User identity was successfully removed.') else - redirect_to admin_user_identities_path(@user), status: 302, alert: 'Failed to remove user identity.' + redirect_to admin_user_identities_path(@user), status: 302, alert: _('Failed to remove user identity.') end end diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb index 706bcc1e549..dea66c0841b 100644 --- a/app/controllers/admin/impersonation_tokens_controller.rb +++ b/app/controllers/admin/impersonation_tokens_controller.rb @@ -12,7 +12,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController if @impersonation_token.save PersonalAccessToken.redis_store!(current_user.id, @impersonation_token.token) - redirect_to admin_user_impersonation_tokens_path, notice: "A new impersonation token has been created." + redirect_to admin_user_impersonation_tokens_path, notice: _("A new impersonation token has been created.") else set_index_vars render :index diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb index 4e9262ccc96..340eecd7632 100644 --- a/app/controllers/admin/keys_controller.rb +++ b/app/controllers/admin/keys_controller.rb @@ -17,9 +17,9 @@ class Admin::KeysController < Admin::ApplicationController respond_to do |format| if key.destroy - format.html { redirect_to keys_admin_user_path(user), status: 302, notice: 'User key was successfully removed.' } + format.html { redirect_to keys_admin_user_path(user), status: 302, notice: _('User key was successfully removed.') } else - format.html { redirect_to keys_admin_user_path(user), status: 302, alert: 'Failed to remove user key.' } + format.html { redirect_to keys_admin_user_path(user), status: 302, alert: _('Failed to remove user key.') } end end end diff --git a/app/controllers/admin/labels_controller.rb b/app/controllers/admin/labels_controller.rb index aa5eae7a474..ac465c286c2 100644 --- a/app/controllers/admin/labels_controller.rb +++ b/app/controllers/admin/labels_controller.rb @@ -31,7 +31,7 @@ class Admin::LabelsController < Admin::ApplicationController @label = Labels::UpdateService.new(label_params).execute(@label) if @label.valid? - redirect_to admin_labels_path, notice: 'Label was successfully updated.' + redirect_to admin_labels_path, notice: _('Label was successfully updated.') else render :edit end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 550f29a58d2..9d055eb9789 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -50,7 +50,7 @@ class Admin::ProjectsController < Admin::ApplicationController redirect_to( admin_project_path(@project), - notice: 'Repository check was triggered.' + notice: _('Repository check was triggered.') ) end diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 0b6ff491c66..05936bf9fe6 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -34,17 +34,17 @@ class Admin::RunnersController < Admin::ApplicationController def resume if Ci::UpdateRunnerService.new(@runner).update(active: true) - redirect_to admin_runners_path, notice: 'Runner was successfully updated.' + redirect_to admin_runners_path, notice: _('Runner was successfully updated.') else - redirect_to admin_runners_path, alert: 'Runner was not updated.' + redirect_to admin_runners_path, alert: _('Runner was not updated.') end end def pause if Ci::UpdateRunnerService.new(@runner).update(active: false) - redirect_to admin_runners_path, notice: 'Runner was successfully updated.' + redirect_to admin_runners_path, notice: _('Runner was successfully updated.') else - redirect_to admin_runners_path, alert: 'Runner was not updated.' + redirect_to admin_runners_path, alert: _('Runner was not updated.') end end diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb index 18d22c95b61..6cae47ff6c6 100644 --- a/app/controllers/admin/spam_logs_controller.rb +++ b/app/controllers/admin/spam_logs_controller.rb @@ -25,9 +25,9 @@ class Admin::SpamLogsController < Admin::ApplicationController spam_log = SpamLog.find(params[:id]) if HamService.new(spam_log).mark_as_ham! - redirect_to admin_spam_logs_path, notice: 'Spam log successfully submitted as ham.' + redirect_to admin_spam_logs_path, notice: _('Spam log successfully submitted as ham.') else - redirect_to admin_spam_logs_path, alert: 'Error with Akismet. Please check the logs for more info.' + redirect_to admin_spam_logs_path, alert: _('Error with Akismet. Please check the logs for more info.') end end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index e93be1c1ba2..3bd48460375 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -107,7 +107,7 @@ class Admin::UsersController < Admin::ApplicationController respond_to do |format| if @user.persisted? - format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' } + format.html { redirect_to [:admin, @user], notice: _('User was successfully created.') } format.json { render json: @user, status: :created, location: @user } else format.html { render "new" } @@ -136,7 +136,7 @@ class Admin::UsersController < Admin::ApplicationController end if result[:status] == :success - format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' } + format.html { redirect_to [:admin, user], notice: _('User was successfully updated.') } format.json { head :ok } else # restore username to keep form action url. @@ -151,7 +151,7 @@ class Admin::UsersController < Admin::ApplicationController user.delete_async(deleted_by: current_user, params: params.permit(:hard_delete)) respond_to do |format| - format.html { redirect_to admin_users_path, status: 302, notice: "The user is being deleted." } + format.html { redirect_to admin_users_path, status: 302, notice: _("The user is being deleted.") } format.json { head :ok } end end @@ -162,11 +162,11 @@ class Admin::UsersController < Admin::ApplicationController respond_to do |format| if success - format.html { redirect_back_or_admin_user(notice: 'Successfully removed email.') } + format.html { redirect_back_or_admin_user(notice: _('Successfully removed email.')) } format.json { head :ok } else - format.html { redirect_back_or_admin_user(alert: 'There was an error removing the e-mail.') } - format.json { render json: 'There was an error removing the e-mail.', status: :bad_request } + format.html { redirect_back_or_admin_user(alert: _('There was an error removing the e-mail.')) } + format.json { render json: _('There was an error removing the e-mail.'), status: :bad_request } end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 26cd5dc801f..efdc14df244 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -282,7 +282,7 @@ class ApplicationController < ActionController::Base unless Gitlab::Auth::LDAP::Access.allowed?(current_user) sign_out current_user - flash[:alert] = "Access denied for your LDAP account." + flash[:alert] = _("Access denied for your LDAP account.") redirect_to new_user_session_path end end diff --git a/app/controllers/concerns/authenticates_with_two_factor.rb b/app/controllers/concerns/authenticates_with_two_factor.rb index 5507328f8ae..20698ed5273 100644 --- a/app/controllers/concerns/authenticates_with_two_factor.rb +++ b/app/controllers/concerns/authenticates_with_two_factor.rb @@ -66,7 +66,7 @@ module AuthenticatesWithTwoFactor else user.increment_failed_attempts! Gitlab::AppLogger.info("Failed Login: user=#{user.username} ip=#{request.remote_ip} method=OTP") - flash.now[:alert] = 'Invalid two-factor code.' + flash.now[:alert] = _('Invalid two-factor code.') prompt_for_two_factor(user) end end @@ -83,7 +83,7 @@ module AuthenticatesWithTwoFactor else user.increment_failed_attempts! Gitlab::AppLogger.info("Failed Login: user=#{user.username} ip=#{request.remote_ip} method=U2F") - flash.now[:alert] = 'Authentication via U2F device failed.' + flash.now[:alert] = _('Authentication via U2F device failed.') prompt_for_two_factor(user) end end diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index b3777fd2b0f..e8daa03515b 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -60,7 +60,7 @@ module CreatesCommit private def update_flash_notice(success_notice) - flash[:notice] = success_notice || "Your changes have been successfully committed." + flash[:notice] = success_notice || _("Your changes have been successfully committed.") if create_merge_request? if merge_request_exists? diff --git a/app/controllers/concerns/lfs_request.rb b/app/controllers/concerns/lfs_request.rb index 5572c3cee2d..5d7a830f73e 100644 --- a/app/controllers/concerns/lfs_request.rb +++ b/app/controllers/concerns/lfs_request.rb @@ -26,7 +26,7 @@ module LfsRequest render( json: { - message: 'Git LFS is not enabled on this GitLab server, contact your admin.', + message: _('Git LFS is not enabled on this GitLab server, contact your admin.'), documentation_url: help_url }, status: :not_implemented @@ -51,7 +51,7 @@ module LfsRequest def render_lfs_forbidden render( json: { - message: 'Access forbidden. Check your access level.', + message: _('Access forbidden. Check your access level.'), documentation_url: help_url }, content_type: CONTENT_TYPE, @@ -62,7 +62,7 @@ module LfsRequest def render_lfs_not_found render( json: { - message: 'Not found.', + message: _('Not found.'), documentation_url: help_url }, content_type: CONTENT_TYPE, diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb index ca713192c9e..4883ad2c490 100644 --- a/app/controllers/concerns/membership_actions.rb +++ b/app/controllers/concerns/membership_actions.rb @@ -9,7 +9,7 @@ module MembershipActions result = Members::CreateService.new(current_user, create_params).execute(membershipable) if result[:status] == :success - redirect_to members_page_url, notice: 'Users were successfully added.' + redirect_to members_page_url, notice: _('Users were successfully added.') else redirect_to members_page_url, alert: result[:message] end @@ -47,7 +47,7 @@ module MembershipActions membershipable.request_access(current_user) redirect_to polymorphic_path(membershipable), - notice: 'Your request for access has been queued for review.' + notice: _('Your request for access has been queued for review.') end def approve_access_request @@ -88,9 +88,9 @@ module MembershipActions if member.invite? member.resend_invite - redirect_to members_page_url, notice: 'The invitation was successfully resent.' + redirect_to members_page_url, notice: _('The invitation was successfully resent.') else - redirect_to members_page_url, alert: 'The invitation has already been accepted.' + redirect_to members_page_url, alert: _('The invitation has already been accepted.') end end diff --git a/app/controllers/concerns/spammable_actions.rb b/app/controllers/concerns/spammable_actions.rb index c3a1b12af84..3ad958494e6 100644 --- a/app/controllers/concerns/spammable_actions.rb +++ b/app/controllers/concerns/spammable_actions.rb @@ -14,7 +14,7 @@ module SpammableActions if SpamService.new(spammable).mark_as_spam! redirect_to spammable_path, notice: "#{spammable.spammable_entity_type.titlecase} was submitted to Akismet successfully." else - redirect_to spammable_path, alert: 'Error with Akismet. Please check the logs for more info.' + redirect_to spammable_path, alert: _('Error with Akismet. Please check the logs for more info.') end end @@ -33,7 +33,7 @@ module SpammableActions ensure_spam_config_loaded! if params[:recaptcha_verification] - flash[:alert] = 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' + flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.') end respond_to do |format| diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb index 4ec0e94df9a..6487f4d396a 100644 --- a/app/controllers/concerns/uploads_actions.rb +++ b/app/controllers/concerns/uploads_actions.rb @@ -16,7 +16,7 @@ module UploadsActions end else format.json do - render json: 'Invalid file.', status: :unprocessable_entity + render json: _('Invalid file.'), status: :unprocessable_entity end end end diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index 2c4aab67448..2ae500a2fdf 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -22,7 +22,7 @@ class ConfirmationsController < Devise::ConfirmationsController after_sign_in(resource) else Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}") - flash[:notice] = flash[:notice] + " Please sign in." + flash[:notice] = flash[:notice] + _(" Please sign in.") new_session_path(:user, anchor: 'login-pane') end end diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 3fa582cf25b..f173c263474 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -21,7 +21,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController format.html do redirect_to dashboard_todos_path, status: 302, - notice: 'Todo was successfully marked as done.' + notice: _('Todo was successfully marked as done.') end format.js { head :ok } format.json { render json: todos_counts } @@ -32,7 +32,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController updated_ids = TodoService.new.mark_todos_as_done(@todos, current_user) respond_to do |format| - format.html { redirect_to dashboard_todos_path, status: 302, notice: 'All todos were marked as done.' } + format.html { redirect_to dashboard_todos_path, status: 302, notice: _('All todos were marked as done.') } format.js { head :ok } format.json { render json: todos_counts.merge(updated_ids: updated_ids) } end diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index 3ef03bc9622..0c17776b223 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -33,7 +33,7 @@ class GraphqlController < ApplicationController # Overridden from the ApplicationController to make the response look like # a GraphQL response. That is nicely picked up in Graphiql. def render_404 - render_error("Not found!", status: :not_found) + render_error(_("Not found!"), status: :not_found) end def render_error(message, status: 500) diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb index dd8fbf7a029..f8e32451b02 100644 --- a/app/controllers/groups/runners_controller.rb +++ b/app/controllers/groups/runners_controller.rb @@ -16,7 +16,7 @@ class Groups::RunnersController < Groups::ApplicationController def update if Ci::UpdateRunnerService.new(@runner).update(runner_params) - redirect_to group_runner_path(@group, @runner), notice: 'Runner was successfully updated.' + redirect_to group_runner_path(@group, @runner), notice: _('Runner was successfully updated.') else render 'edit' end @@ -30,17 +30,17 @@ class Groups::RunnersController < Groups::ApplicationController def resume if Ci::UpdateRunnerService.new(@runner).update(active: true) - redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), notice: 'Runner was successfully updated.' + redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), notice: _('Runner was successfully updated.') else - redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), alert: 'Runner was not updated.' + redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), alert: _('Runner was not updated.') end end def pause if Ci::UpdateRunnerService.new(@runner).update(active: false) - redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), notice: 'Runner was successfully updated.' + redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), notice: _('Runner was successfully updated.') else - redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), alert: 'Runner was not updated.' + redirect_to group_settings_ci_cd_path(@group, anchor: 'runners-settings'), alert: _('Runner was not updated.') end end diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb index f476f428fdb..6f34041f04b 100644 --- a/app/controllers/groups/settings/ci_cd_controller.rb +++ b/app/controllers/groups/settings/ci_cd_controller.rb @@ -13,7 +13,7 @@ module Groups def reset_registration_token @group.reset_runners_token! - flash[:notice] = 'New runners registration token has been generated!' + flash[:notice] = _('New runners registration token has been generated!') redirect_to group_settings_ci_cd_path end diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index 1b30b4dda36..3ceb51de701 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -62,7 +62,7 @@ class Import::BitbucketController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end end diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index 87338488eba..c7446d272db 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -38,7 +38,7 @@ class Import::BitbucketServerController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end rescue BitbucketServer::Connection::ConnectionError => e render json: { errors: "Unable to connect to server: #{e}" }, status: :unprocessable_entity diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index 5a439e6de78..7972fbac44f 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -29,14 +29,14 @@ class Import::FogbugzController < Import::BaseController user_map = params[:users] unless user_map.is_a?(Hash) && user_map.all? { |k, v| !v[:name].blank? } - flash.now[:alert] = 'All users must have a name.' + flash.now[:alert] = _('All users must have a name.') return render 'new_user_map' end session[:fogbugz_user_map] = user_map - flash[:notice] = 'The user map has been saved. Continue by selecting the projects you want to import.' + flash[:notice] = _('The user map has been saved. Continue by selecting the projects you want to import.') redirect_to status_import_fogbugz_path end diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb index f067ef625aa..cfe5b0d1ef5 100644 --- a/app/controllers/import/gitea_controller.rb +++ b/app/controllers/import/gitea_controller.rb @@ -37,7 +37,7 @@ class Import::GiteaController < Import::GithubController def provider_auth if session[access_token_key].blank? || session[host_key].blank? redirect_to new_import_gitea_url, - alert: 'You need to specify both an Access Token and a Host URL.' + alert: _('You need to specify both an Access Token and a Host URL.') end end diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb index 498de0b07b8..5ec8e9e6fc5 100644 --- a/app/controllers/import/gitlab_controller.rb +++ b/app/controllers/import/gitlab_controller.rb @@ -42,7 +42,7 @@ class Import::GitlabController < Import::BaseController render json: { errors: project_save_error(project) }, status: :unprocessable_entity end else - render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity + render json: { errors: _('This namespace has already been taken! Please choose another one.') }, status: :unprocessable_entity end end diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb index 354fba5d204..d81da0aaf47 100644 --- a/app/controllers/import/gitlab_projects_controller.rb +++ b/app/controllers/import/gitlab_projects_controller.rb @@ -13,7 +13,7 @@ class Import::GitlabProjectsController < Import::BaseController def create unless file_is_valid? - return redirect_back_or_default(options: { alert: "You need to upload a GitLab project export archive (ending in .gz)." }) + return redirect_back_or_default(options: { alert: _("You need to upload a GitLab project export archive (ending in .gz).") }) end @project = ::Projects::GitlabProjectsImportService.new(current_user, project_params).execute diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index 331f06c3dd6..4dddfbcd20d 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -11,18 +11,18 @@ class Import::GoogleCodeController < Import::BaseController dump_file = params[:dump_file] unless dump_file.respond_to?(:read) - return redirect_back_or_default(options: { alert: "You need to upload a Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("You need to upload a Google Takeout archive.") }) end begin dump = JSON.parse(dump_file.read) rescue - return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("The uploaded file is not a valid Google Takeout archive.") }) end client = Gitlab::GoogleCodeImport::Client.new(dump) unless client.valid? - return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." }) + return redirect_back_or_default(options: { alert: _("The uploaded file is not a valid Google Takeout archive.") }) end session[:google_code_dump] = dump @@ -44,13 +44,13 @@ class Import::GoogleCodeController < Import::BaseController begin user_map = JSON.parse(user_map_json) rescue - flash.now[:alert] = "The entered user map is not a valid JSON user map." + flash.now[:alert] = _("The entered user map is not a valid JSON user map.") return render "new_user_map" end unless user_map.is_a?(Hash) && user_map.all? { |k, v| k.is_a?(String) && v.is_a?(String) } - flash.now[:alert] = "The entered user map is not a valid JSON user map." + flash.now[:alert] = _("The entered user map is not a valid JSON user map.") return render "new_user_map" end @@ -62,7 +62,7 @@ class Import::GoogleCodeController < Import::BaseController session[:google_code_user_map] = user_map - flash[:notice] = "The user map has been saved. Continue by selecting the projects you want to import." + flash[:notice] = _("The user map has been saved. Continue by selecting the projects you want to import.") redirect_to status_import_google_code_path end diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 315d1375e02..a0e17091fff 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -15,7 +15,7 @@ class InvitesController < ApplicationController redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}." else - redirect_back_or_default(options: { alert: "The invitation could not be accepted." }) + redirect_back_or_default(options: { alert: _("The invitation could not be accepted.") }) end end @@ -32,7 +32,7 @@ class InvitesController < ApplicationController redirect_to path, notice: "You have declined the invitation to join #{label}." else - redirect_back_or_default(options: { alert: "The invitation could not be declined." }) + redirect_back_or_default(options: { alert: _("The invitation could not be declined.") }) end end diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index 5e872804448..9a5a45939e0 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -26,7 +26,7 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController override :fail_login def fail_login(user) - flash[:alert] = 'Access denied for your LDAP account.' + flash[:alert] = _('Access denied for your LDAP account.') redirect_to new_user_session_path end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index f8e482937d5..65328478ab5 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -162,7 +162,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end def fail_auth0_login - flash[:alert] = 'Wrong extern UID provided. Make sure Auth0 is configured correctly.' + flash[:alert] = _('Wrong extern UID provided. Make sure Auth0 is configured correctly.') redirect_to new_user_session_path end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 2912a22411e..2eff2141ac9 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -22,7 +22,7 @@ class PasswordsController < Devise::PasswordsController ).first_or_initialize unless user.reset_password_period_valid? - flash[:alert] = 'Your password reset token has expired.' + flash[:alert] = _('Your password reset token has expired.') redirect_to(new_user_password_url(user_email: user['email'])) end end @@ -52,7 +52,7 @@ class PasswordsController < Devise::PasswordsController end redirect_to after_sending_reset_password_instructions_path_for(resource_name), - alert: "Password authentication is unavailable." + alert: _("Password authentication is unavailable.") end def throttle_reset diff --git a/app/controllers/profiles/chat_names_controller.rb b/app/controllers/profiles/chat_names_controller.rb index 2e78b9e6dc7..04e2ad6caa3 100644 --- a/app/controllers/profiles/chat_names_controller.rb +++ b/app/controllers/profiles/chat_names_controller.rb @@ -17,7 +17,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController if new_chat_name.save flash[:notice] = "Authorized #{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 diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index 4b6ec2697b7..f5393def6e1 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 diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 37ac11dc6a1..318e2765fa3 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -11,9 +11,9 @@ 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. diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index ba94196b2f9..416ceb1fb11 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -18,7 +18,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController two_factor_authentication_reason( global: lambda do flash.now[:alert] = - 'The global settings require you to enable Two-Factor Authentication for your account.' + _('The global settings require you to enable Two-Factor Authentication for your account.') end, group: lambda do |groups| group_links = groups.map { |group| view_context.link_to group.full_name, group_path(group) }.to_sentence @@ -63,7 +63,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController if @u2f_registration.persisted? session.delete(:challenges) - redirect_to profile_two_factor_auth_path, notice: "Your U2F device was registered!" + redirect_to profile_two_factor_auth_path, notice: _("Your U2F device was registered!") else @qr_code = build_qr_code setup_u2f_registration 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 diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 77672e7d9fc..94ed6b2bfc8 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -29,7 +29,7 @@ class Projects::BlobController < Projects::ApplicationController end def create - create_commit(Files::CreateService, success_notice: "The file has been successfully created.", + create_commit(Files::CreateService, success_notice: _("The file has been successfully created."), success_path: -> { project_blob_path(@project, File.join(@branch_name, @file_path)) }, failure_view: :new, failure_path: project_new_blob_path(@project, @ref)) @@ -81,7 +81,7 @@ class Projects::BlobController < Projects::ApplicationController end def destroy - create_commit(Files::DeleteService, success_notice: "The file has been successfully deleted.", + create_commit(Files::DeleteService, success_notice: _("The file has been successfully deleted."), success_path: -> { after_delete_path }, failure_view: :show, failure_path: project_blob_path(@project, @id)) diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index a6bfb913900..d0c5b349b10 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -114,7 +114,7 @@ class Projects::BranchesController < Projects::ApplicationController DeleteMergedBranchesService.new(@project, current_user).async_execute redirect_to project_branches_path(@project), - notice: 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.' + notice: _('Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.') end private @@ -142,7 +142,7 @@ class Projects::BranchesController < Projects::ApplicationController def redirect_for_legacy_index_sort_or_search # Normalize a legacy URL with redirect if request.format != :json && !params[:state].presence && [:sort, :search, :page].any? { |key| params[key].presence } - redirect_to project_branches_filtered_path(@project, state: 'all'), notice: 'Update your bookmarked URLs as filtered/sorted branches URL has been changed.' + redirect_to project_branches_filtered_path(@project, state: 'all'), notice: _('Update your bookmarked URLs as filtered/sorted branches URL has been changed.') end end diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index 6824a07dc76..514b03e23b5 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -38,7 +38,7 @@ class Projects::DeployKeysController < Projects::ApplicationController def update if deploy_key.update(update_params) - flash[:notice] = 'Deploy key was successfully updated.' + flash[:notice] = _('Deploy key was successfully updated.') redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') else render 'edit' diff --git a/app/controllers/projects/group_links_controller.rb b/app/controllers/projects/group_links_controller.rb index 7c713c19762..fac8d10bc6a 100644 --- a/app/controllers/projects/group_links_controller.rb +++ b/app/controllers/projects/group_links_controller.rb @@ -17,7 +17,7 @@ class Projects::GroupLinksController < Projects::ApplicationController Projects::GroupLinks::CreateService.new(project, current_user, group_link_create_params).execute(group) else - flash[:alert] = 'Please select a group.' + flash[:alert] = _('Please select a group.') end redirect_to project_project_members_path(project) diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index bc84418b79f..5fa0339f44d 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -32,7 +32,7 @@ class Projects::HooksController < Projects::ApplicationController def update if hook.update(hook_params) - flash[:notice] = 'Hook was successfully updated.' + flash[:notice] = _('Hook was successfully updated.') redirect_to project_settings_integrations_path(@project) else render 'edit' diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index 8b33fa85c1e..8ee0bd26daf 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -42,9 +42,9 @@ class Projects::ImportsController < Projects::ApplicationController def finished_notice if @project.forked? - 'The project was successfully forked.' + _('The project was successfully forked.') else - 'The project was successfully imported.' + _('The project was successfully imported.') end end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index e3e60665506..a05f4ecc6b2 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -94,9 +94,9 @@ class Projects::IssuesController < Projects::ApplicationController if service.discussions_to_resolve.count(&:resolved?) > 0 flash[:notice] = if service.discussion_to_resolve_id - "Resolved 1 discussion." + _("Resolved 1 discussion.") else - "Resolved all discussions." + _("Resolved all discussions.") end end @@ -248,7 +248,7 @@ class Projects::IssuesController < Projects::ApplicationController def authenticate_new_issue! return if current_user - notice = "Please sign in to create the new issue." + notice = _("Please sign in to create the new issue.") redirect_to new_user_session_path, notice: notice end diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index d5ce790e2d9..35cc32d3e63 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -122,7 +122,7 @@ class Projects::JobsController < Projects::ApplicationController def erase if @build.erase(erased_by: current_user) redirect_to project_job_path(project, @build), - notice: "Job has been successfully erased!" + notice: _("Job has been successfully erased!") else respond_422 end diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 640038818f2..386a1f00bd2 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -132,7 +132,7 @@ class Projects::LabelsController < Projects::ApplicationController respond_to do |format| format.html do redirect_to(project_labels_path(@project), - notice: 'Failed to promote label due to internal error. Please contact administrators.') + notice: _('Failed to promote label due to internal error. Please contact administrators.')) end format.js end diff --git a/app/controllers/projects/lfs_api_controller.rb b/app/controllers/projects/lfs_api_controller.rb index be40077d389..052e8d85eea 100644 --- a/app/controllers/projects/lfs_api_controller.rb +++ b/app/controllers/projects/lfs_api_controller.rb @@ -19,14 +19,14 @@ class Projects::LfsApiController < Projects::GitHttpClientController elsif upload_request? render json: { objects: upload_objects! } else - raise "Never reached" + raise _("Never reached") end end def deprecated render( json: { - message: 'Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.', + message: _('Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.'), documentation_url: "#{Gitlab.config.gitlab.url}/help" }, status: :not_implemented diff --git a/app/controllers/projects/merge_requests/conflicts_controller.rb b/app/controllers/projects/merge_requests/conflicts_controller.rb index 045a4e974fe..011ac9a42f8 100644 --- a/app/controllers/projects/merge_requests/conflicts_controller.rb +++ b/app/controllers/projects/merge_requests/conflicts_controller.rb @@ -16,12 +16,12 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap render json: @conflicts_list elsif @merge_request.can_be_merged? render json: { - message: 'The merge conflicts for this merge request have already been resolved. Please return to the merge request.', + message: _('The merge conflicts for this merge request have already been resolved. Please return to the merge request.'), type: 'error' } else render json: { - message: 'The merge conflicts for this merge request cannot be resolved through GitLab. Please try to resolve them locally.', + message: _('The merge conflicts for this merge request cannot be resolved through GitLab. Please try to resolve them locally.'), type: 'error' } end @@ -43,7 +43,7 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap return render_404 unless @conflicts_list.can_be_resolved_in_ui? if @merge_request.can_be_merged? - render status: :bad_request, json: { message: 'The merge conflicts for this merge request have already been resolved.' } + render status: :bad_request, json: { message: _('The merge conflicts for this merge request have already been resolved.') } return end @@ -52,7 +52,7 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap .new(merge_request) .execute(current_user, params) - flash[:notice] = 'All merge conflicts were resolved. The merge request can now be merged.' + flash[:notice] = _('All merge conflicts were resolved. The merge request can now be merged.') render json: { redirect_to: project_merge_request_url(@project, @merge_request, resolved_conflicts: true) } rescue Gitlab::Git::Conflict::Resolver::ResolutionError => e diff --git a/app/controllers/projects/mirrors_controller.rb b/app/controllers/projects/mirrors_controller.rb index ab7ab13657a..ef330ae00f4 100644 --- a/app/controllers/projects/mirrors_controller.rb +++ b/app/controllers/projects/mirrors_controller.rb @@ -18,7 +18,7 @@ class Projects::MirrorsController < Projects::ApplicationController result = ::Projects::UpdateService.new(project, current_user, mirror_params).execute if result[:status] == :success - flash[:notice] = 'Mirroring settings were successfully updated.' + flash[:notice] = _('Mirroring settings were successfully updated.') else flash[:alert] = project.errors.full_messages.join(', ').html_safe end @@ -38,7 +38,7 @@ class Projects::MirrorsController < Projects::ApplicationController def update_now if params[:sync_remote] project.update_remote_mirrors - flash[:notice] = "The remote repository is being updated..." + flash[:notice] = _("The remote repository is being updated...") end redirect_to_repository_settings(project, anchor: 'js-push-remote-settings') diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb index acf56f0eb6a..307875e00cc 100644 --- a/app/controllers/projects/pipeline_schedules_controller.rb +++ b/app/controllers/projects/pipeline_schedules_controller.rb @@ -85,7 +85,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController return unless limiter.throttled?([current_user, schedule], 1) - flash[:alert] = 'You cannot play this scheduled pipeline at the moment. Please wait a minute.' + flash[:alert] = _('You cannot play this scheduled pipeline at the moment. Please wait a minute.') redirect_to pipeline_schedules_path(@project) end diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb index 91f40b90aa8..ca62f54813b 100644 --- a/app/controllers/projects/runners_controller.rb +++ b/app/controllers/projects/runners_controller.rb @@ -15,7 +15,7 @@ class Projects::RunnersController < Projects::ApplicationController def update if Ci::UpdateRunnerService.new(@runner).update(runner_params) - redirect_to project_runner_path(@project, @runner), notice: 'Runner was successfully updated.' + redirect_to project_runner_path(@project, @runner), notice: _('Runner was successfully updated.') else render 'edit' end @@ -31,17 +31,17 @@ class Projects::RunnersController < Projects::ApplicationController def resume if Ci::UpdateRunnerService.new(@runner).update(active: true) - redirect_to project_runners_path(@project), notice: 'Runner was successfully updated.' + redirect_to project_runners_path(@project), notice: _('Runner was successfully updated.') else - redirect_to project_runners_path(@project), alert: 'Runner was not updated.' + redirect_to project_runners_path(@project), alert: _('Runner was not updated.') end end def pause if Ci::UpdateRunnerService.new(@runner).update(active: false) - redirect_to project_runners_path(@project), notice: 'Runner was successfully updated.' + redirect_to project_runners_path(@project), notice: _('Runner was successfully updated.') else - redirect_to project_runners_path(@project), alert: 'Runner was not updated.' + redirect_to project_runners_path(@project), alert: _('Runner was not updated.') end end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index f1c9d0d0f77..0e6a5b4be3f 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -43,13 +43,13 @@ class Projects::ServicesController < Projects::ApplicationController if outcome[:success] {} else - { error: true, message: 'Test failed.', service_response: outcome[:result].to_s, test_failed: true } + { error: true, message: _('Test failed.'), service_response: outcome[:result].to_s, test_failed: true } end else - { error: true, message: 'Validations failed.', service_response: @service.errors.full_messages.join(','), test_failed: false } + { error: true, message: _('Validations failed.'), service_response: @service.errors.full_messages.join(','), test_failed: false } end rescue Gitlab::HTTP::BlockedUrlError => e - { error: true, message: 'Test failed.', service_response: e.message, test_failed: true } + { error: true, message: _('Test failed.'), service_response: e.message, test_failed: true } end def success_message diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index 75e590f3f33..4bb4483c6cb 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -39,7 +39,7 @@ module Projects def reset_registration_token @project.reset_runners_token! - flash[:notice] = 'New runners registration token has been generated!' + flash[:notice] = _('New runners registration token has been generated!') redirect_to namespace_project_settings_ci_cd_path end @@ -58,7 +58,7 @@ module Projects return unless service.run_auto_devops_pipeline? if @project.empty_repo? - flash[:warning] = "This repository is currently empty. A new Auto DevOps pipeline will be created after a new file has been pushed to a branch." + flash[:warning] = _("This repository is currently empty. A new Auto DevOps pipeline will be created after a new file has been pushed to a branch.") return end diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 3fe300dcfc0..52feac75723 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -51,7 +51,7 @@ class Projects::TreeController < Projects::ApplicationController def create_dir return render_404 unless @commit_params.values.all? - create_commit(Files::CreateDirService, success_notice: "The directory has been successfully created.", + create_commit(Files::CreateDirService, success_notice: _("The directory has been successfully created."), success_path: project_tree_path(@project, File.join(@branch_name, @dir_name)), failure_path: project_tree_path(@project, @ref)) end diff --git a/app/controllers/projects/triggers_controller.rb b/app/controllers/projects/triggers_controller.rb index f5fdfb8accc..89ed02b470c 100644 --- a/app/controllers/projects/triggers_controller.rb +++ b/app/controllers/projects/triggers_controller.rb @@ -16,9 +16,9 @@ class Projects::TriggersController < Projects::ApplicationController @trigger = project.triggers.create(trigger_params.merge(owner: current_user)) if @trigger.valid? - flash[:notice] = 'Trigger was created successfully.' + flash[:notice] = _('Trigger was created successfully.') else - flash[:alert] = 'You could not create a new trigger.' + flash[:alert] = _('You could not create a new trigger.') end redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers') @@ -26,9 +26,9 @@ class Projects::TriggersController < Projects::ApplicationController def take_ownership if trigger.update(owner: current_user) - flash[:notice] = 'Trigger was re-assigned.' + flash[:notice] = _('Trigger was re-assigned.') else - flash[:alert] = 'You could not take ownership of trigger.' + flash[:alert] = _('You could not take ownership of trigger.') end redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers') @@ -39,7 +39,7 @@ class Projects::TriggersController < Projects::ApplicationController def update if trigger.update(trigger_params) - redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers'), notice: 'Trigger was successfully updated.' + redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers'), notice: _('Trigger was successfully updated.') else render action: "edit" end @@ -47,9 +47,9 @@ class Projects::TriggersController < Projects::ApplicationController def destroy if trigger.destroy - flash[:notice] = "Trigger removed." + flash[:notice] = _("Trigger removed.") else - flash[:alert] = "Could not remove the trigger." + flash[:alert] = _("Could not remove the trigger.") end redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers'), status: :found diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 88dd111132b..4734a49c022 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -49,7 +49,7 @@ class Projects::WikisController < Projects::ApplicationController if @page.valid? redirect_to( project_wiki_path(@project, @page), - notice: 'Wiki was successfully updated.' + notice: _('Wiki was successfully updated.') ) else render 'edit' @@ -65,7 +65,7 @@ class Projects::WikisController < Projects::ApplicationController if @page.persisted? redirect_to( project_wiki_path(@project, @page), - notice: 'Wiki was successfully updated.' + notice: _('Wiki was successfully updated.') ) else render action: "edit" @@ -118,7 +118,7 @@ class Projects::WikisController < Projects::ApplicationController @sidebar_wiki_entries = WikiPage.group_by_directory(@project_wiki.pages(limit: 15)) end rescue ProjectWiki::CouldNotCreateWikiError - flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." + flash[:notice] = _("Could not create Wiki Repository at this time. Please try again later.") redirect_to project_path(@project) false end @@ -155,7 +155,7 @@ class Projects::WikisController < Projects::ApplicationController end def set_encoding_error - flash.now[:notice] = "The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository." + flash.now[:notice] = _("The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.") end def file_blob diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 8b8d87524a8..38101a8549d 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -27,7 +27,7 @@ class RegistrationsController < Devise::RegistrationsController persist_accepted_terms_if_required(new_user) end else - flash[:alert] = 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' + flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.') flash.delete :recaptcha_error render action: 'new' end diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb index 2b76921ebd8..77757c4a3ef 100644 --- a/app/controllers/sent_notifications_controller.rb +++ b/app/controllers/sent_notifications_controller.rb @@ -16,7 +16,7 @@ class SentNotificationsController < ApplicationController noteable = @sent_notification.noteable noteable.unsubscribe(@sent_notification.recipient, @sent_notification.project) - flash[:notice] = "You have been unsubscribed from this thread." + flash[:notice] = _("You have been unsubscribed from this thread.") if current_user redirect_to noteable_path(noteable) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 4bd7d71e264..6943795e8ac 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -70,7 +70,7 @@ class SessionsController < Devise::SessionsController increment_failed_login_captcha_counter self.resource = resource_class.new - flash[:alert] = 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' + flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.') flash.delete :recaptcha_error respond_with_navigational(resource) { render :new } @@ -122,7 +122,7 @@ class SessionsController < Devise::SessionsController end redirect_to edit_user_password_path(reset_password_token: @token), - notice: "Please create a password for your new account." + notice: _("Please create a password for your new account.") end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb index eb03dfe1624..e40f854a019 100644 --- a/app/graphql/mutations/base_mutation.rb +++ b/app/graphql/mutations/base_mutation.rb @@ -4,7 +4,7 @@ module Mutations class BaseMutation < GraphQL::Schema::RelayClassicMutation field :errors, [GraphQL::STRING_TYPE], null: false, - description: "Reasons why the mutation failed." + description: _("Reasons why the mutation failed.") def current_user context[:current_user] diff --git a/app/graphql/mutations/merge_requests/set_wip.rb b/app/graphql/mutations/merge_requests/set_wip.rb index a2aa0c84ee4..7603fe0ab2d 100644 --- a/app/graphql/mutations/merge_requests/set_wip.rb +++ b/app/graphql/mutations/merge_requests/set_wip.rb @@ -8,7 +8,7 @@ module Mutations argument :wip, GraphQL::BOOLEAN_TYPE, required: true, - description: <<~DESC + description: _(<<~DESC) Whether or not to set the merge request as a WIP. DESC diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 23d6684a8e6..5837111dcf8 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -96,7 +96,7 @@ module BlobHelper end def leave_edit_message - "Leave edit mode?\nAll unsaved changes will be lost." + _("Leave edit mode?\nAll unsaved changes will be lost.") end def editing_preview_title(filename) diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 39f661b5f0c..53459db2877 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -181,8 +181,8 @@ module LabelsHelper def label_deletion_confirm_text(label) case label - when GroupLabel then 'Remove this label? This will affect all projects within the group. Are you sure?' - when ProjectLabel then 'Remove this label? Are you sure?' + when GroupLabel then _('Remove this label? This will affect all projects within the group. Are you sure?') + when ProjectLabel then _('Remove this label? Are you sure?') end end diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb index 5038dcf9746..6fc514ed6a6 100644 --- a/app/helpers/page_layout_helper.rb +++ b/app/helpers/page_layout_helper.rb @@ -59,7 +59,7 @@ module PageLayoutHelper # # Raises ArgumentError if given more than two attributes def page_card_attributes(map = {}) - raise ArgumentError, 'cannot provide more than two attributes' if map.length > 2 + raise ArgumentError, _('cannot provide more than two attributes') if map.length > 2 @page_card_attributes ||= {} @page_card_attributes = map.reject { |_, v| v.blank? } if map.present? diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 0ee76a51f7d..32bd96520ca 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -153,7 +153,7 @@ module SearchHelper opts = { id: "filtered-search-#{type}", - placeholder: 'Search or filter results...', + placeholder: _('Search or filter results...'), data: { 'username-params' => UserSerializer.new.represent(@users) }, diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index e2879bfdcf1..eed5d20acba 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -87,12 +87,12 @@ module TreeHelper def edit_in_new_fork_notice_now "You're not allowed to make changes to this project directly." + - " A fork of this project is being created that you can make changes in, so you can submit a merge request." + _(" A fork of this project is being created that you can make changes in, so you can submit a merge request.") end def edit_in_new_fork_notice "You're not allowed to make changes to this project directly." + - " A fork of this project has been created that you can make changes in, so you can submit a merge request." + _(" A fork of this project has been created that you can make changes in, so you can submit a merge request.") end def edit_in_new_fork_notice_action(action) diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index 712f0f808dd..6b68b1237d8 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -42,11 +42,11 @@ module VisibilityLevelHelper def group_visibility_level_description(level) case level when Gitlab::VisibilityLevel::PRIVATE - "The group and its projects can only be viewed by members." + _("The group and its projects can only be viewed by members.") when Gitlab::VisibilityLevel::INTERNAL - "The group and any internal projects can be viewed by any logged in user." + _("The group and any internal projects can be viewed by any logged in user.") when Gitlab::VisibilityLevel::PUBLIC - "The group and any public projects can be viewed without any authentication." + _("The group and any public projects can be viewed without any authentication.") end end @@ -54,14 +54,14 @@ module VisibilityLevelHelper case level when Gitlab::VisibilityLevel::PRIVATE if snippet.is_a? ProjectSnippet - "The snippet is visible only to project members." + _("The snippet is visible only to project members.") else - "The snippet is visible only to me." + _("The snippet is visible only to me.") end when Gitlab::VisibilityLevel::INTERNAL - "The snippet is visible to any logged in user." + _("The snippet is visible to any logged in user.") when Gitlab::VisibilityLevel::PUBLIC - "The snippet can be accessed without any authentication." + _("The snippet can be accessed without any authentication.") end end diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 88746375c67..de854063140 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -135,7 +135,7 @@ class ApplicationSetting < ActiveRecord::Base inclusion: { in: %w(ssh http), allow_blank: true, allow_nil: true } validates :domain_blacklist, - presence: { message: 'Domain blacklist cannot be empty if Blacklist is enabled.' }, + presence: { message: _('Domain blacklist cannot be empty if Blacklist is enabled.') }, if: :domain_blacklist_enabled? validates :housekeeping_incremental_repack_period, diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb index da08214963f..a150cf9e47e 100644 --- a/app/models/ci/build_trace_chunk.rb +++ b/app/models/ci/build_trace_chunk.rb @@ -67,16 +67,16 @@ module Ci end def truncate(offset = 0) - raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0 + raise ArgumentError, _('Offset is out of range') if offset > size || offset < 0 return if offset == size # Skip the following process as it doesn't affect anything self.append("", offset) end def append(new_data, offset) - raise ArgumentError, 'New data is missing' unless new_data - raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0 - raise ArgumentError, 'Chunk size overflow' if CHUNK_SIZE < (offset + new_data.bytesize) + raise ArgumentError, _('New data is missing') unless new_data + raise ArgumentError, _('Offset is out of range') if offset > size || offset < 0 + raise ArgumentError, _('Chunk size overflow') if CHUNK_SIZE < (offset + new_data.bytesize) in_lock(*lock_params) do # Write operation is atomic unsafe_set_data!(data.byteslice(0, offset) + new_data) @@ -115,7 +115,7 @@ module Ci current_data = get_data unless current_data&.bytesize.to_i == CHUNK_SIZE - raise FailedToPersistDataError, 'Data is not fullfilled in a bucket' + raise FailedToPersistDataError, _('Data is not fullfilled in a bucket') end old_store_class = self.class.get_store_class(data_store) @@ -134,7 +134,7 @@ module Ci end def unsafe_set_data!(value) - raise ArgumentError, 'New data size exceeds chunk size' if value.bytesize > CHUNK_SIZE + raise ArgumentError, _('New data size exceeds chunk size') if value.bytesize > CHUNK_SIZE self.class.get_store_class(data_store).set_data(self, value) @data = value diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 11c88200c37..093e9b24fc1 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -153,7 +153,7 @@ module Ci def each_blob(&blk) unless file_format_adapter_class - raise NotSupportedAdapterError, 'This file format requires a dedicated adapter' + raise NotSupportedAdapterError, _('This file format requires a dedicated adapter') end file.open do |stream| diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 5aae31de6e2..554ad5de90b 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -152,7 +152,7 @@ module Ci if instance_type? self.runner_type = :project_type elsif group_type? - raise ArgumentError, 'Transitioning a group runner to a project runner is not supported' + raise ArgumentError, _('Transitioning a group runner to a project runner is not supported') end begin diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index 1cc170c8c4d..68d029ef747 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -153,11 +153,11 @@ module Clusters end def build_kube_client! - raise "Incomplete settings" unless api_url - raise "No namespace" if cluster.project_type? && actual_namespace.empty? # can probably remove this line once we remove #actual_namespace + raise _("Incomplete settings") unless api_url + raise _("No namespace") if cluster.project_type? && actual_namespace.empty? # can probably remove this line once we remove #actual_namespace unless (username && password) || token - raise "Either username/password or token is required to access API" + raise _("Either username/password or token is required to access API") end Gitlab::Kubernetes::KubeClient.new( diff --git a/app/models/commit.rb b/app/models/commit.rb index 01f4c58daa1..bf96db87493 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -117,7 +117,7 @@ class Commit attr_accessor :raw def initialize(raw_commit, project) - raise "Nil as raw commit passed" unless raw_commit + raise _("Nil as raw commit passed") unless raw_commit @raw = raw_commit @project = project diff --git a/app/models/concerns/atomic_internal_id.rb b/app/models/concerns/atomic_internal_id.rb index 4e15b60ccd1..3e6f00f83fd 100644 --- a/app/models/concerns/atomic_internal_id.rb +++ b/app/models/concerns/atomic_internal_id.rb @@ -30,7 +30,7 @@ module AtomicInternalId def has_internal_id(column, scope:, init:, presence: true) # rubocop:disable Naming/PredicateName # We require init here to retain the ability to recalculate in the absence of a # InternaLId record (we may delete records in `internal_ids` for example). - raise "has_internal_id requires a init block, none given." unless init + raise _("has_internal_id requires a init block, none given.") unless init before_validation :"ensure_#{scope}_#{column}!", on: :create validates column, presence: presence diff --git a/app/models/concerns/bulk_member_access_load.rb b/app/models/concerns/bulk_member_access_load.rb index 041ed3755e0..1bff67a149c 100644 --- a/app/models/concerns/bulk_member_access_load.rb +++ b/app/models/concerns/bulk_member_access_load.rb @@ -10,7 +10,7 @@ module BulkMemberAccessLoad # # Returns a Hash mapping resource ID -> maximum access level. def max_member_access_for_resource_ids(resource_klass, resource_ids, memoization_index = self.id, &block) - raise 'Block is mandatory' unless block_given? + raise _('Block is mandatory') unless block_given? resource_ids = resource_ids.uniq key = max_member_access_for_resource_key(resource_klass, memoization_index) diff --git a/app/models/concerns/each_batch.rb b/app/models/concerns/each_batch.rb index 6314b46a7e3..f8f681f3fc9 100644 --- a/app/models/concerns/each_batch.rb +++ b/app/models/concerns/each_batch.rb @@ -50,7 +50,7 @@ module EachBatch def each_batch(of: 1000, column: primary_key, order_hint: nil) unless column raise ArgumentError, - 'the column: argument must be set to a column name to use for ordering rows' + _('the column: argument must be set to a column name to use for ordering rows') end start = except(:select) diff --git a/app/models/concerns/fast_destroy_all.rb b/app/models/concerns/fast_destroy_all.rb index 1e3afd641ed..b43393156fb 100644 --- a/app/models/concerns/fast_destroy_all.rb +++ b/app/models/concerns/fast_destroy_all.rb @@ -34,7 +34,7 @@ module FastDestroyAll included do before_destroy do - raise ForbiddenActionError, '`destroy` and `destroy_all` are forbidden. Please use `fast_destroy_all`' + raise ForbiddenActionError, _('`destroy` and `destroy_all` are forbidden. Please use `fast_destroy_all`') end end diff --git a/app/models/concerns/optionally_search.rb b/app/models/concerns/optionally_search.rb index 4093429e372..dddc3d1144c 100644 --- a/app/models/concerns/optionally_search.rb +++ b/app/models/concerns/optionally_search.rb @@ -7,7 +7,7 @@ module OptionallySearch def search(*) raise( NotImplementedError, - 'Your model must implement the "search" class method' + _('Your model must implement the "search" class method') ) end diff --git a/app/models/concerns/token_authenticatable_strategies/base.rb b/app/models/concerns/token_authenticatable_strategies/base.rb index 01fb194281a..8c5a001fd90 100644 --- a/app/models/concerns/token_authenticatable_strategies/base.rb +++ b/app/models/concerns/token_authenticatable_strategies/base.rb @@ -41,7 +41,7 @@ module TokenAuthenticatableStrategies def fallback? unless options[:fallback].in?([true, false, nil]) - raise ArgumentError, 'fallback: needs to be a boolean value!' + raise ArgumentError, _('fallback: needs to be a boolean value!') end options[:fallback] == true @@ -49,7 +49,7 @@ module TokenAuthenticatableStrategies def migrating? unless options[:migrating].in?([true, false, nil]) - raise ArgumentError, 'migrating: needs to be a boolean value!' + raise ArgumentError, _('migrating: needs to be a boolean value!') end options[:migrating] == true @@ -57,7 +57,7 @@ module TokenAuthenticatableStrategies def self.fabricate(model, field, options) if options[:digest] && options[:encrypted] - raise ArgumentError, 'Incompatible options set!' + raise ArgumentError, _('Incompatible options set!') end if options[:digest] diff --git a/app/models/concerns/token_authenticatable_strategies/encrypted.rb b/app/models/concerns/token_authenticatable_strategies/encrypted.rb index 152491aa6e9..f17ee81812d 100644 --- a/app/models/concerns/token_authenticatable_strategies/encrypted.rb +++ b/app/models/concerns/token_authenticatable_strategies/encrypted.rb @@ -6,7 +6,7 @@ module TokenAuthenticatableStrategies super if migrating? && fallback? - raise ArgumentError, '`fallback` and `migrating` options are not compatible!' + raise ArgumentError, _('`fallback` and `migrating` options are not compatible!') end end @@ -23,7 +23,7 @@ module TokenAuthenticatableStrategies elsif migrating? find_by_plaintext_token(token, unscoped) else - raise ArgumentError, 'Unknown encryption phase!' + raise ArgumentError, _('Unknown encryption phase!') end end @@ -42,7 +42,7 @@ module TokenAuthenticatableStrategies return super if instance.has_attribute?(encrypted_field) if fully_encrypted? - raise ArgumentError, 'Using encrypted strategy when encrypted field is missing!' + raise ArgumentError, _('Using encrypted strategy when encrypted field is missing!') else insecure_strategy.ensure_token(instance) end diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb index e7168d49db9..35ce4ec6bbf 100644 --- a/app/models/internal_id.rb +++ b/app/models/internal_id.rb @@ -102,7 +102,7 @@ class InternalId < ActiveRecord::Base @init = init @usage = usage - raise ArgumentError, 'Scope is not well-defined, need at least one column for scope (given: 0)' if scope.empty? + raise ArgumentError, _('Scope is not well-defined, need at least one column for scope (given: 0)') if scope.empty? unless InternalId.usages.has_key?(usage.to_s) raise ArgumentError, "Usage '#{usage}' is unknown. Supported values are #{InternalId.usages.keys} from InternalId.usages" diff --git a/app/models/label.rb b/app/models/label.rb index 1c3db3eb35d..22727961bca 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -230,7 +230,7 @@ class Label < ActiveRecord::Base end def label_format_reference(format = :id) - raise StandardError, 'Unknown format' unless [:id, :name].include?(format) + raise StandardError, _('Unknown format') unless [:id, :name].include?(format) if format == :name && !name.include?('"') %("#{name}") diff --git a/app/models/milestone.rb b/app/models/milestone.rb index b21edce3aad..7b9274bb7bd 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -291,10 +291,10 @@ class Milestone < ActiveRecord::Base end def milestone_format_reference(format = :iid) - raise ArgumentError, 'Unknown format' unless [:iid, :name].include?(format) + raise ArgumentError, _('Unknown format') unless [:iid, :name].include?(format) if group_milestone? && format == :iid - raise ArgumentError, 'Cannot refer to a group milestone by an internal id!' + raise ArgumentError, _('Cannot refer to a group milestone by an internal id!') end if format == :name && !name.include?('"') diff --git a/app/models/project.rb b/app/models/project.rb index 15465d9b356..c597457f33d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -795,7 +795,7 @@ class Project < ActiveRecord::Base def mark_stuck_remote_mirrors_as_failed! remote_mirrors.stuck.update_all( update_status: :failed, - last_error: 'The remote mirror took to long to complete.', + last_error: _('The remote mirror took to long to complete.'), last_update_at: Time.now ) end @@ -1864,7 +1864,7 @@ class Project < ActiveRecord::Base # # @param [Symbol] feature that needs to be rolled out for the project (:repository, :attachments) def hashed_storage?(feature) - raise ArgumentError, "Invalid feature" unless HASHED_STORAGE_FEATURES.include?(feature) + raise ArgumentError, _("Invalid feature") unless HASHED_STORAGE_FEATURES.include?(feature) self.storage_version && self.storage_version >= HASHED_STORAGE_FEATURES[feature] end @@ -2114,7 +2114,7 @@ class Project < ActiveRecord::Base # already have 1, 2, or n it will fail, but it if you have 0 that is lower # than the number of permitted boards per project it won't fail. def validate_board_limit(board) - raise BoardLimitExceeded, 'Number of permitted boards exceeded' if boards.size >= NUMBER_OF_PERMITTED_BOARDS + raise BoardLimitExceeded, _('Number of permitted boards exceeded') if boards.size >= NUMBER_OF_PERMITTED_BOARDS end def update_project_statistics @@ -2130,7 +2130,7 @@ class Project < ActiveRecord::Base errors.delete(error) end - errors.add(:base, "The project is still being deleted. Please try again later.") + errors.add(:base, _("The project is still being deleted. Please try again later.")) end def pending_delete_twin diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index bc3759142ae..e6c0aa503a4 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -44,7 +44,7 @@ class ProjectGroupLink < ActiveRecord::Base group_ids = project_group.ancestors.map(&:id).push(project_group.id) if group_ids.include?(self.group.id) - errors.add(:base, "Project cannot be shared with the group it is in or one of its ancestors.") + errors.add(:base, _("Project cannot be shared with the group it is in or one of its ancestors.")) end end diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb index cc5f1207653..94286773ea3 100644 --- a/app/models/project_services/asana_service.rb +++ b/app/models/project_services/asana_service.rb @@ -36,7 +36,7 @@ http://app.asana.com/-/account_api' { type: 'text', name: 'api_key', - placeholder: 'User Personal Access Token. User must have access to task, all comments will be attributed to this user.', + placeholder: _('User Personal Access Token. User must have access to task, all comments will be attributed to this user.'), required: true }, { diff --git a/app/models/project_services/bamboo_service.rb b/app/models/project_services/bamboo_service.rb index a252052200a..0e81d5b4ace 100644 --- a/app/models/project_services/bamboo_service.rb +++ b/app/models/project_services/bamboo_service.rb @@ -39,7 +39,7 @@ class BambooService < CiService end def help - 'You must set up automatic revision labeling and a repository trigger in Bamboo.' + _('You must set up automatic revision labeling and a repository trigger in Bamboo.') end def self.to_param diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb index fb73d430fb1..278bf6294a5 100644 --- a/app/models/project_services/emails_on_push_service.rb +++ b/app/models/project_services/emails_on_push_service.rb @@ -11,7 +11,7 @@ class EmailsOnPushService < Service end def description - 'Email the commits and diff of each push to a list of recipients.' + _('Email the commits and diff of each push to a list of recipients.') end def self.to_param diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb index d2835c6ac82..bf9b1759788 100644 --- a/app/models/project_services/external_wiki_service.rb +++ b/app/models/project_services/external_wiki_service.rb @@ -10,7 +10,7 @@ class ExternalWikiService < Service end def description - 'Replaces the link to the internal wiki with a link to an external wiki.' + _('Replaces the link to the internal wiki with a link to an external wiki.') end def self.to_param diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb index 76624263aab..950adbb7aa4 100644 --- a/app/models/project_services/flowdock_service.rb +++ b/app/models/project_services/flowdock_service.rb @@ -9,7 +9,7 @@ class FlowdockService < Service end def description - 'Flowdock is a collaboration web app for technical teams.' + _('Flowdock is a collaboration web app for technical teams.') end def self.to_param diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 9066a0b7f1d..073a8217bab 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -339,9 +339,9 @@ class JiraService < IssueTrackerService def self.event_description(event) case event when "merge_request", "merge_request_events" - "JIRA comments will be created when an issue gets referenced in a merge request." + _("JIRA comments will be created when an issue gets referenced in a merge request.") when "commit", "commit_events" - "JIRA comments will be created when an issue gets referenced in a commit." + _("JIRA comments will be created when an issue gets referenced in a commit.") end end end diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index f69edd60003..cae22dbc321 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -186,7 +186,7 @@ class KubernetesService < DeploymentService end def build_kube_client! - raise "Incomplete settings" unless api_url && actual_namespace && token + raise _("Incomplete settings") unless api_url && actual_namespace && token Gitlab::Kubernetes::KubeClient.new( api_url, diff --git a/app/models/project_services/pipelines_email_service.rb b/app/models/project_services/pipelines_email_service.rb index d60a6a7efa3..b8741b68398 100644 --- a/app/models/project_services/pipelines_email_service.rb +++ b/app/models/project_services/pipelines_email_service.rb @@ -14,7 +14,7 @@ class PipelinesEmailService < Service end def description - 'Email the pipelines status to a list of recipients.' + _('Email the pipelines status to a list of recipients.') end def self.to_param diff --git a/app/models/project_services/pivotaltracker_service.rb b/app/models/project_services/pivotaltracker_service.rb index 617e502b639..49c27c8f36e 100644 --- a/app/models/project_services/pivotaltracker_service.rb +++ b/app/models/project_services/pivotaltracker_service.rb @@ -23,7 +23,7 @@ class PivotaltrackerService < Service { type: 'text', name: 'token', - placeholder: 'Pivotal Tracker API token.', + placeholder: _('Pivotal Tracker API token.'), required: true }, { diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb index 4e48c348b45..3ba20d559b4 100644 --- a/app/models/project_services/pushover_service.rb +++ b/app/models/project_services/pushover_service.rb @@ -11,7 +11,7 @@ class PushoverService < Service end def description - 'Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop.' + _('Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop.') end def self.to_param diff --git a/app/models/repository.rb b/app/models/repository.rb index b47238b52f1..18f46916960 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -852,7 +852,7 @@ class Repository def ff_merge(user, source, target_branch, merge_request: nil) their_commit_id = commit(source)&.id - raise 'Invalid merge source' if their_commit_id.nil? + raise _('Invalid merge source') if their_commit_id.nil? merge_request&.update(in_progress_merge_commit_sha: their_commit_id) diff --git a/app/models/u2f_registration.rb b/app/models/u2f_registration.rb index 37598173fd1..9c4db22f996 100644 --- a/app/models/u2f_registration.rb +++ b/app/models/u2f_registration.rb @@ -19,7 +19,7 @@ class U2fRegistration < ActiveRecord::Base user: user, name: params[:name]) rescue JSON::ParserError, NoMethodError, ArgumentError - registration.errors.add(:base, 'Your U2F device did not send a valid JSON response.') + registration.errors.add(:base, _('Your U2F device did not send a valid JSON response.')) rescue U2F::Error => e registration.errors.add(:base, e.message) end diff --git a/app/models/upload.rb b/app/models/upload.rb index 20860f14b83..5b60964ee24 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -45,7 +45,7 @@ class Upload < ActiveRecord::Base end def absolute_path - raise ObjectStorage::RemoteStoreError, "Remote object has no absolute path." unless local? + raise ObjectStorage::RemoteStoreError, _("Remote object has no absolute path.") unless local? return path unless relative_path? uploader_class.absolute_path(self) diff --git a/app/models/user.rb b/app/models/user.rb index 26fd2d903a1..562141dce48 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -507,7 +507,7 @@ class User < ActiveRecord::Base def ghost email = 'ghost%s@example.com' unique_internal(where(ghost: true), 'ghost', email) do |u| - u.bio = 'This is a "Ghost User", created to hold all issues authored by users that have since been deleted. This user cannot be removed.' + u.bio = _('This is a "Ghost User", created to hold all issues authored by users that have since been deleted. This user cannot be removed.') u.name = 'Ghost User' end end diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index ad1647842b8..2a73a69542e 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -6,7 +6,7 @@ class BaseCountService def relation_for_count raise( NotImplementedError, - '"relation_for_count" must be implemented and return an ActiveRecord::Relation' + _('"relation_for_count" must be implemented and return an ActiveRecord::Relation') ) end @@ -35,7 +35,7 @@ class BaseCountService end def cache_key - raise NotImplementedError, 'cache_key must be implemented and return a String' + raise NotImplementedError, _('cache_key must be implemented and return a String') end # subclasses can override to add any specific options, such as diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index 5a9da053780..83269dfc78b 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -9,7 +9,7 @@ module Clusters end def execute(access_token: nil) - raise ArgumentError, 'Unknown clusterable provided' unless clusterable + raise ArgumentError, _('Unknown clusterable provided') unless clusterable raise ArgumentError, _('Instance does not support multiple Kubernetes clusters') unless can_create_cluster? cluster_params = params.merge(user: current_user).merge(clusterable_params) diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 5525c1b9b7f..1993c77802f 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -77,7 +77,7 @@ module Clusters end def build_kube_client!(api_url, ca_pem, username, password) - raise "Incomplete settings" unless api_url && username && password + raise _("Incomplete settings") unless api_url && username && password Gitlab::Kubernetes::KubeClient.new( api_url, diff --git a/app/services/concerns/exclusive_lease_guard.rb b/app/services/concerns/exclusive_lease_guard.rb index f102e00d150..03e8cecc723 100644 --- a/app/services/concerns/exclusive_lease_guard.rb +++ b/app/services/concerns/exclusive_lease_guard.rb @@ -16,7 +16,7 @@ module ExclusiveLeaseGuard lease = exclusive_lease.try_obtain unless lease - log_error('Cannot obtain an exclusive lease. There must be another instance already in execution.') + log_error(_('Cannot obtain an exclusive lease. There must be another instance already in execution.')) return end diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb index 0ec1f79d396..f47eb4fccd4 100644 --- a/app/services/files/delete_service.rb +++ b/app/services/files/delete_service.rb @@ -20,7 +20,7 @@ module Files super if file_has_changed?(@file_path, @last_commit_sha) - raise FileChangedError, "You are attempting to delete a file that has been previously updated." + raise FileChangedError, _("You are attempting to delete a file that has been previously updated.") end end end diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index 2b3e96e6c53..b4750b386d4 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -19,7 +19,7 @@ module Files super if file_has_changed?(@file_path, @last_commit_sha) - raise FileChangedError, "You are attempting to update a file that has changed since you started editing it." + raise FileChangedError, _("You are attempting to update a file that has changed since you started editing it.") end end end diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb index 24d8400c625..275bf69fff7 100644 --- a/app/services/groups/create_service.rb +++ b/app/services/groups/create_service.rb @@ -38,13 +38,13 @@ module Groups if @group.subgroup? unless can?(current_user, :create_subgroup, @group.parent) @group.parent = nil - @group.errors.add(:parent_id, 'You don’t have permission to create a subgroup in this group.') + @group.errors.add(:parent_id, _('You don’t have permission to create a subgroup in this group.')) return false end else unless can?(current_user, :create_group) - @group.errors.add(:base, 'You don’t have permission to create groups.') + @group.errors.add(:base, _('You don’t have permission to create groups.')) return false end diff --git a/app/services/groups/nested_create_service.rb b/app/services/groups/nested_create_service.rb index f01f5656296..f9492def58e 100644 --- a/app/services/groups/nested_create_service.rb +++ b/app/services/groups/nested_create_service.rb @@ -19,7 +19,7 @@ module Groups end if group_path.include?('/') && !Group.supports_nested_objects? - raise 'Nested groups are not supported on MySQL' + raise _('Nested groups are not supported on MySQL') end create_group_path diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index f64e327416a..f52abb3f40d 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -3,11 +3,11 @@ module Groups class TransferService < Groups::BaseService ERROR_MESSAGES = { - database_not_supported: 'Database is not supported.', - namespace_with_same_path: 'The parent group already has a subgroup with the same path.', - group_is_already_root: 'Group is already a root group.', - same_parent_as_current: 'Group is already associated to the parent group.', - invalid_policies: "You don't have enough permissions." + database_not_supported: _('Database is not supported.'), + namespace_with_same_path: _('The parent group already has a subgroup with the same path.'), + group_is_already_root: _('Group is already a root group.'), + same_parent_as_current: _('Group is already associated to the parent group.'), + invalid_policies: _("You don't have enough permissions.") }.freeze TransferError = Class.new(StandardError) diff --git a/app/services/import/github_service.rb b/app/services/import/github_service.rb index a2533683da9..a322a306ba4 100644 --- a/app/services/import/github_service.rb +++ b/app/services/import/github_service.rb @@ -7,7 +7,7 @@ module Import def execute(access_params, provider) unless authorized? - return error('This namespace has already been taken! Please choose another one.', :unprocessable_entity) + return error(_('This namespace has already been taken! Please choose another one.'), :unprocessable_entity) end project = Gitlab::LegacyGithubImport::ProjectCreator diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index 41b6a96b005..961e0aa6d0f 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -8,11 +8,11 @@ module Issues @target_project = target_project unless issue.can_move?(current_user, @target_project) - raise MoveError, 'Cannot move issue due to insufficient permissions!' + raise MoveError, _('Cannot move issue due to insufficient permissions!') end if @project == @target_project - raise MoveError, 'Cannot move issue to project it originates from!' + raise MoveError, _('Cannot move issue to project it originates from!') end super diff --git a/app/services/lfs/lock_file_service.rb b/app/services/lfs/lock_file_service.rb index c7730d24bdc..9e01b553348 100644 --- a/app/services/lfs/lock_file_service.rb +++ b/app/services/lfs/lock_file_service.rb @@ -4,7 +4,7 @@ module Lfs class LockFileService < BaseService def execute unless can?(current_user, :push_code, project) - raise Gitlab::GitAccess::UnauthorizedError, 'You have no permissions' + raise Gitlab::GitAccess::UnauthorizedError, _('You have no permissions') end create_lock! diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index 714b8586737..20e0f5f27f4 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -5,7 +5,7 @@ module Members DEFAULT_LIMIT = 100 def execute(source) - return error('No users specified.') if params[:user_ids].blank? + return error(_('No users specified.')) if params[:user_ids].blank? user_ids = params[:user_ids].split(',').uniq diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 70a67baa01c..fb3b2900cd5 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -76,7 +76,7 @@ module MergeRequests if commit_id log_info("Git merge finished on JID #{merge_jid} commit #{commit_id}") else - raise MergeError, 'Conflicts detected during merge' + raise MergeError, _('Conflicts detected during merge') end merge_request.update!(merge_commit_sha: commit_id) @@ -88,10 +88,10 @@ module MergeRequests repository.merge(current_user, source, merge_request, message) rescue Gitlab::Git::PreReceiveError => e handle_merge_error(log_message: e.message) - raise MergeError, 'Something went wrong during merge pre-receive hook' + raise MergeError, _('Something went wrong during merge pre-receive hook') rescue => e handle_merge_error(log_message: e.message) - raise MergeError, 'Something went wrong during merge' + raise MergeError, _('Something went wrong during merge') ensure merge_request.update!(in_progress_merge_commit_sha: nil) end diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb index a439a380255..d97326fbdfa 100644 --- a/app/services/merge_requests/squash_service.rb +++ b/app/services/merge_requests/squash_service.rb @@ -6,7 +6,7 @@ module MergeRequests @merge_request = merge_request @repository = target_project.repository - squash || error('Failed to squash. Should be done manually.') + squash || error(_('Failed to squash. Should be done manually.')) end def squash @@ -15,7 +15,7 @@ module MergeRequests end if merge_request.squash_in_progress? - return error('Squash task canceled: another squash is already in progress.') + return error(_('Squash task canceled: another squash is already in progress.')) end squash_sha = repository.squash(current_user, merge_request) diff --git a/app/services/milestones/promote_service.rb b/app/services/milestones/promote_service.rb index cbe5996e8ca..b75276f1e6f 100644 --- a/app/services/milestones/promote_service.rb +++ b/app/services/milestones/promote_service.rb @@ -45,7 +45,7 @@ module Milestones end def check_project_milestone!(milestone) - raise_error('Only project milestones can be promoted.') unless milestone.project_milestone? + raise_error(_('Only project milestones can be promoted.')) unless milestone.project_milestone? end def clone_project_milestone(milestone) @@ -73,7 +73,7 @@ module Milestones # rubocop: enable CodeReuse/ActiveRecord def group - @group ||= parent.group || raise_error('Project does not belong to a group.') + @group ||= parent.group || raise_error(_('Project does not belong to a group.')) end # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index 68cdc69023a..81734bd6e31 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -31,11 +31,11 @@ module NotificationRecipientService module Builder class Base def initialize(*) - raise 'abstract' + raise _('abstract') end def build! - raise 'abstract' + raise _('abstract') end def filter! @@ -47,7 +47,7 @@ module NotificationRecipientService end def target - raise 'abstract' + raise _('abstract') end def project diff --git a/app/services/projects/batch_count_service.rb b/app/services/projects/batch_count_service.rb index aec3b32da89..93c5022a14d 100644 --- a/app/services/projects/batch_count_service.rb +++ b/app/services/projects/batch_count_service.rb @@ -23,11 +23,11 @@ module Projects end def global_count(project) - raise NotImplementedError, 'global_count must be implemented and return an hash indexed by the project id' + raise NotImplementedError, _('global_count must be implemented and return an hash indexed by the project id') end def count_service - raise NotImplementedError, 'count_service must be implemented and return a Projects::CountService object' + raise NotImplementedError, _('count_service must be implemented and return a Projects::CountService object') end end end diff --git a/app/services/projects/count_service.rb b/app/services/projects/count_service.rb index 3cee80c7bbc..ab4dce988cc 100644 --- a/app/services/projects/count_service.rb +++ b/app/services/projects/count_service.rb @@ -20,7 +20,7 @@ module Projects def cache_key_name raise( NotImplementedError, - '"cache_key_name" must be implemented and return a String' + _('"cache_key_name" must be implemented and return a String') ) end @@ -33,7 +33,7 @@ module Projects def self.query(project_ids) raise( NotImplementedError, - '"query" must be implemented and return an ActiveRecord::Relation' + _('"query" must be implemented and return an ActiveRecord::Relation') ) end end diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index d03137b63b2..44638491222 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -142,7 +142,7 @@ module Projects end unless @project.import? - raise 'Failed to create repository' unless @project.create_repository + raise _('Failed to create repository') unless @project.create_repository end end end diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index b14b31302f5..4a42d40e026 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -61,11 +61,11 @@ module Projects flush_caches(@project) unless rollback_repository(removal_path(repo_path), repo_path) - raise_error('Failed to restore project repository. Please contact the administrator.') + raise_error(_('Failed to restore project repository. Please contact the administrator.')) end unless rollback_repository(removal_path(wiki_path), wiki_path) - raise_error('Failed to restore wiki repository. Please contact the administrator.') + raise_error(_('Failed to restore wiki repository. Please contact the administrator.')) end end @@ -81,11 +81,11 @@ module Projects def trash_repositories! unless remove_repository(repo_path) - raise_error('Failed to remove project repository. Please try again or contact administrator.') + raise_error(_('Failed to remove project repository. Please try again or contact administrator.')) end unless remove_repository(wiki_path) - raise_error('Failed to remove wiki repository. Please try again or contact administrator.') + raise_error(_('Failed to remove wiki repository. Please try again or contact administrator.')) end end @@ -148,7 +148,7 @@ module Projects def attempt_destroy_transaction(project) unless remove_registry_tags - raise_error('Failed to remove some tags in project container registry. Please try again or contact administrator.') + raise_error(_('Failed to remove some tags in project container registry. Please try again or contact administrator.')) end project.leave_pool_repository diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 0c426faa22d..1dbed226308 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -53,7 +53,7 @@ module Projects def create_repository unless project.create_repository - raise Error, 'The repository could not be created.' + raise Error, _('The repository could not be created.') end end @@ -104,7 +104,7 @@ module Projects project.repository.expire_content_cache unless project.gitlab_project_import? unless importer.execute - raise Error, 'The remote data could not be imported.' + raise Error, _('The remote data could not be imported.') end end diff --git a/app/services/projects/lfs_pointers/lfs_import_service.rb b/app/services/projects/lfs_pointers/lfs_import_service.rb index 9215fa0a7bf..04dd1192a91 100644 --- a/app/services/projects/lfs_pointers/lfs_import_service.rb +++ b/app/services/projects/lfs_pointers/lfs_import_service.rb @@ -68,13 +68,13 @@ module Projects end end rescue URI::InvalidURIError - raise LfsImportError, 'Invalid URL in .lfsconfig file' + raise LfsImportError, _('Invalid URL in .lfsconfig file') end def import_uri @import_uri ||= URI.parse(project.import_url) rescue URI::InvalidURIError - raise LfsImportError, 'Invalid project import URL' + raise LfsImportError, _('Invalid project import URL') end def current_endpoint_uri diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 5da1e39a1fb..da8ab081da8 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -17,11 +17,11 @@ module Projects @new_namespace = new_namespace if @new_namespace.blank? - raise TransferError, 'Please select a new namespace for your project.' + raise TransferError, _('Please select a new namespace for your project.') end unless allowed_transfer?(current_user, project) - raise TransferError, 'Transfer failed, please contact an admin.' + raise TransferError, _('Transfer failed, please contact an admin.') end transfer(project) diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index eb2478be3cf..368d7bf8c2c 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -23,8 +23,8 @@ module Projects @status.enqueue! @status.run! - raise InvalidStateError, 'missing pages artifacts' unless build.artifacts? - raise InvalidStateError, 'pages are outdated' unless latest? + raise InvalidStateError, _('missing pages artifacts') unless build.artifacts? + raise InvalidStateError, _('pages are outdated') unless latest? # Create temporary directory in which we will extract the artifacts FileUtils.mkdir_p(tmp_path) @@ -33,8 +33,8 @@ module Projects # Check if we did extract public directory archive_public_path = File.join(archive_path, 'public') - raise InvalidStateError, 'pages miss the public folder' unless Dir.exist?(archive_public_path) - raise InvalidStateError, 'pages are outdated' unless latest? + raise InvalidStateError, _('pages miss the public folder') unless Dir.exist?(archive_public_path) + raise InvalidStateError, _('pages are outdated') unless latest? deploy_page!(archive_public_path) success @@ -77,12 +77,12 @@ module Projects if artifacts.ends_with?('.zip') extract_zip_archive!(temp_path) else - raise InvalidStateError, 'unsupported artifacts format' + raise InvalidStateError, _('unsupported artifacts format') end end def extract_zip_archive!(temp_path) - raise InvalidStateError, 'missing artifacts metadata' unless build.artifacts_metadata? + raise InvalidStateError, _('missing artifacts metadata') unless build.artifacts_metadata? # Calculate page size after extract public_entry = build.artifacts_metadata_entry(SITE_PATH, recursive: true) @@ -98,7 +98,7 @@ module Projects site_path = File.join(SITE_PATH, '*') build.artifacts_file.use_file do |artifacts_path| unless system(*%W(unzip -n #{artifacts_path} #{site_path} -d #{temp_path})) - raise FailedToExtractError, 'pages failed to extract' + raise FailedToExtractError, _('pages failed to extract') end end end diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index 6856009b395..1ea890a7add 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -39,11 +39,11 @@ module Projects def validate! unless valid_visibility_level_change?(project, params[:visibility_level]) - raise ValidationError.new('New visibility level not allowed!') + raise ValidationError.new(_('New visibility level not allowed!')) end if renaming_project_with_container_registry_tags? - raise ValidationError.new('Cannot rename project because it contains container registry tags!') + raise ValidationError.new(_('Cannot rename project because it contains container registry tags!')) end if changing_default_branch? @@ -88,7 +88,7 @@ module Projects def update_failed! model_errors = project.errors.full_messages.to_sentence - error_message = model_errors.presence || 'Project could not be updated!' + error_message = model_errors.presence || _('Project could not be updated!') error(error_message) end diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 5c58caee8cd..1a87962c174 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -87,7 +87,7 @@ module QuickActions end desc 'Merge (when the pipeline succeeds)' - explanation 'Merges this merge request when the pipeline succeeds.' + explanation _('Merges this merge request when the pipeline succeeds.') condition do last_diff_sha = params && params[:merge_request_diff_head_sha] issuable.is_a?(MergeRequest) && @@ -232,7 +232,7 @@ module QuickActions labels = find_label_references(labels_param) "Removes #{labels.join(' ')} #{'label'.pluralize(labels.count)}." if labels.any? else - 'Removes all labels.' + _('Removes all labels.') end end params '~label1 ~"label 2"' @@ -301,7 +301,7 @@ module QuickActions end desc 'Add a todo' - explanation 'Adds a todo.' + explanation _('Adds a todo.') condition do issuable.is_a?(Issuable) && issuable.persisted? && @@ -312,7 +312,7 @@ module QuickActions end desc 'Mark todo as done' - explanation 'Marks todo as done.' + explanation _('Marks todo as done.') condition do issuable.persisted? && TodoService.new.todo_exist?(issuable, current_user) @@ -364,7 +364,7 @@ module QuickActions end desc 'Remove due date' - explanation 'Removes the due date.' + explanation _('Removes the due date.') condition do issuable.persisted? && issuable.respond_to?(:due_date) && @@ -461,7 +461,7 @@ module QuickActions end desc 'Remove time estimate' - explanation 'Removes time estimate.' + explanation _('Removes time estimate.') condition do issuable.persisted? && current_user.can?(:"admin_#{issuable.to_ability_name}", project) @@ -471,7 +471,7 @@ module QuickActions end desc 'Remove spent time' - explanation 'Removes spent time.' + explanation _('Removes spent time.') condition do issuable.persisted? && current_user.can?(:"admin_#{issuable.to_ability_name}", project) @@ -584,7 +584,7 @@ module QuickActions end end - desc 'Move this issue to another project.' + desc _('Move this issue to another project.') explanation do |path_to_project| "Moves this issue to #{path_to_project}." end @@ -602,7 +602,7 @@ module QuickActions end end - desc 'Make issue confidential.' + desc _('Make issue confidential.') explanation do 'Makes this issue confidential' end @@ -613,7 +613,7 @@ module QuickActions @updates[:confidential] = true end - desc 'Tag this commit.' + desc _('Tag this commit.') explanation do |tag_name, message| with_message = %{ with "#{message}"} if message.present? "Tags this commit to #{tag_name}#{with_message}." @@ -630,7 +630,7 @@ module QuickActions @updates[:tag_message] = message end - desc 'Create a merge request.' + desc _('Create a merge request.') explanation do |branch_name = nil| branch_text = branch_name ? "branch '#{branch_name}'" : 'a branch' "Creates #{branch_text} and a merge request to resolve this issue" diff --git a/app/services/submodules/update_service.rb b/app/services/submodules/update_service.rb index a6011a920bd..a4f24f7a121 100644 --- a/app/services/submodules/update_service.rb +++ b/app/services/submodules/update_service.rb @@ -16,7 +16,7 @@ module Submodules def validate! super - raise ValidationError, 'The repository is empty' if repository.empty? + raise ValidationError, _('The repository is empty') if repository.empty? end def execute @@ -32,7 +32,7 @@ module Submodules message: @commit_message, branch: @branch_name) rescue ArgumentError, TypeError - raise ValidationError, 'Invalid parameters' + raise ValidationError, _('Invalid parameters') end end end diff --git a/app/services/test_hooks/project_service.rb b/app/services/test_hooks/project_service.rb index 7e14ddcd017..90a95a95b9c 100644 --- a/app/services/test_hooks/project_service.rb +++ b/app/services/test_hooks/project_service.rb @@ -11,7 +11,7 @@ module TestHooks private def push_events_data - throw(:validation_error, 'Ensure the project has at least one commit.') if project.empty_repo? + throw(:validation_error, _('Ensure the project has at least one commit.')) if project.empty_repo? Gitlab::DataBuilder::Push.build_sample(project, current_user) end @@ -20,14 +20,14 @@ module TestHooks def note_events_data note = project.notes.first - throw(:validation_error, 'Ensure the project has notes.') unless note.present? + throw(:validation_error, _('Ensure the project has notes.')) unless note.present? Gitlab::DataBuilder::Note.build(note, current_user) end def issues_events_data issue = project.issues.first - throw(:validation_error, 'Ensure the project has issues.') unless issue.present? + throw(:validation_error, _('Ensure the project has issues.')) unless issue.present? issue.to_hook_data(current_user) end @@ -36,21 +36,21 @@ module TestHooks def merge_requests_events_data merge_request = project.merge_requests.first - throw(:validation_error, 'Ensure the project has merge requests.') unless merge_request.present? + throw(:validation_error, _('Ensure the project has merge requests.')) unless merge_request.present? merge_request.to_hook_data(current_user) end def job_events_data build = project.builds.first - throw(:validation_error, 'Ensure the project has CI jobs.') unless build.present? + throw(:validation_error, _('Ensure the project has CI jobs.')) unless build.present? Gitlab::DataBuilder::Build.build(build) end def pipeline_events_data pipeline = project.ci_pipelines.first - throw(:validation_error, 'Ensure the project has CI pipelines.') unless pipeline.present? + throw(:validation_error, _('Ensure the project has CI pipelines.')) unless pipeline.present? Gitlab::DataBuilder::Pipeline.build(pipeline) end @@ -58,7 +58,7 @@ module TestHooks def wiki_page_events_data page = project.wiki.pages.first if !project.wiki_enabled? || page.blank? - throw(:validation_error, 'Ensure the wiki is enabled and has pages.') + throw(:validation_error, _('Ensure the wiki is enabled and has pages.')) end Gitlab::DataBuilder::WikiPage.build(page, current_user, 'create') diff --git a/app/services/test_hooks/system_service.rb b/app/services/test_hooks/system_service.rb index 082830c5538..79f60934037 100644 --- a/app/services/test_hooks/system_service.rb +++ b/app/services/test_hooks/system_service.rb @@ -18,7 +18,7 @@ module TestHooks def merge_requests_events_data merge_request = MergeRequest.of_projects(current_user.projects.select(:id)).first - throw(:validation_error, 'Ensure one of your projects has merge requests.') unless merge_request.present? + throw(:validation_error, _('Ensure one of your projects has merge requests.')) unless merge_request.present? merge_request.to_hook_data(current_user) end diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb index 400f0b3dcc6..0cfa9cd81d5 100644 --- a/app/uploaders/job_artifact_uploader.rb +++ b/app/uploaders/job_artifact_uploader.rb @@ -24,7 +24,7 @@ class JobArtifactUploader < GitlabUploader private def dynamic_segment - raise ObjectNotReadyError, 'JobArtifact is not ready' unless model.id + raise ObjectNotReadyError, _('JobArtifact is not ready') unless model.id if model.hashed_path? hashed_path diff --git a/app/uploaders/legacy_artifact_uploader.rb b/app/uploaders/legacy_artifact_uploader.rb index a9afc104ed1..885d2253222 100644 --- a/app/uploaders/legacy_artifact_uploader.rb +++ b/app/uploaders/legacy_artifact_uploader.rb @@ -17,7 +17,7 @@ class LegacyArtifactUploader < GitlabUploader private def dynamic_segment - raise ObjectNotReadyError, 'Build is not ready' unless model.id + raise ObjectNotReadyError, _('Build is not ready') unless model.id File.join(model.created_at.utc.strftime('%Y_%m'), model.project_id.to_s, model.id.to_s) end diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index dad6e85fb56..47731a80e06 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -241,7 +241,7 @@ module ObjectStorage return unless persist_object_store? updated = model.update_column(store_serialization_column, object_store) - raise 'Failed to update object store' unless updated + raise _('Failed to update object store') unless updated end def use_file(&blk) @@ -342,14 +342,14 @@ module ObjectStorage def cache_remote_file!(remote_object_id, original_filename) file_path = File.join(TMP_UPLOAD_PATH, remote_object_id) file_path = Pathname.new(file_path).cleanpath.to_s - raise RemoteStoreError, 'Bad file path' unless file_path.start_with?(TMP_UPLOAD_PATH + '/') + raise RemoteStoreError, _('Bad file path') unless file_path.start_with?(TMP_UPLOAD_PATH + '/') # TODO: # This should be changed to make use of `tmp/cache` mechanism # instead of using custom upload directory, # using tmp/cache makes this implementation way easier than it is today CarrierWave::Storage::Fog::File.new(self, storage_for(Store::REMOTE), file_path).tap do |file| - raise RemoteStoreError, 'Missing file' unless file.exists? + raise RemoteStoreError, _('Missing file') unless file.exists? # Remote stored file, we force to store on remote storage self.object_store = Store::REMOTE @@ -387,7 +387,7 @@ module ObjectStorage def storage_for(store) case store when Store::REMOTE - raise 'Object Storage is not enabled' unless self.class.object_store_enabled? + raise _('Object Storage is not enabled') unless self.class.object_store_enabled? CarrierWave::Storage::Fog.new(self) when Store::LOCAL diff --git a/app/workers/background_migration_worker.rb b/app/workers/background_migration_worker.rb index 688b600649a..f493e8da4c1 100644 --- a/app/workers/background_migration_worker.rb +++ b/app/workers/background_migration_worker.rb @@ -84,7 +84,7 @@ class BackgroundMigrationWorker def database_unhealthy_counter Gitlab::Metrics.counter( :background_migration_database_health_reschedules, - 'The number of times a background migration is rescheduled because the database is unhealthy.' + _('The number of times a background migration is rescheduled because the database is unhealthy.') ) end end diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb index d64c2f82a09..25c3a945077 100644 --- a/app/workers/concerns/application_worker.rb +++ b/app/workers/concerns/application_worker.rb @@ -53,7 +53,7 @@ module ApplicationWorker schedule = now + delay.to_i if schedule <= now - raise ArgumentError, 'The schedule time must be in the future!' + raise ArgumentError, _('The schedule time must be in the future!') end Sidekiq::Client.push_bulk('class' => self, 'args' => args_list, 'at' => schedule) diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb index bf637f82df2..51542e9e8f5 100644 --- a/app/workers/email_receiver_worker.rb +++ b/app/workers/email_receiver_worker.rb @@ -24,22 +24,22 @@ class EmailReceiverWorker reason = case error when Gitlab::Email::UnknownIncomingEmail - "We couldn't figure out what the email is for. Please create your issue or comment through the web interface." + _("We couldn't figure out what the email is for. Please create your issue or comment through the web interface.") when Gitlab::Email::SentNotificationNotFoundError - "We couldn't figure out what the email is in reply to. Please create your comment through the web interface." + _("We couldn't figure out what the email is in reply to. Please create your comment through the web interface.") when Gitlab::Email::ProjectNotFound - "We couldn't find the project. Please check if there's any typo." + _("We couldn't find the project. Please check if there's any typo.") when Gitlab::Email::EmptyEmailError can_retry = true - "It appears that the email is blank. Make sure your reply is at the top of the email, we can't process inline replies." + _("It appears that the email is blank. Make sure your reply is at the top of the email, we can't process inline replies.") when Gitlab::Email::UserNotFoundError - "We couldn't figure out what user corresponds to the email. Please create your comment through the web interface." + _("We couldn't figure out what user corresponds to the email. Please create your comment through the web interface.") when Gitlab::Email::UserBlockedError - "Your account has been blocked. If you believe this is in error, contact a staff member." + _("Your account has been blocked. If you believe this is in error, contact a staff member.") when Gitlab::Email::UserNotAuthorizedError - "You are not allowed to perform this action. If you believe this is in error, contact a staff member." + _("You are not allowed to perform this action. If you believe this is in error, contact a staff member.") when Gitlab::Email::NoteableNotFoundError - "The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member." + _("The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member.") when Gitlab::Email::InvalidAttachment error.message when Gitlab::Email::InvalidRecordError diff --git a/app/workers/object_storage/migrate_uploads_worker.rb b/app/workers/object_storage/migrate_uploads_worker.rb index fe5d27b087d..337563265cf 100644 --- a/app/workers/object_storage/migrate_uploads_worker.rb +++ b/app/workers/object_storage/migrate_uploads_worker.rb @@ -20,7 +20,7 @@ module ObjectStorage end def to_s - success? ? "Migration successful." : "Error while migrating #{upload.id}: #{error.message}" + success? ? _("Migration successful.") : "Error while migrating #{upload.id}: #{error.message}" end end @@ -110,9 +110,9 @@ module ObjectStorage return if args.count == 4 case args.count - when 3 then raise SanityCheckError, "Job is missing the `model_type` argument." + when 3 then raise SanityCheckError, _("Job is missing the `model_type` argument.") else - raise SanityCheckError, "Job has wrong arguments format." + raise SanityCheckError, _("Job has wrong arguments format.") end end |