diff options
author | Luke Bennett <lbennett@gitlab.com> | 2019-01-30 05:10:37 +0000 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2019-01-31 04:56:51 +0000 |
commit | e33e3d29ae56ddd10b66513c35f3e318ea375cb9 (patch) | |
tree | ce5d1515f93c1e38a01c95b5e0f07f1b572f3763 | |
parent | b5f089f2b7100dffb1a346e95022f88e6ff06415 (diff) | |
download | gitlab-ce-i18n-cop.tar.gz |
Autofixed some untranslated stringsi18n-cop
570 files changed, 1277 insertions, 1272 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 48147c2654c..1f125eb52ef 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,6 +25,11 @@ AllCops: GetText: Enabled: true + Exclude: + - 'scripts/**/*' + - 'rubocop/**/*' + - 'db/**/*' + - 'danger/**/*' RailsI18n: Enabled: false 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 diff --git a/config/initializers/0_acts_as_taggable.rb b/config/initializers/0_acts_as_taggable.rb index 50dc47673ab..5615b471e0d 100644 --- a/config/initializers/0_acts_as_taggable.rb +++ b/config/initializers/0_acts_as_taggable.rb @@ -5,5 +5,5 @@ ActsAsTaggableOn.strict_case_match = true ActsAsTaggableOn.tags_counter = false # validate that counter cache is disabled -raise "Counter cache is not disabled" if +raise _("Counter cache is not disabled") if ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache] diff --git a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb index 228ced32188..cae1885bbac 100644 --- a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb +++ b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb @@ -40,7 +40,7 @@ module ActiveRecord if finder_class.primary_key relation = relation.where.not(finder_class.primary_key => record.id_was || record.id) else - raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.") + raise UnknownPrimaryKey.new(finder_class, _("Can not validate uniqueness for persisted record without primary key.")) end end diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index a6f43415ec5..e85544223f0 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -11,7 +11,7 @@ elsif Gitlab::Database.postgresql? PEEK_DB_CLIENT = ::PG::Connection PEEK_DB_VIEW = Peek::Views::PG else - raise "Unsupported database adapter for peek!" + raise _("Unsupported database adapter for peek!") end Peek.into PEEK_DB_VIEW diff --git a/danger/metadata/Dangerfile b/danger/metadata/Dangerfile index 1adca152736..c92bb93713d 100644 --- a/danger/metadata/Dangerfile +++ b/danger/metadata/Dangerfile @@ -1,11 +1,11 @@ # rubocop:disable Style/SignalException if gitlab.mr_body.size < 5 - fail "Please provide a proper merge request description." + fail _("Please provide a proper merge request description.") end if gitlab.mr_labels.empty? - fail "Please add labels to this merge request." + fail _("Please add labels to this merge request.") end unless gitlab.mr_json["assignee"] diff --git a/db/migrate/20140313092127_init_schema.rb b/db/migrate/20140313092127_init_schema.rb index 4188599b4b4..8d0a4a069cf 100644 --- a/db/migrate/20140313092127_init_schema.rb +++ b/db/migrate/20140313092127_init_schema.rb @@ -333,6 +333,6 @@ class InitSchema < ActiveRecord::Migration[4.2] end def down - raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable" + raise ActiveRecord::IrreversibleMigration, _("The initial migration is not revertable") end end diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index ee8dc822098..bbbb0e19186 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -14,7 +14,7 @@ module API end resource source_type.pluralize, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc "Gets a list of access requests for a #{source_type}." do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::AccessRequester end params do @@ -32,7 +32,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc "Requests access for the authenticated user to a #{source_type}." do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::AccessRequester end post ":id/access_requests" do @@ -46,8 +46,8 @@ module API end end - desc 'Approves an access request for the given user.' do - detail 'This feature was introduced in GitLab 8.11.' + desc _('Approves an access request for the given user.') do + detail _('This feature was introduced in GitLab 8.11.') success Entities::Member end params do @@ -68,8 +68,8 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Denies an access request for the given user.' do - detail 'This feature was introduced in GitLab 8.11.' + desc _('Denies an access request for the given user.') do + detail _('This feature was introduced in GitLab 8.11.') end params do requires :user_id, type: Integer, desc: 'The user ID of the access requester' diff --git a/lib/api/api.rb b/lib/api/api.rb index a768b78cda5..a4b0043c828 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -29,7 +29,7 @@ module API version 'v3', using: :path do route :any, '*path' do - error!('API V3 is no longer supported. Use API V4 instead.', 410) + error!(_('API V3 is no longer supported. Use API V4 instead.'), 410) end end diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index af9b519ed9e..b0769665f68 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -110,22 +110,22 @@ module API when Gitlab::Auth::TokenNotFoundError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, - "Bad Access Token.") + _("Bad Access Token.")) when Gitlab::Auth::ExpiredError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, - "Token is expired. You can either do re-authorization or token refresh.") + _("Token is expired. You can either do re-authorization or token refresh.")) when Gitlab::Auth::RevokedError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, - "Token was revoked. You have to re-authorize from the user.") + _("Token was revoked. You have to re-authorize from the user.")) when Gitlab::Auth::ImpersonationDisabled Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, - "Token is an impersonation token but impersonation was disabled.") + _("Token is an impersonation token but impersonation was disabled.")) when Gitlab::Auth::InsufficientScopeError # FIXME: ForbiddenError (inherited from Bearer::Forbidden of Rack::Oauth2) diff --git a/lib/api/badges.rb b/lib/api/badges.rb index ba554e00a16..e6ff89c1025 100644 --- a/lib/api/badges.rb +++ b/lib/api/badges.rb @@ -24,7 +24,7 @@ module API end resource source_type.pluralize, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc "Gets a list of #{source_type} badges viewable by the authenticated user." do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::Badge end params do @@ -37,7 +37,7 @@ module API end desc "Preview a badge from a #{source_type}." do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::BasicBadgeDetails end params do @@ -60,7 +60,7 @@ module API end desc "Gets a badge of a #{source_type}." do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::Badge end params do @@ -74,7 +74,7 @@ module API end desc "Adds a badge to a #{source_type}." do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::Badge end params do @@ -94,7 +94,7 @@ module API end desc "Updates a badge of a #{source_type}." do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::Badge end params do @@ -114,8 +114,8 @@ module API end end - desc 'Removes a badge from a project or group.' do - detail 'This feature was introduced in GitLab 10.6.' + desc _('Removes a badge from a project or group.') do + detail _('This feature was introduced in GitLab 10.6.') end params do requires :badge_id, type: Integer, desc: 'The badge ID' diff --git a/lib/api/boards_responses.rb b/lib/api/boards_responses.rb index 86d9b24802f..72174c4e3d8 100644 --- a/lib/api/boards_responses.rb +++ b/lib/api/boards_responses.rb @@ -38,7 +38,7 @@ module API if move_list_service.execute(list) present list, with: Entities::List else - render_api_error!({ error: "List could not be moved!" }, 400) + render_api_error!({ error: _("List could not be moved!") }, 400) end end @@ -46,7 +46,7 @@ module API destroy_conditionally!(list) do |list| service = ::Boards::Lists::DestroyService.new(board_parent, current_user) unless service.execute(list) - render_api_error!({ error: 'List could not be deleted!' }, 400) + render_api_error!({ error: _('List could not be deleted!') }, 400) end end end @@ -54,7 +54,7 @@ module API # rubocop: disable CodeReuse/ActiveRecord def authorize_list_type_resource! unless available_labels_for(board_parent).exists?(params[:label_id]) - render_api_error!({ error: 'Label not found!' }, 400) + render_api_error!({ error: _('Label not found!') }, 400) end end # rubocop: enable CodeReuse/ActiveRecord diff --git a/lib/api/broadcast_messages.rb b/lib/api/broadcast_messages.rb index 19148758fc5..c00971443fd 100644 --- a/lib/api/broadcast_messages.rb +++ b/lib/api/broadcast_messages.rb @@ -15,7 +15,7 @@ module API end desc 'Get all broadcast messages' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::BroadcastMessage end params do @@ -28,7 +28,7 @@ module API end desc 'Create a broadcast message' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::BroadcastMessage end params do @@ -49,7 +49,7 @@ module API end desc 'Get a specific broadcast message' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::BroadcastMessage end params do @@ -62,7 +62,7 @@ module API end desc 'Update a broadcast message' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::BroadcastMessage end params do @@ -84,7 +84,7 @@ module API end desc 'Delete a broadcast message' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::BroadcastMessage end params do diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 9d23daafe95..ed3d2317b13 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -73,7 +73,7 @@ module API detail 'This feature was introduced in GitLab 8.13' end params do - requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide `start_branch`.', allow_blank: false + requires :branch, type: String, desc: _('Name of the branch to commit into. To create a new branch, also provide `start_branch`.'), allow_blank: false requires :commit_message, type: String, desc: 'Commit message' requires :actions, type: Array, desc: 'Actions to perform in commit' do requires :action, type: String, desc: 'The action to perform, `create`, `delete`, `move`, `update`, `chmod`', values: %w[create update move delete chmod].freeze @@ -92,7 +92,7 @@ module API optional :last_commit_id, type: String, desc: 'Last known file commit id' end given action: ->(action) { action == 'chmod' } do - requires :execute_filemode, type: Boolean, desc: 'When `true/false` enables/disables the execute flag on the file.' + requires :execute_filemode, type: Boolean, desc: _('When `true/false` enables/disables the execute flag on the file.') end end optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from' diff --git a/lib/api/deployments.rb b/lib/api/deployments.rb index 8706a971a1a..548b57b50dc 100644 --- a/lib/api/deployments.rb +++ b/lib/api/deployments.rb @@ -12,7 +12,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get all deployments of the project' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Deployment end params do @@ -29,7 +29,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc 'Gets a specific deployment' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Deployment end params do diff --git a/lib/api/discussions.rb b/lib/api/discussions.rb index 91eb6a23701..3265326e312 100644 --- a/lib/api/discussions.rb +++ b/lib/api/discussions.rb @@ -138,7 +138,7 @@ module API notes = readable_discussion_notes(noteable, params[:discussion_id]) break not_found!("Discussion") if notes.empty? - break bad_request!("Discussion is an individual note.") unless notes.first.part_of_discussion? + break bad_request!(_("Discussion is an individual note.")) unless notes.first.part_of_discussion? opts = { note: params[:body], diff --git a/lib/api/environments.rb b/lib/api/environments.rb index 633f24d3c9a..7c8f567ab6e 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -13,7 +13,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get all environments of the project' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Environment end params do @@ -26,7 +26,7 @@ module API end desc 'Creates a new environment' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Environment end params do @@ -47,7 +47,7 @@ module API end desc 'Updates an existing environment' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Environment end params do @@ -70,7 +70,7 @@ module API end desc 'Deletes an existing environment' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Environment end params do diff --git a/lib/api/events.rb b/lib/api/events.rb index b98aa9f31e1..6b5b9c44946 100644 --- a/lib/api/events.rb +++ b/lib/api/events.rb @@ -33,7 +33,7 @@ module API allow_access_with_scope :read_user, if: -> (request) { request.get? } desc "List currently authenticated user's events" do - detail 'This feature was introduced in GitLab 9.3.' + detail _('This feature was introduced in GitLab 9.3.') success Entities::Event end params do @@ -58,7 +58,7 @@ module API allow_access_with_scope :read_user, if: -> (request) { request.get? } desc 'Get the contribution events of a specified user' do - detail 'This feature was introduced in GitLab 8.13.' + detail _('This feature was introduced in GitLab 8.13.') success Entities::Event end params do diff --git a/lib/api/files.rb b/lib/api/files.rb index ca59d330e1c..38fc315a18f 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -62,7 +62,7 @@ module API params :simple_file_params do requires :file_path, type: String, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb' - requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide `start_branch`.', allow_blank: false + requires :branch, type: String, desc: _('Name of the branch to commit into. To create a new branch, also provide `start_branch`.'), allow_blank: false requires :commit_message, type: String, allow_blank: false, desc: 'Commit message' optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from' optional :author_email, type: String, desc: 'The email of the author' diff --git a/lib/api/group_milestones.rb b/lib/api/group_milestones.rb index d4287e4a7c4..facf34c9d1d 100644 --- a/lib/api/group_milestones.rb +++ b/lib/api/group_milestones.rb @@ -82,7 +82,7 @@ module API end desc 'Get all merge requests for a single group milestone' do - detail 'This feature was introduced in GitLab 9.' + detail _('This feature was introduced in GitLab 9.') success Entities::MergeRequestBasic end params do diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 64958ff982a..4ae2f75f514 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -106,7 +106,7 @@ module API present_groups params, groups end - desc 'Create a group. Available only for users who can create groups.' do + desc _('Create a group. Available only for users who can create groups.') do success Entities::Group end params do @@ -141,7 +141,7 @@ module API requires :id, type: String, desc: 'The ID of a group' end resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do - desc 'Update a group. Available only for users who can administrate groups.' do + desc _('Update a group. Available only for users who can administrate groups.') do success Entities::Group end params do @@ -160,7 +160,7 @@ module API end end - desc 'Get a single group, with containing projects.' do + desc _('Get a single group, with containing projects.') do success Entities::GroupDetail end params do @@ -180,7 +180,7 @@ module API present group, options end - desc 'Remove a group.' + desc _('Remove a group.') delete ":id" do group = find_group!(params[:id]) authorize! :admin_group, group @@ -193,7 +193,7 @@ module API accepted! end - desc 'Get a list of projects in this group.' do + desc _('Get a list of projects in this group.') do success Entities::Project end params do @@ -230,7 +230,7 @@ module API present options[:with].prepare_relation(projects), options end - desc 'Get a list of subgroups in this group.' do + desc _('Get a list of subgroups in this group.') do success Entities::Group end params do @@ -242,7 +242,7 @@ module API present_groups params, groups end - desc 'Transfer a project to the group namespace. Available only for admin.' do + desc _('Transfer a project to the group namespace. Available only for admin.') do success Entities::GroupDetail end params do diff --git a/lib/api/helpers/projects_helpers.rb b/lib/api/helpers/projects_helpers.rb index e6a72b949f9..1f60f11e0f7 100644 --- a/lib/api/helpers/projects_helpers.rb +++ b/lib/api/helpers/projects_helpers.rb @@ -19,7 +19,7 @@ module API optional :resolve_outdated_diff_discussions, type: Boolean, desc: 'Automatically resolve merge request diffs discussions on lines changed with a push' optional :container_registry_enabled, type: Boolean, desc: 'Flag indication if the container registry is enabled for that project' optional :lfs_enabled, type: Boolean, desc: 'Flag indication if Git LFS is enabled for that project' - optional :visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: 'The visibility of the project.' + optional :visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: _('The visibility of the project.') optional :public_builds, type: Boolean, desc: 'Perform public builds' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' optional :only_allow_merge_if_pipeline_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed' diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb index 45d0343bc89..5ab5677a3a9 100644 --- a/lib/api/helpers/runner.rb +++ b/lib/api/helpers/runner.rb @@ -39,8 +39,8 @@ module API yield if block_given? project = job.project - forbidden!('Project has been deleted!') if project.nil? || project.pending_delete? - forbidden!('Job has been erased!') if job.erased? + forbidden!(_('Project has been deleted!')) if project.nil? || project.pending_delete? + forbidden!(_('Job has been erased!')) if job.erased? end def authenticate_job! diff --git a/lib/api/helpers/version.rb b/lib/api/helpers/version.rb index 7f53094e90c..1ef1693d81a 100644 --- a/lib/api/helpers/version.rb +++ b/lib/api/helpers/version.rb @@ -9,7 +9,7 @@ module API @version = version.to_s unless API.versions.include?(version) - raise ArgumentError, 'Unknown API version!' + raise ArgumentError, _('Unknown API version!') end end diff --git a/lib/api/import_github.rb b/lib/api/import_github.rb index bb4e536cf57..e7b882a7c23 100644 --- a/lib/api/import_github.rb +++ b/lib/api/import_github.rb @@ -23,7 +23,7 @@ module API end desc 'Import a GitHub project' do - detail 'This feature was introduced in GitLab 11.3.4.' + detail _('This feature was introduced in GitLab 11.3.4.') success Entities::ProjectEntity end params do diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 9488b3469d9..2d190abf989 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -112,9 +112,9 @@ module API actor.update_last_used_at elsif params[:user_id] actor = User.find_by(id: params[:user_id]) - raise ActiveRecord::RecordNotFound.new("No such user id!") unless actor + raise ActiveRecord::RecordNotFound.new(_("No such user id!")) unless actor else - raise ActiveRecord::RecordNotFound.new("No key_id or user_id passed!") + raise ActiveRecord::RecordNotFound.new(_("No key_id or user_id passed!")) end token_handler = Gitlab::LfsToken.new(actor) diff --git a/lib/api/issues.rb b/lib/api/issues.rb index dac700482b4..bedb1925a96 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -38,9 +38,9 @@ module API optional :labels, type: String, desc: 'Comma-separated list of label names' optional :milestone, type: String, desc: 'Milestone title' optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at', - desc: 'Return issues ordered by `created_at` or `updated_at` fields.' + desc: _('Return issues ordered by `created_at` or `updated_at` fields.') optional :sort, type: String, values: %w[asc desc], default: 'desc', - desc: 'Return issues sorted in `asc` or `desc` order.' + desc: _('Return issues sorted in `asc` or `desc` order.') optional :milestone, type: String, desc: 'Return issues for a specific milestone' optional :iids, type: Array[Integer], desc: 'The IID array of issues' optional :search, type: String, desc: 'Search issues for text present in the title or description' @@ -171,13 +171,13 @@ module API params do requires :title, type: String, desc: 'The title of an issue' optional :created_at, type: DateTime, - desc: 'Date time when the issue was created. Available only for admins and project owners.' + desc: _('Date time when the issue was created. Available only for admins and project owners.') optional :merge_request_to_resolve_discussions_of, type: Integer, desc: 'The IID of a merge request for which to resolve discussions' optional :discussion_to_resolve, type: String, desc: 'The ID of a discussion to resolve, also pass `merge_request_to_resolve_discussions_of`' optional :iid, type: Integer, - desc: 'The internal ID of a project issue. Available only for admins and project owners.' + desc: _('The internal ID of a project issue. Available only for admins and project owners.') use :issue_params end @@ -215,7 +215,7 @@ module API requires :issue_iid, type: Integer, desc: 'The internal ID of a project issue' optional :title, type: String, desc: 'The title of an issue' optional :updated_at, type: DateTime, - desc: 'Date time when the issue was updated. Available only for admins and project owners.' + desc: _('Date time when the issue was updated. Available only for admins and project owners.') optional :state_event, type: String, values: %w[reopen close], desc: 'State of the issue' use :issue_params at_least_one_of :title, :description, :assignee_ids, :assignee_id, :milestone_id, :discussion_locked, diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index 45c694b6448..66a941dda84 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -150,7 +150,7 @@ module API build = find_build!(params[:job_id]) authorize!(:erase_build, build) - break forbidden!('Job is not erasable!') unless build.erasable? + break forbidden!(_('Job is not erasable!')) unless build.erasable? build.erase(erased_by: current_user) present build, with: Entities::Job diff --git a/lib/api/labels.rb b/lib/api/labels.rb index 2e676b0aa6b..22efc32d8b5 100644 --- a/lib/api/labels.rb +++ b/lib/api/labels.rb @@ -65,7 +65,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Update an existing label. At least one optional parameter is required.' do + desc _('Update an existing label. At least one optional parameter is required.') do success Entities::Label end params do diff --git a/lib/api/markdown.rb b/lib/api/markdown.rb index de77bef43ce..63986e2fd1a 100644 --- a/lib/api/markdown.rb +++ b/lib/api/markdown.rb @@ -9,7 +9,7 @@ module API end resource :markdown do desc "Render markdown text" do - detail "This feature was introduced in GitLab 11.0." + detail _("This feature was introduced in GitLab 11.0.") end post do context = { only_path: false, current_user: current_user } diff --git a/lib/api/members.rb b/lib/api/members.rb index 461ffe71a62..03f45858a33 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -13,7 +13,7 @@ module API requires :id, type: String, desc: "The #{source_type} ID" end resource source_type.pluralize, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do - desc 'Gets a list of group or project members viewable by the authenticated user.' do + desc _('Gets a list of group or project members viewable by the authenticated user.') do success Entities::Member end params do @@ -32,7 +32,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Gets a list of group or project members viewable by the authenticated user, including those who gained membership through ancestor group.' do + desc _('Gets a list of group or project members viewable by the authenticated user, including those who gained membership through ancestor group.') do success Entities::Member end params do @@ -51,7 +51,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Gets a member of a group or project.' do + desc _('Gets a member of a group or project.') do success Entities::Member end params do @@ -68,7 +68,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Adds a member to a group or project.' do + desc _('Adds a member to a group or project.') do success Entities::Member end params do @@ -99,7 +99,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Updates a member of a group or project.' do + desc _('Updates a member of a group or project.') do success Entities::Member end params do @@ -126,7 +126,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Removes a user from a group or project.' + desc _('Removes a user from a group or project.') params do requires :user_id, type: Integer, desc: 'The user ID of the member' end diff --git a/lib/api/merge_request_diffs.rb b/lib/api/merge_request_diffs.rb index 6ad30aa56e0..adf39316df3 100644 --- a/lib/api/merge_request_diffs.rb +++ b/lib/api/merge_request_diffs.rb @@ -12,7 +12,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get a list of merge request diff versions' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::MergeRequestDiff end @@ -27,7 +27,7 @@ module API end desc 'Get a single merge request diff version' do - detail 'This feature was introduced in GitLab 8.12.' + detail _('This feature was introduced in GitLab 8.12.') success Entities::MergeRequestDiffFull end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 132b19164d0..b28456f7e60 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -91,9 +91,9 @@ module API optional :state, type: String, values: %w[opened closed locked merged all], default: 'all', desc: 'Return opened, closed, locked, merged, or all merge requests' optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at', - desc: 'Return merge requests ordered by `created_at` or `updated_at` fields.' + desc: _('Return merge requests ordered by `created_at` or `updated_at` fields.') optional :sort, type: String, values: %w[asc desc], default: 'desc', - desc: 'Return merge requests sorted in `asc` or `desc` order.' + desc: _('Return merge requests sorted in `asc` or `desc` order.') optional :milestone, type: String, desc: 'Return merge requests for a specific milestone' optional :labels, type: String, desc: 'Comma-separated list of label names' optional :created_after, type: DateTime, desc: 'Return merge requests created after the specified time' diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 1bdf7aeb119..f5ddc3a0415 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -25,9 +25,9 @@ module API params do requires :noteable_id, type: Integer, desc: 'The ID of the noteable' optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at', - desc: 'Return notes ordered by `created_at` or `updated_at` fields.' + desc: _('Return notes ordered by `created_at` or `updated_at` fields.') optional :sort, type: String, values: %w[asc desc], default: 'desc', - desc: 'Return notes sorted in `asc` or `desc` order.' + desc: _('Return notes sorted in `asc` or `desc` order.') use :pagination end # rubocop: disable CodeReuse/ActiveRecord diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 7a7b23d2bbb..06a0977696b 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -11,7 +11,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get all Pipelines of the project' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::PipelineBasic end params do @@ -97,7 +97,7 @@ module API end desc 'Retry builds in the pipeline' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Pipeline end params do @@ -112,7 +112,7 @@ module API end desc 'Cancel all builds in the pipeline' do - detail 'This feature was introduced in GitLab 8.11.' + detail _('This feature was introduced in GitLab 8.11.') success Entities::Pipeline end params do diff --git a/lib/api/project_clusters.rb b/lib/api/project_clusters.rb index c96261a7b57..bfb837563de 100644 --- a/lib/api/project_clusters.rb +++ b/lib/api/project_clusters.rb @@ -21,7 +21,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get all clusters from the project' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Cluster end params do @@ -34,7 +34,7 @@ module API end desc 'Get specific cluster for the project' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::ClusterProject end params do @@ -47,7 +47,7 @@ module API end desc 'Adds an existing cluster' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::ClusterProject end params do @@ -77,7 +77,7 @@ module API end desc 'Update an existing cluster' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::ClusterProject end params do @@ -104,7 +104,7 @@ module API end desc 'Remove a cluster' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::ClusterProject end params do diff --git a/lib/api/project_export.rb b/lib/api/project_export.rb index e34ed0bdb44..62f97a1065e 100644 --- a/lib/api/project_export.rb +++ b/lib/api/project_export.rb @@ -12,7 +12,7 @@ module API end resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get export status' do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::ProjectExportStatus end get ':id/export' do @@ -20,7 +20,7 @@ module API end desc 'Download export' do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') end get ':id/export/download' do if user_project.export_file_exists? @@ -31,7 +31,7 @@ module API end desc 'Start export' do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') end params do optional :description, type: String, desc: 'Override the project description' diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb index c64ec2fcc95..2e9ae36b662 100644 --- a/lib/api/project_import.rb +++ b/lib/api/project_import.rb @@ -27,7 +27,7 @@ module API params do requires :path, type: String, desc: 'The new project path and name' requires :file, type: File, desc: 'The project export file to be imported' - optional :namespace, type: String, desc: "The ID or name of the namespace that the project will be imported into. Defaults to the current user's namespace." + optional :namespace, type: String, desc: _("The ID or name of the namespace that the project will be imported into. Defaults to the current user's namespace.") optional :overwrite, type: Boolean, default: false, desc: 'If there is a project in the same namespace and with the same name overwrite it' optional :override_params, type: Hash, @@ -36,7 +36,7 @@ module API end end desc 'Create a new project import' do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::ProjectImportStatus end post 'import' do @@ -72,7 +72,7 @@ module API requires :id, type: String, desc: 'The ID of a project' end desc 'Get a project export status' do - detail 'This feature was introduced in GitLab 10.6.' + detail _('This feature was introduced in GitLab 10.6.') success Entities::ProjectImportStatus end get ':id/import' do diff --git a/lib/api/project_milestones.rb b/lib/api/project_milestones.rb index da31bcb8dac..b8908c8283f 100644 --- a/lib/api/project_milestones.rb +++ b/lib/api/project_milestones.rb @@ -86,7 +86,7 @@ module API end desc 'Get all merge requests for a single project milestone' do - detail 'This feature was introduced in GitLab 9.' + detail _('This feature was introduced in GitLab 9.') success Entities::MergeRequestBasic end params do diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 9f3a1699146..9653bbc44e6 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -97,7 +97,7 @@ module API end params :create_params do - optional :namespace_id, type: Integer, desc: 'Namespace ID for the new project. Default to the user namespace.' + optional :namespace_id, type: Integer, desc: _('Namespace ID for the new project. Default to the user namespace.') optional :import_url, type: String, desc: 'URL from which the project is imported' end @@ -190,7 +190,7 @@ module API end end - desc 'Create new project for a specified user. Only available to admin users.' do + desc _('Create new project for a specified user. Only available to admin users.') do success Entities::Project end params do @@ -249,7 +249,7 @@ module API present project, options end - desc 'Fork new project for the current user or provided namespace.' do + desc _('Fork new project for the current user or provided namespace.') do success Entities::Project end params do @@ -493,7 +493,7 @@ module API end desc 'Start the housekeeping task for a project' do - detail 'This feature was introduced in GitLab 9.0.' + detail _('This feature was introduced in GitLab 9.0.') end post ':id/housekeeping' do authorize_admin_project diff --git a/lib/api/protected_tags.rb b/lib/api/protected_tags.rb index ee13473c848..519b23c280f 100644 --- a/lib/api/protected_tags.rb +++ b/lib/api/protected_tags.rb @@ -13,7 +13,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc "Get a project's protected tags" do - detail 'This feature was introduced in GitLab 11.3.' + detail _('This feature was introduced in GitLab 11.3.') success Entities::ProtectedTag end params do @@ -28,7 +28,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc 'Get a single protected tag' do - detail 'This feature was introduced in GitLab 11.3.' + detail _('This feature was introduced in GitLab 11.3.') success Entities::ProtectedTag end params do @@ -43,7 +43,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc 'Protect a single tag or wildcard' do - detail 'This feature was introduced in GitLab 11.3.' + detail _('This feature was introduced in GitLab 11.3.') success Entities::ProtectedTag end params do @@ -70,7 +70,7 @@ module API end desc 'Unprotect a single tag' do - detail 'This feature was introduced in GitLab 11.3.' + detail _('This feature was introduced in GitLab 11.3.') end params do requires :name, type: String, desc: 'The name of the protected tag' diff --git a/lib/api/release/links.rb b/lib/api/release/links.rb index e3072684ef7..9addf8adf0a 100644 --- a/lib/api/release/links.rb +++ b/lib/api/release/links.rb @@ -18,7 +18,7 @@ module API resource 'releases/:tag_name', requirements: RELEASE_ENDPOINT_REQUIREMETS do resource :assets do desc 'Get a list of links of a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Releases::Link end params do @@ -31,7 +31,7 @@ module API end desc 'Create a link of a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Releases::Link end params do @@ -55,7 +55,7 @@ module API end resource 'links/:link_id' do desc 'Get a link detail of a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Releases::Link end get do @@ -65,7 +65,7 @@ module API end desc 'Update a link of a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Releases::Link end params do @@ -84,7 +84,7 @@ module API end desc 'Delete a link of a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Releases::Link end delete do diff --git a/lib/api/releases.rb b/lib/api/releases.rb index 576fee51db0..1a06004bcb6 100644 --- a/lib/api/releases.rb +++ b/lib/api/releases.rb @@ -14,7 +14,7 @@ module API end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Get a project releases' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Release end params do @@ -27,7 +27,7 @@ module API end desc 'Get a single project release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Release end params do @@ -40,7 +40,7 @@ module API end desc 'Create a new release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Release end params do @@ -70,7 +70,7 @@ module API end desc 'Update a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Release end params do @@ -93,7 +93,7 @@ module API end desc 'Delete a release' do - detail 'This feature was introduced in GitLab 11.7.' + detail _('This feature was introduced in GitLab 11.7.') success Entities::Release end params do diff --git a/lib/api/runner.rb b/lib/api/runner.rb index c60d25b88cb..50ca31925b9 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -259,12 +259,12 @@ module API require_gitlab_workhorse! job = authenticate_job! - forbidden!('Job is not running!') unless job.running? + forbidden!(_('Job is not running!')) unless job.running? artifacts = UploadedFile.from_params(params, :file, JobArtifactUploader.workhorse_local_upload_path) metadata = UploadedFile.from_params(params, :metadata, JobArtifactUploader.workhorse_local_upload_path) - bad_request!('Missing artifacts file!') unless artifacts + bad_request!(_('Missing artifacts file!')) unless artifacts file_to_large! unless artifacts.size < max_artifacts_size expire_in = params['expire_in'] || diff --git a/lib/api/search.rb b/lib/api/search.rb index f5db692afe5..b4f439d39c2 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -49,7 +49,7 @@ module API resource :search do desc 'Search on GitLab' do - detail 'This feature was introduced in GitLab 10.5.' + detail _('This feature was introduced in GitLab 10.5.') end params do requires :search, type: String, desc: 'The expression it should be searched for' @@ -67,7 +67,7 @@ module API resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Search on GitLab' do - detail 'This feature was introduced in GitLab 10.5.' + detail _('This feature was introduced in GitLab 10.5.') end params do requires :id, type: String, desc: 'The ID of a group' @@ -86,7 +86,7 @@ module API resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do desc 'Search on GitLab' do - detail 'This feature was introduced in GitLab 10.5.' + detail _('This feature was introduced in GitLab 10.5.') end params do requires :id, type: String, desc: 'The ID of a project' diff --git a/lib/api/settings.rb b/lib/api/settings.rb index 95371961398..8706c695dec 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -22,7 +22,7 @@ module API success Entities::ApplicationSetting end params do - optional :admin_notification_email, type: String, desc: 'Abuse reports will be sent to this address if it is set. Abuse reports are always available in the admin area.' + optional :admin_notification_email, type: String, desc: _('Abuse reports will be sent to this address if it is set. Abuse reports are always available in the admin area.') optional :after_sign_up_text, type: String, desc: 'Text shown after sign up' optional :after_sign_out_path, type: String, desc: 'We will redirect users to this page after they sign out' optional :akismet_enabled, type: Boolean, desc: 'Helps prevent bots from creating issues' @@ -46,11 +46,11 @@ module API requires :domain_blacklist, type: String, desc: 'Users with e-mail addresses that match these domain(s) will NOT be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com' end optional :domain_whitelist, type: String, desc: 'ONLY users with e-mail addresses that match these domain(s) will be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com' - optional :email_author_in_body, type: Boolean, desc: 'Some email servers do not support overriding the email sender name. Enable this option to include the name of the author of the issue, merge request or comment in the email body instead.' - optional :enabled_git_access_protocol, type: String, values: %w[ssh http nil], desc: 'Allow only the selected protocols to be used for Git access.' - optional :gitaly_timeout_default, type: Integer, desc: 'Default Gitaly timeout, in seconds. Set to 0 to disable timeouts.' - optional :gitaly_timeout_fast, type: Integer, desc: 'Gitaly fast operation timeout, in seconds. Set to 0 to disable timeouts.' - optional :gitaly_timeout_medium, type: Integer, desc: 'Medium Gitaly timeout, in seconds. Set to 0 to disable timeouts.' + optional :email_author_in_body, type: Boolean, desc: _('Some email servers do not support overriding the email sender name. Enable this option to include the name of the author of the issue, merge request or comment in the email body instead.') + optional :enabled_git_access_protocol, type: String, values: %w[ssh http nil], desc: _('Allow only the selected protocols to be used for Git access.') + optional :gitaly_timeout_default, type: Integer, desc: _('Default Gitaly timeout, in seconds. Set to 0 to disable timeouts.') + optional :gitaly_timeout_fast, type: Integer, desc: _('Gitaly fast operation timeout, in seconds. Set to 0 to disable timeouts.') + optional :gitaly_timeout_medium, type: Integer, desc: _('Medium Gitaly timeout, in seconds. Set to 0 to disable timeouts.') optional :gravatar_enabled, type: Boolean, desc: 'Flag indicating if the Gravatar service is enabled' optional :help_page_hide_commercial_content, type: Boolean, desc: 'Hide marketing-related entries from help' optional :help_page_support_url, type: String, desc: 'Alternate support URL for help page' @@ -58,12 +58,12 @@ module API optional :home_page_url, type: String, desc: 'We will redirect non-logged in users to this page' optional :housekeeping_enabled, type: Boolean, desc: 'Enable automatic repository housekeeping (git repack, git gc)' given housekeeping_enabled: ->(val) { val } do - requires :housekeeping_bitmaps_enabled, type: Boolean, desc: "Creating pack file bitmaps makes housekeeping take a little longer but bitmaps should accelerate 'git clone' performance." - requires :housekeeping_full_repack_period, type: Integer, desc: "Number of Git pushes after which a full 'git repack' is run." - requires :housekeeping_gc_period, type: Integer, desc: "Number of Git pushes after which 'git gc' is run." - requires :housekeeping_incremental_repack_period, type: Integer, desc: "Number of Git pushes after which an incremental 'git repack' is run." + requires :housekeeping_bitmaps_enabled, type: Boolean, desc: _("Creating pack file bitmaps makes housekeeping take a little longer but bitmaps should accelerate 'git clone' performance.") + requires :housekeeping_full_repack_period, type: Integer, desc: _("Number of Git pushes after which a full 'git repack' is run.") + requires :housekeeping_gc_period, type: Integer, desc: _("Number of Git pushes after which 'git gc' is run.") + requires :housekeeping_incremental_repack_period, type: Integer, desc: _("Number of Git pushes after which an incremental 'git repack' is run.") end - optional :html_emails_enabled, type: Boolean, desc: 'By default GitLab sends emails in HTML and plain text formats so mail clients can choose what format to use. Disable this option if you only want to send emails in plain text format.' + optional :html_emails_enabled, type: Boolean, desc: _('By default GitLab sends emails in HTML and plain text formats so mail clients can choose what format to use. Disable this option if you only want to send emails in plain text format.') optional :import_sources, type: Array[String], values: %w[github bitbucket gitlab google_code fogbugz git gitlab_project manifest], desc: 'Enabled sources for code import during project creation. OmniAuth must be configured for GitHub, Bitbucket, and GitLab.com' optional :max_artifacts_size, type: Integer, desc: "Set the maximum file size for each job's artifacts" @@ -72,7 +72,7 @@ module API optional :metrics_enabled, type: Boolean, desc: 'Enable the InfluxDB metrics' given metrics_enabled: ->(val) { val } do requires :metrics_host, type: String, desc: 'The InfluxDB host' - requires :metrics_method_call_threshold, type: Integer, desc: 'A method call is only tracked when it takes longer to complete than the given amount of milliseconds.' + requires :metrics_method_call_threshold, type: Integer, desc: _('A method call is only tracked when it takes longer to complete than the given amount of milliseconds.') requires :metrics_packet_size, type: Integer, desc: 'The amount of points to store in a single UDP packet' requires :metrics_pool_size, type: Integer, desc: 'The amount of InfluxDB connections to open' requires :metrics_port, type: Integer, desc: 'The UDP port to use for connecting to InfluxDB' @@ -84,13 +84,13 @@ module API mutually_exclusive :password_authentication_enabled_for_web, :password_authentication_enabled, :signin_enabled optional :password_authentication_enabled_for_git, type: Boolean, desc: 'Flag indicating if password authentication is enabled for Git over HTTP(S)' optional :performance_bar_allowed_group_id, type: String, desc: 'Deprecated: Use :performance_bar_allowed_group_path instead. Path of the group that is allowed to toggle the performance bar.' # support legacy names, can be removed in v6 - optional :performance_bar_allowed_group_path, type: String, desc: 'Path of the group that is allowed to toggle the performance bar.' + optional :performance_bar_allowed_group_path, type: String, desc: _('Path of the group that is allowed to toggle the performance bar.') optional :performance_bar_enabled, type: String, desc: 'Deprecated: Pass `performance_bar_allowed_group_path: nil` instead. Allow enabling the performance.' # support legacy names, can be removed in v6 optional :plantuml_enabled, type: Boolean, desc: 'Enable PlantUML' given plantuml_enabled: ->(val) { val } do requires :plantuml_url, type: String, desc: 'The PlantUML server URL' end - optional :polling_interval_multiplier, type: BigDecimal, desc: 'Interval multiplier used by endpoints that perform polling. Set to 0 to disable polling.' + optional :polling_interval_multiplier, type: BigDecimal, desc: _('Interval multiplier used by endpoints that perform polling. Set to 0 to disable polling.') optional :project_export_enabled, type: Boolean, desc: 'Enable project export' optional :prometheus_metrics_enabled, type: Boolean, desc: 'Enable Prometheus metrics' optional :recaptcha_enabled, type: Boolean, desc: 'Helps prevent bots from creating accounts' @@ -98,19 +98,19 @@ module API requires :recaptcha_site_key, type: String, desc: 'Generate site key at http://www.google.com/recaptcha' requires :recaptcha_private_key, type: String, desc: 'Generate private key at http://www.google.com/recaptcha' end - optional :repository_checks_enabled, type: Boolean, desc: "GitLab will periodically run 'git fsck' in all project and wiki repositories to look for silent disk corruption issues." + optional :repository_checks_enabled, type: Boolean, desc: _("GitLab will periodically run 'git fsck' in all project and wiki repositories to look for silent disk corruption issues.") optional :repository_storages, type: Array[String], desc: 'Storage paths for new projects' optional :require_two_factor_authentication, type: Boolean, desc: 'Require all users to set up Two-factor authentication' given require_two_factor_authentication: ->(val) { val } do requires :two_factor_grace_period, type: Integer, desc: 'Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication' end - optional :restricted_visibility_levels, type: Array[String], desc: 'Selected levels cannot be used by non-admin users for groups, projects or snippets. If the public level is restricted, user profiles are only visible to logged in users.' + optional :restricted_visibility_levels, type: Array[String], desc: _('Selected levels cannot be used by non-admin users for groups, projects or snippets. If the public level is restricted, user profiles are only visible to logged in users.') optional :send_user_confirmation_email, type: Boolean, desc: 'Send confirmation email on sign-up' optional :sentry_enabled, type: Boolean, desc: 'Sentry is an error reporting and logging tool which is currently not shipped with GitLab, get it here: https://getsentry.com' given sentry_enabled: ->(val) { val } do requires :sentry_dsn, type: String, desc: 'Sentry Data Source Name' end - optional :session_expire_delay, type: Integer, desc: 'Session duration in minutes. GitLab restart is required to apply changes.' + optional :session_expire_delay, type: Integer, desc: _('Session duration in minutes. GitLab restart is required to apply changes.') optional :shared_runners_enabled, type: Boolean, desc: 'Enable shared runners for new projects' given shared_runners_enabled: ->(val) { val } do requires :shared_runners_text, type: String, desc: 'Shared runners text ' @@ -118,8 +118,8 @@ module API optional :sign_in_text, type: String, desc: 'The sign in text of the GitLab application' optional :signin_enabled, type: Boolean, desc: 'Flag indicating if password authentication is enabled for the web interface' # support legacy names, can be removed in v5 optional :signup_enabled, type: Boolean, desc: 'Flag indicating if sign up is enabled' - optional :terminal_max_session_time, type: Integer, desc: 'Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.' - optional :usage_ping_enabled, type: Boolean, desc: 'Every week GitLab will report license usage back to GitLab, Inc.' + optional :terminal_max_session_time, type: Integer, desc: _('Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.') + optional :usage_ping_enabled, type: Boolean, desc: _('Every week GitLab will report license usage back to GitLab, Inc.') optional :instance_statistics_visibility_private, type: Boolean, desc: 'When set to `true` Instance statistics will only be available to admins' ApplicationSetting::SUPPORTED_KEY_TYPES.each do |type| diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index 326d55afd0e..cca0e055bc2 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -19,7 +19,7 @@ module API end desc 'Get a snippets list for authenticated user' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -30,7 +30,7 @@ module API end desc 'List all public snippets current_user has access to' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -41,7 +41,7 @@ module API end desc 'Get a single snippet' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -53,7 +53,7 @@ module API end desc 'Create new snippet' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -80,7 +80,7 @@ module API end desc 'Update an existing snippet' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -116,7 +116,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc 'Remove snippet' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') success Entities::PersonalSnippet end params do @@ -134,7 +134,7 @@ module API # rubocop: enable CodeReuse/ActiveRecord desc 'Get a raw snippet' do - detail 'This feature was introduced in GitLab 8.15.' + detail _('This feature was introduced in GitLab 8.15.') end params do requires :id, type: Integer, desc: 'The ID of a snippet' diff --git a/lib/api/submodules.rb b/lib/api/submodules.rb index 72d7d994102..2c40458d8b9 100644 --- a/lib/api/submodules.rb +++ b/lib/api/submodules.rb @@ -23,10 +23,10 @@ module API success Entities::Commit end params do - requires :submodule, type: String, desc: 'Url encoded full path to submodule.' - requires :commit_sha, type: String, desc: 'Commit sha to update the submodule to.' - requires :branch, type: String, desc: 'Name of the branch to commit into.' - optional :commit_message, type: String, desc: 'Commit message. If no message is provided a default one will be set.' + requires :submodule, type: String, desc: _('Url encoded full path to submodule.') + requires :commit_sha, type: String, desc: _('Commit sha to update the submodule to.') + requires :branch, type: String, desc: _('Name of the branch to commit into.') + optional :commit_message, type: String, desc: _('Commit message. If no message is provided a default one will be set.') end put ":id/repository/submodules/:submodule", requirements: Files::FILE_ENDPOINT_REQUIREMENTS do authorize! :push_code, user_project diff --git a/lib/api/tags.rb b/lib/api/tags.rb index f5359fd316c..e1a78da1d4b 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -17,9 +17,9 @@ module API end params do optional :sort, type: String, values: %w[asc desc], default: 'desc', - desc: 'Return tags sorted in updated by `asc` or `desc` order.' + desc: _('Return tags sorted in updated by `asc` or `desc` order.') optional :order_by, type: String, values: %w[name updated], default: 'updated', - desc: 'Return tags ordered by `name` or `updated` fields.' + desc: _('Return tags ordered by `name` or `updated` fields.') optional :search, type: String, desc: 'Return list of tags matching the search criteria' use :pagination end @@ -45,7 +45,7 @@ module API end desc 'Create a new repository tag' do - detail 'This optional release_description parameter was deprecated in GitLab 11.7.' + detail _('This optional release_description parameter was deprecated in GitLab 11.7.') success Entities::Tag end params do @@ -105,7 +105,7 @@ module API end desc 'Add a release note to a tag' do - detail 'This feature was deprecated in GitLab 11.7.' + detail _('This feature was deprecated in GitLab 11.7.') success Entities::TagRelease end params do @@ -137,7 +137,7 @@ module API end desc "Update a tag's release note" do - detail 'This feature was deprecated in GitLab 11.7.' + detail _('This feature was deprecated in GitLab 11.7.') success Entities::TagRelease end params do diff --git a/lib/api/templates.rb b/lib/api/templates.rb index 51f357d9477..f9840007c05 100644 --- a/lib/api/templates.rb +++ b/lib/api/templates.rb @@ -24,7 +24,7 @@ module API end desc 'Get the list of the available license template' do - detail 'This feature was introduced in GitLab 8.7.' + detail _('This feature was introduced in GitLab 8.7.') success ::API::Entities::License end params do @@ -41,7 +41,7 @@ module API end desc 'Get the text for a specific license' do - detail 'This feature was introduced in GitLab 8.7.' + detail _('This feature was introduced in GitLab 8.7.') success ::API::Entities::License end params do diff --git a/lib/api/users.rb b/lib/api/users.rb index b41fce76df0..115f1d32218 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -142,7 +142,7 @@ module API present user.status || {}, with: Entities::UserStatus end - desc 'Create a user. Available only for admins.' do + desc _('Create a user. Available only for admins.') do success Entities::UserPublic end params do @@ -176,7 +176,7 @@ module API end end - desc 'Update a user. Available only for admins.' do + desc _('Update a user. Available only for admins.') do success Entities::UserPublic end params do @@ -229,7 +229,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Add an SSH key to a specified user. Available only for admins.' do + desc _('Add an SSH key to a specified user. Available only for admins.') do success Entities::SSHKey end params do @@ -254,7 +254,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Get the SSH keys of a specified user.' do + desc _('Get the SSH keys of a specified user.') do success Entities::SSHKey end params do @@ -270,7 +270,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Delete an existing SSH key from a specified user. Available only for admins.' do + desc _('Delete an existing SSH key from a specified user. Available only for admins.') do success Entities::SSHKey end params do @@ -291,7 +291,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Add a GPG key to a specified user. Available only for admins.' do + desc _('Add a GPG key to a specified user. Available only for admins.') do detail 'This feature was added in GitLab 10.0' success Entities::GPGKey end @@ -316,7 +316,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Get the GPG keys of a specified user. Available only for admins.' do + desc _('Get the GPG keys of a specified user. Available only for admins.') do detail 'This feature was added in GitLab 10.0' success Entities::GPGKey end @@ -335,7 +335,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Delete an existing GPG key from a specified user. Available only for admins.' do + desc _('Delete an existing GPG key from a specified user. Available only for admins.') do detail 'This feature was added in GitLab 10.0' end params do @@ -357,7 +357,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Revokes an existing GPG key from a specified user. Available only for admins.' do + desc _('Revokes an existing GPG key from a specified user. Available only for admins.') do detail 'This feature was added in GitLab 10.0' end params do @@ -379,7 +379,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Add an email address to a specified user. Available only for admins.' do + desc _('Add an email address to a specified user. Available only for admins.') do success Entities::Email end params do @@ -404,7 +404,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Get the emails addresses of a specified user. Available only for admins.' do + desc _('Get the emails addresses of a specified user. Available only for admins.') do success Entities::Email end params do @@ -421,7 +421,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Delete an email address of a specified user. Available only for admins.' do + desc _('Delete an email address of a specified user. Available only for admins.') do success Entities::Email end params do @@ -443,7 +443,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Delete a user. Available only for admins.' do + desc _('Delete a user. Available only for admins.') do success Entities::Email end params do @@ -465,7 +465,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Block a user. Available only for admins.' + desc _('Block a user. Available only for admins.') params do requires :id, type: Integer, desc: 'The ID of the user' end @@ -483,7 +483,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Unblock a user. Available only for admins.' + desc _('Unblock a user. Available only for admins.') params do requires :id, type: Integer, desc: 'The ID of the user' end @@ -519,7 +519,7 @@ module API before { authenticated_as_admin! } - desc 'Retrieve impersonation tokens. Available only for admins.' do + desc _('Retrieve impersonation tokens. Available only for admins.') do detail 'This feature was introduced in GitLab 9.0' success Entities::ImpersonationToken end @@ -529,7 +529,7 @@ module API end get { present paginate(finder(declared_params(include_missing: false)).execute), with: Entities::ImpersonationToken } - desc 'Create a impersonation token. Available only for admins.' do + desc _('Create a impersonation token. Available only for admins.') do detail 'This feature was introduced in GitLab 9.0' success Entities::ImpersonationTokenWithToken end @@ -548,7 +548,7 @@ module API end end - desc 'Retrieve impersonation token. Available only for admins.' do + desc _('Retrieve impersonation token. Available only for admins.') do detail 'This feature was introduced in GitLab 9.0' success Entities::ImpersonationToken end @@ -559,7 +559,7 @@ module API present find_impersonation_token, with: Entities::ImpersonationToken end - desc 'Revoke a impersonation token. Available only for admins.' do + desc _('Revoke a impersonation token. Available only for admins.') do detail 'This feature was introduced in GitLab 9.0' end params do diff --git a/lib/api/version.rb b/lib/api/version.rb index 74cd857f447..2dcce703b2a 100644 --- a/lib/api/version.rb +++ b/lib/api/version.rb @@ -4,8 +4,8 @@ module API class Version < Grape::API before { authenticate! } - desc 'Get the version information of the GitLab instance.' do - detail 'This feature was introduced in GitLab 8.13.' + desc _('Get the version information of the GitLab instance.') do + detail _('This feature was introduced in GitLab 8.13.') end get '/version' do { version: Gitlab::VERSION, revision: Gitlab.revision } diff --git a/lib/api/wikis.rb b/lib/api/wikis.rb index ef0e3decc2c..30a87069b38 100644 --- a/lib/api/wikis.rb +++ b/lib/api/wikis.rb @@ -98,7 +98,7 @@ module API end desc 'Upload an attachment to the wiki repository' do - detail 'This feature was introduced in GitLab 11.3.' + detail _('This feature was introduced in GitLab 11.3.') success Entities::WikiAttachment end params do diff --git a/lib/backup/database.rb b/lib/backup/database.rb index e6bf3d1856f..036e4b5ff72 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -46,7 +46,7 @@ module Backup end report_success(success) - raise Backup::Error, 'Backup failed' unless success + raise Backup::Error, _('Backup failed') unless success end def restore diff --git a/lib/backup/files.rb b/lib/backup/files.rb index 2bac84846c5..ca088401abd 100644 --- a/lib/backup/files.rb +++ b/lib/backup/files.rb @@ -28,7 +28,7 @@ module Backup unless status.zero? puts output - raise Backup::Error, 'Backup failed' + raise Backup::Error, _('Backup failed') end run_pipeline!([%W(#{tar} --exclude=lost+found -C #{@backup_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) @@ -78,7 +78,7 @@ module Backup return if status.compact.all?(&:success?) regex = /^g?tar: \.: Cannot mkdir: No such file or directory$/ - raise Backup::Error, 'Backup failed' unless err_r.read =~ regex + raise Backup::Error, _('Backup failed') unless err_r.read =~ regex end end end diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 06b0338b1ed..aebb662d508 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -29,7 +29,7 @@ module Backup progress.puts "done".color(:green) else puts "creating archive #{tar_file} failed".color(:red) - raise Backup::Error, 'Backup failed' + raise Backup::Error, _('Backup failed') end upload @@ -55,7 +55,7 @@ module Backup progress.puts "done".color(:green) else puts "uploading backup to #{remote_directory} failed".color(:red) - raise Backup::Error, 'Backup failed' + raise Backup::Error, _('Backup failed') end end @@ -69,7 +69,7 @@ module Backup progress.puts "done".color(:green) else puts "deleting tmp directory '#{dir}' failed".color(:red) - raise Backup::Error, 'Backup failed' + raise Backup::Error, _('Backup failed') end end end diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb index 9c14b26c65a..a492c99d6d7 100644 --- a/lib/bitbucket_server/connection.rb +++ b/lib/bitbucket_server/connection.rb @@ -77,7 +77,7 @@ module BitbucketServer private def check_errors!(response) - raise ConnectionError, "Response is not valid JSON" unless response.parsed_response.is_a?(Hash) + raise ConnectionError, _("Response is not valid JSON") unless response.parsed_response.is_a?(Hash) return if response.code >= 200 && response.code < 300 @@ -87,7 +87,7 @@ module BitbucketServer raise ConnectionError, message rescue JSON::ParserError - raise ConnectionError, "Unable to parse the server response as JSON" + raise ConnectionError, _("Unable to parse the server response as JSON") end def auth diff --git a/lib/declarative_policy.rb b/lib/declarative_policy.rb index 7ba48ae9c79..8473ac9e6ef 100644 --- a/lib/declarative_policy.rb +++ b/lib/declarative_policy.rb @@ -92,7 +92,7 @@ module DeclarativePolicy seen = Set.new while subject.respond_to?(:declarative_policy_delegate) - raise ArgumentError, "circular delegations" if seen.include?(subject.object_id) + raise ArgumentError, _("circular delegations") if seen.include?(subject.object_id) seen << subject.object_id subject = subject.declarative_policy_delegate diff --git a/lib/declarative_policy/condition.rb b/lib/declarative_policy/condition.rb index b77f40b1093..67c35ef6bd7 100644 --- a/lib/declarative_policy/condition.rb +++ b/lib/declarative_policy/condition.rb @@ -90,7 +90,7 @@ module DeclarativePolicy when :user then "/dp/condition/#{@condition.key}/#{user_key}" when :subject then "/dp/condition/#{@condition.key}/#{subject_key}" when :global then "/dp/condition/#{@condition.key}" - else raise 'invalid scope' + else raise _('invalid scope') end end diff --git a/lib/declarative_policy/rule.rb b/lib/declarative_policy/rule.rb index f38f4f0a50f..54a9549828a 100644 --- a/lib/declarative_policy/rule.rb +++ b/lib/declarative_policy/rule.rb @@ -18,20 +18,20 @@ module DeclarativePolicy # `context` is a policy - an instance of # DeclarativePolicy::Base. def pass?(context) - raise 'abstract' + raise _('abstract') end # same as #pass? except refuses to do any I/O, # returning nil if the result is not yet cached. # used for accurately scoring And/Or def cached_pass?(context) - raise 'abstract' + raise _('abstract') end # abstractly, how long would it take to compute # this rule? lower-scored rules are tried first. def score(context) - raise 'abstract' + raise _('abstract') end # unwrap double negatives and nested and/or diff --git a/lib/file_size_validator.rb b/lib/file_size_validator.rb index 70a145cd5bd..7d876896a7e 100644 --- a/lib/file_size_validator.rb +++ b/lib/file_size_validator.rb @@ -9,7 +9,7 @@ class FileSizeValidator < ActiveModel::EachValidator def initialize(options) if range = (options.delete(:in) || options.delete(:within)) - raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range) + raise ArgumentError, _(":in and :within must be a Range") unless range.is_a?(Range) options[:minimum], options[:maximum] = range.begin, range.end options[:maximum] -= 1 if range.exclude_end? @@ -22,7 +22,7 @@ class FileSizeValidator < ActiveModel::EachValidator keys = CHECKS.keys & options.keys if keys.empty? - raise ArgumentError, 'Range unspecified. Specify the :within, :maximum, :minimum, or :is option.' + raise ArgumentError, _('Range unspecified. Specify the :within, :maximum, :minimum, or :is option.') end keys.each do |key| @@ -36,7 +36,7 @@ class FileSizeValidator < ActiveModel::EachValidator # rubocop: disable CodeReuse/ActiveRecord def validate_each(record, attribute, value) - raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.is_a? CarrierWave::Uploader::Base + raise(ArgumentError, _("A CarrierWave::Uploader::Base object was expected")) unless value.is_a? CarrierWave::Uploader::Base value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.is_a?(String) diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb index ec090aea784..4d0d4e3094a 100644 --- a/lib/gitlab/access.rb +++ b/lib/gitlab/access.rb @@ -61,10 +61,10 @@ module Gitlab def protection_options { - "Not protected: Both developers and maintainers can push new commits, force push, or delete the branch." => PROTECTION_NONE, - "Protected against pushes: Developers cannot push new commits, but are allowed to accept merge requests to the branch. Maintainers can push to the branch." => PROTECTION_DEV_CAN_MERGE, - "Partially protected: Both developers and maintainers can push new commits, but cannot force push or delete the branch." => PROTECTION_DEV_CAN_PUSH, - "Fully protected: Developers cannot push new commits, but maintainers can. No-one can force push or delete the branch." => PROTECTION_FULL + _("Not protected: Both developers and maintainers can push new commits, force push, or delete the branch.") => PROTECTION_NONE, + _("Protected against pushes: Developers cannot push new commits, but are allowed to accept merge requests to the branch. Maintainers can push to the branch.") => PROTECTION_DEV_CAN_MERGE, + _("Partially protected: Both developers and maintainers can push new commits, but cannot force push or delete the branch.") => PROTECTION_DEV_CAN_PUSH, + _("Fully protected: Developers cannot push new commits, but maintainers can. No-one can force push or delete the branch.") => PROTECTION_FULL } end diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 7aa02009aa0..488dcceec2f 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -21,7 +21,7 @@ module Gitlab end def find_for_git_client(login, password, project:, ip:) - raise "Must provide an IP for rate limiting" if ip.nil? + raise _("Must provide an IP for rate limiting") if ip.nil? # `user_with_password_for_git` should be the last check # because it's the most expensive, especially when LDAP diff --git a/lib/gitlab/auth/ldap/adapter.rb b/lib/gitlab/auth/ldap/adapter.rb index 42c657afe6a..92c57697386 100644 --- a/lib/gitlab/auth/ldap/adapter.rb +++ b/lib/gitlab/auth/ldap/adapter.rb @@ -99,7 +99,7 @@ module Gitlab options[:size] = limit if limit if fields.include?('dn') - raise ArgumentError, 'It is not currently possible to search the DN and other fields at the same time.' if fields.size > 1 + raise ArgumentError, _('It is not currently possible to search the DN and other fields at the same time.') if fields.size > 1 options[:base] = value options[:scope] = Net::LDAP::SearchScope_BaseObject diff --git a/lib/gitlab/auth/ldap/dn.rb b/lib/gitlab/auth/ldap/dn.rb index 5df914aa367..732f0bec2a7 100644 --- a/lib/gitlab/auth/ldap/dn.rb +++ b/lib/gitlab/auth/ldap/dn.rb @@ -112,7 +112,7 @@ module Gitlab yield key.string.strip, rstrip_except_escaped(value.string, dn_index) key = StringIO.new value = StringIO.new - when '+' then raise(UnsupportedError, "Multivalued RDNs are not supported") + when '+' then raise(UnsupportedError, _("Multivalued RDNs are not supported")) else value << char end when :value_normal_escape then @@ -183,12 +183,12 @@ module Gitlab value = StringIO.new else raise(MalformedError, "Expected the end of an attribute value, but got \"#{char}\"") end - else raise "Fell out of state machine" + else raise _("Fell out of state machine") end end # Last pair - raise(MalformedError, 'DN string ended unexpectedly') unless + raise(MalformedError, _('DN string ended unexpectedly')) unless [:value, :value_normal, :value_hexstring, :value_end].include? state yield key.string.strip, rstrip_except_escaped(value.string, @dn.length) diff --git a/lib/gitlab/auth/user_access_denied_reason.rb b/lib/gitlab/auth/user_access_denied_reason.rb index fd09fe76c02..1b6cdf5f41d 100644 --- a/lib/gitlab/auth/user_access_denied_reason.rb +++ b/lib/gitlab/auth/user_access_denied_reason.rb @@ -15,7 +15,7 @@ module Gitlab "You (#{@user.to_reference}) must accept the Terms of Service in order to perform this action. "\ "Please access GitLab from a web browser to accept these terms." else - "Your account has been blocked." + _("Your account has been blocked.") end end diff --git a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb index 698f5e46c0c..31bdfcb009c 100644 --- a/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb +++ b/lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb @@ -106,7 +106,7 @@ module Gitlab yield key.string.strip, rstrip_except_escaped(value.string, dn_index) key = StringIO.new value = StringIO.new - when '+' then raise(UnsupportedError, "Multivalued RDNs are not supported") + when '+' then raise(UnsupportedError, _("Multivalued RDNs are not supported")) else value << char end when :value_normal_escape then @@ -177,12 +177,12 @@ module Gitlab value = StringIO.new else raise(MalformedError, "Expected the end of an attribute value, but got \"#{char}\"") end - else raise "Fell out of state machine" + else raise _("Fell out of state machine") end end # Last pair - raise(MalformedError, 'DN string ended unexpectedly') unless + raise(MalformedError, _('DN string ended unexpectedly')) unless [:value, :value_normal, :value_hexstring, :value_end].include? state yield key.string.strip, rstrip_except_escaped(value.string, @dn.length) diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb index 81ca2b0a9b7..6e36ad18b0b 100644 --- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb +++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb @@ -81,7 +81,7 @@ module Gitlab Open3.popen2(*cmd) do |stdin, stdout, status_thread| yield_paths_in_batches(stdout, batch_size, &block) - raise "Find command failed" unless status_thread.value.success? + raise _("Find command failed") unless status_thread.value.success? end end diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb index eaead41a720..3fd0533f351 100644 --- a/lib/gitlab/bitbucket_import/importer.rb +++ b/lib/gitlab/bitbucket_import/importer.rb @@ -36,7 +36,7 @@ module Gitlab return unless errors.any? project.import_state.update_column(:last_error, { - message: 'The remote data could not be fully imported.', + message: _('The remote data could not be fully imported.'), errors: errors }.to_json) end diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb index 28cfb46e2d4..897e096f5ad 100644 --- a/lib/gitlab/bitbucket_server_import/importer.rb +++ b/lib/gitlab/bitbucket_server_import/importer.rb @@ -55,7 +55,7 @@ module Gitlab return unless errors.any? project.import_state.update_column(:last_error, { - message: 'The remote data could not be fully imported.', + message: _('The remote data could not be fully imported.'), errors: errors }.to_json) end diff --git a/lib/gitlab/checks/branch_check.rb b/lib/gitlab/checks/branch_check.rb index d06b2df36f2..a10418494fb 100644 --- a/lib/gitlab/checks/branch_check.rb +++ b/lib/gitlab/checks/branch_check.rb @@ -4,19 +4,19 @@ module Gitlab module Checks class BranchCheck < BaseChecker ERROR_MESSAGES = { - delete_default_branch: 'The default branch of a project cannot be deleted.', - force_push_protected_branch: 'You are not allowed to force push code to a protected branch on this project.', - non_master_delete_protected_branch: 'You are not allowed to delete protected branches from this project. Only a project maintainer or owner can delete a protected branch.', - non_web_delete_protected_branch: 'You can only delete protected branches using the web interface.', - merge_protected_branch: 'You are not allowed to merge code into protected branches on this project.', - push_protected_branch: 'You are not allowed to push code to protected branches on this project.' + delete_default_branch: _('The default branch of a project cannot be deleted.'), + force_push_protected_branch: _('You are not allowed to force push code to a protected branch on this project.'), + non_master_delete_protected_branch: _('You are not allowed to delete protected branches from this project. Only a project maintainer or owner can delete a protected branch.'), + non_web_delete_protected_branch: _('You can only delete protected branches using the web interface.'), + merge_protected_branch: _('You are not allowed to merge code into protected branches on this project.'), + push_protected_branch: _('You are not allowed to push code to protected branches on this project.') }.freeze LOG_MESSAGES = { - delete_default_branch_check: "Checking if default branch is being deleted...", - protected_branch_checks: "Checking if you are force pushing to a protected branch...", - protected_branch_push_checks: "Checking if you are allowed to push to the protected branch...", - protected_branch_deletion_checks: "Checking if you are allowed to delete the protected branch..." + delete_default_branch_check: _("Checking if default branch is being deleted..."), + protected_branch_checks: _("Checking if you are force pushing to a protected branch..."), + protected_branch_push_checks: _("Checking if you are allowed to push to the protected branch..."), + protected_branch_deletion_checks: _("Checking if you are allowed to delete the protected branch...") }.freeze def validate! diff --git a/lib/gitlab/checks/diff_check.rb b/lib/gitlab/checks/diff_check.rb index ea0d8c85a66..0b9424428bf 100644 --- a/lib/gitlab/checks/diff_check.rb +++ b/lib/gitlab/checks/diff_check.rb @@ -6,8 +6,8 @@ module Gitlab include Gitlab::Utils::StrongMemoize LOG_MESSAGES = { - validate_file_paths: "Validating diffs' file paths...", - diff_content_check: "Validating diff contents..." + validate_file_paths: _("Validating diffs' file paths..."), + diff_content_check: _("Validating diff contents...") }.freeze def validate! diff --git a/lib/gitlab/checks/lfs_check.rb b/lib/gitlab/checks/lfs_check.rb index cc6a14d2d9a..0e740d5db76 100644 --- a/lib/gitlab/checks/lfs_check.rb +++ b/lib/gitlab/checks/lfs_check.rb @@ -3,8 +3,8 @@ module Gitlab module Checks class LfsCheck < BaseChecker - LOG_MESSAGE = "Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...".freeze - ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'.freeze + LOG_MESSAGE = _("Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...").freeze + ERROR_MESSAGE = _('LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".').freeze def validate! return unless project.lfs_enabled? diff --git a/lib/gitlab/checks/push_check.rb b/lib/gitlab/checks/push_check.rb index 91f8d0bdbc8..712f1f99dcd 100644 --- a/lib/gitlab/checks/push_check.rb +++ b/lib/gitlab/checks/push_check.rb @@ -4,7 +4,7 @@ module Gitlab module Checks class PushCheck < BaseChecker def validate! - logger.log_timed("Checking if you are allowed to push...") do + logger.log_timed(_("Checking if you are allowed to push...")) do unless can_push? raise GitAccess::UnauthorizedError, GitAccess::ERROR_MESSAGES[:push_code] end diff --git a/lib/gitlab/checks/tag_check.rb b/lib/gitlab/checks/tag_check.rb index 2a75c8059bd..d703e68199e 100644 --- a/lib/gitlab/checks/tag_check.rb +++ b/lib/gitlab/checks/tag_check.rb @@ -4,15 +4,15 @@ module Gitlab module Checks class TagCheck < BaseChecker ERROR_MESSAGES = { - change_existing_tags: 'You are not allowed to change existing tags on this project.', - update_protected_tag: 'Protected tags cannot be updated.', - delete_protected_tag: 'Protected tags cannot be deleted.', - create_protected_tag: 'You are not allowed to create this tag as it is protected.' + change_existing_tags: _('You are not allowed to change existing tags on this project.'), + update_protected_tag: _('Protected tags cannot be updated.'), + delete_protected_tag: _('Protected tags cannot be deleted.'), + create_protected_tag: _('You are not allowed to create this tag as it is protected.') }.freeze LOG_MESSAGES = { - tag_checks: "Checking if you are allowed to change existing tags...", - protected_tag_checks: "Checking if you are creating, updating or deleting a protected tag..." + tag_checks: _("Checking if you are allowed to change existing tags..."), + protected_tag_checks: _("Checking if you are creating, updating or deleting a protected tag...") }.freeze def validate! diff --git a/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb b/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb index 25a82086676..5e816c8859c 100644 --- a/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb +++ b/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb @@ -11,7 +11,7 @@ module Gitlab InvalidStreamError = Class.new(StandardError) def initialize(stream) - raise InvalidStreamError, "Stream is required" unless stream + raise InvalidStreamError, _("Stream is required") unless stream @stream = stream end diff --git a/lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb b/lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb index cf37d700991..7cee09b4db7 100644 --- a/lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb +++ b/lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb @@ -11,7 +11,7 @@ module Gitlab InvalidStreamError = Class.new(StandardError) def initialize(stream) - raise InvalidStreamError, "Stream is required" unless stream + raise InvalidStreamError, _("Stream is required") unless stream @stream = stream end diff --git a/lib/gitlab/ci/build/artifacts/metadata.rb b/lib/gitlab/ci/build/artifacts/metadata.rb index 08dac756cc1..648a872e024 100644 --- a/lib/gitlab/ci/build/artifacts/metadata.rb +++ b/lib/gitlab/ci/build/artifacts/metadata.rb @@ -29,12 +29,12 @@ module Gitlab gzip do |gz| read_string(gz) # version errors = read_string(gz) - raise ParserError, 'Errors field not found!' unless errors + raise ParserError, _('Errors field not found!') unless errors begin JSON.parse(errors) rescue JSON::ParserError - raise ParserError, 'Invalid errors field!' + raise ParserError, _('Invalid errors field!') end end end @@ -85,11 +85,11 @@ module Gitlab version_string = read_string(gz) unless version_string - raise ParserError, 'Artifacts metadata file empty!' + raise ParserError, _('Artifacts metadata file empty!') end unless version_string =~ VERSION_PATTERN - raise ParserError, 'Invalid version!' + raise ParserError, _('Invalid version!') end version_string.chomp @@ -109,7 +109,7 @@ module Gitlab end def gzip(&block) - raise InvalidStreamError, "Invalid stream" unless @stream + raise InvalidStreamError, _("Invalid stream") unless @stream # restart gzip reading @stream.seek(0) diff --git a/lib/gitlab/ci/build/artifacts/path.rb b/lib/gitlab/ci/build/artifacts/path.rb index 65cd935afaa..ec1cfc4f7b6 100644 --- a/lib/gitlab/ci/build/artifacts/path.rb +++ b/lib/gitlab/ci/build/artifacts/path.rb @@ -28,11 +28,11 @@ module Gitlab def to_s @path.tap do |path| unless nonzero? - raise ArgumentError, 'Path contains zero byte character!' + raise ArgumentError, _('Path contains zero byte character!') end unless utf8? - raise ArgumentError, 'Path contains non-UTF-8 byte sequence!' + raise ArgumentError, _('Path contains non-UTF-8 byte sequence!') end end end diff --git a/lib/gitlab/ci/config/entry/cache.rb b/lib/gitlab/ci/config/entry/cache.rb index 7b94af24c09..03a17ff9442 100644 --- a/lib/gitlab/ci/config/entry/cache.rb +++ b/lib/gitlab/ci/config/entry/cache.rb @@ -20,13 +20,13 @@ module Gitlab end entry :key, Entry::Key, - description: 'Cache key used to define a cache affinity.' + description: _('Cache key used to define a cache affinity.') entry :untracked, ::Gitlab::Config::Entry::Boolean, - description: 'Cache all untracked files.' + description: _('Cache all untracked files.') entry :paths, Entry::Paths, - description: 'Specify which paths should be cached across builds.' + description: _('Specify which paths should be cached across builds.') helpers :key diff --git a/lib/gitlab/ci/config/entry/global.rb b/lib/gitlab/ci/config/entry/global.rb index 09ecb5fdb99..64652d07bc7 100644 --- a/lib/gitlab/ci/config/entry/global.rb +++ b/lib/gitlab/ci/config/entry/global.rb @@ -12,28 +12,28 @@ module Gitlab include ::Gitlab::Config::Entry::Configurable entry :before_script, Entry::Script, - description: 'Script that will be executed before each job.' + description: _('Script that will be executed before each job.') entry :image, Entry::Image, - description: 'Docker image that will be used to execute jobs.' + description: _('Docker image that will be used to execute jobs.') entry :services, Entry::Services, - description: 'Docker images that will be linked to the container.' + description: _('Docker images that will be linked to the container.') entry :after_script, Entry::Script, - description: 'Script that will be executed after each job.' + description: _('Script that will be executed after each job.') entry :variables, Entry::Variables, - description: 'Environment variables that will be used.' + description: _('Environment variables that will be used.') entry :stages, Entry::Stages, - description: 'Configuration of stages for this pipeline.' + description: _('Configuration of stages for this pipeline.') entry :types, Entry::Stages, description: 'Deprecated: stages for this pipeline.' entry :cache, Entry::Cache, - description: 'Configure caching between build jobs.' + description: _('Configure caching between build jobs.') helpers :before_script, :image, :services, :after_script, :variables, :stages, :types, :cache, :jobs diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 1d8904f7b29..58e4ffb1a02 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -42,50 +42,50 @@ module Gitlab end entry :before_script, Entry::Script, - description: 'Global before script overridden in this job.' + description: _('Global before script overridden in this job.') entry :script, Entry::Commands, - description: 'Commands that will be executed in this job.' + description: _('Commands that will be executed in this job.') entry :stage, Entry::Stage, - description: 'Pipeline stage this job will be executed into.' + description: _('Pipeline stage this job will be executed into.') entry :type, Entry::Stage, description: 'Deprecated: stage this job will be executed into.' entry :after_script, Entry::Script, - description: 'Commands that will be executed when finishing job.' + description: _('Commands that will be executed when finishing job.') entry :cache, Entry::Cache, - description: 'Cache definition for this job.' + description: _('Cache definition for this job.') entry :image, Entry::Image, - description: 'Image that will be used to execute this job.' + description: _('Image that will be used to execute this job.') entry :services, Entry::Services, - description: 'Services that will be used to execute this job.' + description: _('Services that will be used to execute this job.') entry :only, Entry::Policy, - description: 'Refs policy this job will be executed for.', + description: _('Refs policy this job will be executed for.'), default: { refs: %w[branches tags] } entry :except, Entry::Policy, - description: 'Refs policy this job will be executed for.' + description: _('Refs policy this job will be executed for.') entry :variables, Entry::Variables, - description: 'Environment variables available for this job.' + description: _('Environment variables available for this job.') entry :artifacts, Entry::Artifacts, - description: 'Artifacts configuration for this job.' + description: _('Artifacts configuration for this job.') entry :environment, Entry::Environment, - description: 'Environment configuration for this job.' + description: _('Environment configuration for this job.') entry :coverage, Entry::Coverage, - description: 'Coverage configuration for this job.' + description: _('Coverage configuration for this job.') entry :retry, Entry::Retry, - description: 'Retry configuration for this job.' + description: _('Retry configuration for this job.') helpers :before_script, :script, :stage, :type, :after_script, :cache, :image, :services, :only, :except, :variables, diff --git a/lib/gitlab/ci/config/extendable/entry.rb b/lib/gitlab/ci/config/extendable/entry.rb index 7793db09d33..22d861788a8 100644 --- a/lib/gitlab/ci/config/extendable/entry.rb +++ b/lib/gitlab/ci/config/extendable/entry.rb @@ -19,7 +19,7 @@ module Gitlab @parent = parent unless @context.key?(@key) - raise StandardError, 'Invalid entry key!' + raise StandardError, _('Invalid entry key!') end end diff --git a/lib/gitlab/ci/config/external/file/base.rb b/lib/gitlab/ci/config/external/file/base.rb index a747886093c..c3679fe0dac 100644 --- a/lib/gitlab/ci/config/external/file/base.rb +++ b/lib/gitlab/ci/config/external/file/base.rb @@ -39,7 +39,7 @@ module Gitlab end def content - raise NotImplementedError, 'subclass must implement fetching raw content' + raise NotImplementedError, _('subclass must implement fetching raw content') end def to_hash diff --git a/lib/gitlab/ci/parsers/test/junit.rb b/lib/gitlab/ci/parsers/test/junit.rb index dca60eabc1c..a70faf30de9 100644 --- a/lib/gitlab/ci/parsers/test/junit.rb +++ b/lib/gitlab/ci/parsers/test/junit.rb @@ -15,9 +15,9 @@ module Gitlab test_suite.add_test_case(test_case) end rescue Nokogiri::XML::SyntaxError - raise JunitParserError, "XML parsing failed" + raise JunitParserError, _("XML parsing failed") rescue - raise JunitParserError, "JUnit parsing failed" + raise JunitParserError, _("JUnit parsing failed") end private diff --git a/lib/gitlab/ci/pipeline/chain/populate.rb b/lib/gitlab/ci/pipeline/chain/populate.rb index 0405292a25b..4be215aca8d 100644 --- a/lib/gitlab/ci/pipeline/chain/populate.rb +++ b/lib/gitlab/ci/pipeline/chain/populate.rb @@ -30,11 +30,11 @@ module Gitlab end if pipeline.stages.none? - return error('No stages / jobs for this pipeline.') + return error(_('No stages / jobs for this pipeline.')) end if pipeline.invalid? - return error('Failed to build the pipeline!') + return error(_('Failed to build the pipeline!')) end raise Populate::PopulateError if pipeline.persisted? diff --git a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb b/lib/gitlab/ci/pipeline/chain/validate/abilities.rb index ebd7e6e8289..e713a45714c 100644 --- a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb +++ b/lib/gitlab/ci/pipeline/chain/validate/abilities.rb @@ -11,7 +11,7 @@ module Gitlab def perform! unless project.builds_enabled? - return error('Pipelines are disabled!') + return error(_('Pipelines are disabled!')) end unless allowed_to_trigger_pipeline? diff --git a/lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb b/lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb index d7e6dacf068..12fc3e9b279 100644 --- a/lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb +++ b/lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb @@ -14,14 +14,14 @@ module Gitlab @value = regexp unless Gitlab::UntrustedRegexp.valid?(@value) - raise Lexer::SyntaxError, 'Invalid regular expression!' + raise Lexer::SyntaxError, _('Invalid regular expression!') end end def evaluate(variables = {}) Gitlab::UntrustedRegexp.fabricate(@value) rescue RegexpError - raise Expression::RuntimeError, 'Invalid regular expression!' + raise Expression::RuntimeError, _('Invalid regular expression!') end def self.build(string) diff --git a/lib/gitlab/ci/pipeline/expression/lexer.rb b/lib/gitlab/ci/pipeline/expression/lexer.rb index f26542361a2..38c2a11d5dd 100644 --- a/lib/gitlab/ci/pipeline/expression/lexer.rb +++ b/lib/gitlab/ci/pipeline/expression/lexer.rb @@ -50,11 +50,11 @@ module Gitlab end unless lexeme.present? - raise Lexer::SyntaxError, 'Unknown lexeme found!' + raise Lexer::SyntaxError, _('Unknown lexeme found!') end end - raise Lexer::SyntaxError, 'Too many tokens!' + raise Lexer::SyntaxError, _('Too many tokens!') end end end diff --git a/lib/gitlab/ci/pipeline/expression/statement.rb b/lib/gitlab/ci/pipeline/expression/statement.rb index b03611f756e..2f2a6470862 100644 --- a/lib/gitlab/ci/pipeline/expression/statement.rb +++ b/lib/gitlab/ci/pipeline/expression/statement.rb @@ -26,7 +26,7 @@ module Gitlab raise StatementError if @lexer.lexemes.empty? unless GRAMMAR.find { |syntax| syntax == @lexer.lexemes } - raise StatementError, 'Unknown pipeline expression!' + raise StatementError, _('Unknown pipeline expression!') end Expression::Parser.new(@lexer.tokens).tree diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index bf5f2a31f0e..d63f2ba633e 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -115,7 +115,7 @@ module Gitlab def unsafe_write!(mode, &blk) stream = Gitlab::Ci::Trace::Stream.new do if trace_artifact - raise AlreadyArchivedError, 'Could not write to the archived trace' + raise AlreadyArchivedError, _('Could not write to the archived trace') elsif current_path File.open(current_path, mode) elsif Feature.enabled?('ci_enable_live_trace') @@ -133,8 +133,8 @@ module Gitlab end def unsafe_archive! - raise AlreadyArchivedError, 'Could not archive again' if trace_artifact - raise ArchiveError, 'Job is not finished yet' unless job.complete? + raise AlreadyArchivedError, _('Could not archive again') if trace_artifact + raise ArchiveError, _('Job is not finished yet') unless job.complete? if job.trace_chunks.any? Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream| @@ -171,7 +171,7 @@ module Gitlab temp_path = File.join(dir_path, "job.log") FileUtils.touch(temp_path) size = IO.copy_stream(src_stream, temp_path) - raise ArchiveError, 'Failed to copy stream' unless size == src_stream.size + raise ArchiveError, _('Failed to copy stream') unless size == src_stream.size yield(temp_path) end diff --git a/lib/gitlab/ci/trace/chunked_io.rb b/lib/gitlab/ci/trace/chunked_io.rb index 8c6fd56493f..be3442675d6 100644 --- a/lib/gitlab/ci/trace/chunked_io.rb +++ b/lib/gitlab/ci/trace/chunked_io.rb @@ -50,7 +50,7 @@ module Gitlab -1 end - raise ArgumentError, 'new position is outside of file' if new_pos < 0 || new_pos > size + raise ArgumentError, _('new position is outside of file') if new_pos < 0 || new_pos > size @tell = new_pos end @@ -141,7 +141,7 @@ module Gitlab # rubocop: disable CodeReuse/ActiveRecord def truncate(offset) - raise ArgumentError, 'Outside of file' if offset > size || offset < 0 + raise ArgumentError, _('Outside of file') if offset > size || offset < 0 return if offset == size # Skip the following process as it doesn't affect anything @tell = offset diff --git a/lib/gitlab/cleanup/project_upload_file_finder.rb b/lib/gitlab/cleanup/project_upload_file_finder.rb index 2ee8b60e76a..a7aae9d7c66 100644 --- a/lib/gitlab/cleanup/project_upload_file_finder.rb +++ b/lib/gitlab/cleanup/project_upload_file_finder.rb @@ -16,7 +16,7 @@ module Gitlab Open3.popen2(*cmd) do |stdin, stdout, status_thread| yield_paths_in_batches(stdout, batch_size, &block) - raise "Find command failed" unless status_thread.value.success? + raise _("Find command failed") unless status_thread.value.success? end end diff --git a/lib/gitlab/config/entry/attributable.rb b/lib/gitlab/config/entry/attributable.rb index 560fe63df0e..b651819a56c 100644 --- a/lib/gitlab/config/entry/attributable.rb +++ b/lib/gitlab/config/entry/attributable.rb @@ -10,7 +10,7 @@ module Gitlab def attributes(*attributes) attributes.flatten.each do |attribute| if method_defined?(attribute) - raise ArgumentError, 'Method already defined!' + raise ArgumentError, _('Method already defined!') end define_method(attribute) do diff --git a/lib/gitlab/config/entry/simplifiable.rb b/lib/gitlab/config/entry/simplifiable.rb index 5fbf7565e2a..9ec7e18fe17 100644 --- a/lib/gitlab/config/entry/simplifiable.rb +++ b/lib/gitlab/config/entry/simplifiable.rb @@ -10,7 +10,7 @@ module Gitlab def initialize(config, **metadata) unless self.class.const_defined?(:UnknownStrategy) - raise ArgumentError, 'UndefinedStrategy not available!' + raise ArgumentError, _('UndefinedStrategy not available!') end strategy = self.class.strategies.find do |variant| diff --git a/lib/gitlab/config/loader/yaml.rb b/lib/gitlab/config/loader/yaml.rb index 8159f8b8026..f34c8568b6a 100644 --- a/lib/gitlab/config/loader/yaml.rb +++ b/lib/gitlab/config/loader/yaml.rb @@ -16,7 +16,7 @@ module Gitlab def load! unless valid? - raise Loader::FormatError, 'Invalid configuration format' + raise Loader::FormatError, _('Invalid configuration format') end @config.deep_symbolize_keys diff --git a/lib/gitlab/database/median.rb b/lib/gitlab/database/median.rb index 1455e410d4b..e3cb7675f97 100644 --- a/lib/gitlab/database/median.rb +++ b/lib/gitlab/database/median.rb @@ -117,7 +117,7 @@ module Gitlab if Gitlab::Database.postgresql? pg_median_datetime_sql(arel_table, query_so_far, column_sym, partition_column) elsif Gitlab::Database.mysql? - raise NotSupportedError, "partition_column is not supported for MySQL" if partition_column + raise NotSupportedError, _("partition_column is not supported for MySQL") if partition_column mysql_median_datetime_sql(arel_table, query_so_far, column_sym) end diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 3abd0600e9d..7fcbf1200a8 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -153,7 +153,7 @@ module Gitlab # Transactions would result in ALTER TABLE locks being held for the # duration of the transaction, defeating the purpose of this method. if transaction_open? - raise 'add_concurrent_foreign_key can not be run inside a transaction' + raise _('add_concurrent_foreign_key can not be run inside a transaction') end # While MySQL does allow disabling of foreign keys it has no equivalent @@ -452,7 +452,7 @@ module Gitlab # type is used. def rename_column_concurrently(table, old, new, type: nil) if transaction_open? - raise 'rename_column_concurrently can not be run inside a transaction' + raise _('rename_column_concurrently can not be run inside a transaction') end check_trigger_permissions!(table) @@ -599,7 +599,7 @@ module Gitlab ) unless relation.model < EachBatch - raise TypeError, 'The relation must include the EachBatch module' + raise TypeError, _('The relation must include the EachBatch module') end temp_column = "#{column}_for_type_change" diff --git a/lib/gitlab/database/read_only_relation.rb b/lib/gitlab/database/read_only_relation.rb index 2362208e5dd..4771b5b3664 100644 --- a/lib/gitlab/database/read_only_relation.rb +++ b/lib/gitlab/database/read_only_relation.rb @@ -9,7 +9,7 @@ module Gitlab define_method(method) do |*args| raise( ActiveRecord::ReadOnlyRecord, - "This relation is marked as read-only" + _("This relation is marked as read-only") ) end end diff --git a/lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb b/lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb index f1dc3ed74fe..c902d858a29 100644 --- a/lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb +++ b/lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb @@ -86,7 +86,7 @@ module Gitlab end def hashed_storage?(feature) - raise ArgumentError, "Invalid feature" unless HASHED_STORAGE_FEATURES.include?(feature) + raise ArgumentError, _("Invalid feature") unless HASHED_STORAGE_FEATURES.include?(feature) return false unless respond_to?(:storage_version) self.storage_version && self.storage_version >= HASHED_STORAGE_FEATURES[feature] diff --git a/lib/gitlab/ee_compat_check.rb b/lib/gitlab/ee_compat_check.rb index 01fd261404b..bf393464e16 100644 --- a/lib/gitlab/ee_compat_check.rb +++ b/lib/gitlab/ee_compat_check.rb @@ -250,7 +250,7 @@ module Gitlab def fetch(branch:, depth:, remote: 'origin') step( - "Fetching deeper...", + _("Fetching deeper..."), %W[git fetch --depth=#{depth} --prune #{remote} +refs/heads/#{branch}:refs/remotes/#{remote}/#{branch}] ) do |output, status| raise "Fetch failed: #{output}" unless status.zero? diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb index ec412e7a8b1..da86738912b 100644 --- a/lib/gitlab/email/message/repository_push.rb +++ b/lib/gitlab/email/message/repository_push.rb @@ -14,7 +14,7 @@ module Gitlab delegate :username, to: :author, prefix: :author def initialize(notify, project_id, opts = {}) - raise ArgumentError, 'Missing options: author_id, ref, action' unless + raise ArgumentError, _('Missing options: author_id, ref, action') unless opts[:author_id] && opts[:ref] && opts[:action] @notify = notify diff --git a/lib/gitlab/etag_caching/store.rb b/lib/gitlab/etag_caching/store.rb index 2395e7be026..26e595a4fc5 100644 --- a/lib/gitlab/etag_caching/store.rb +++ b/lib/gitlab/etag_caching/store.rb @@ -27,7 +27,7 @@ module Gitlab end def redis_shared_state_key(key) - raise 'Invalid key' if !Rails.env.production? && !Gitlab::EtagCaching::Router.match(key) + raise _('Invalid key') if !Rails.env.production? && !Gitlab::EtagCaching::Router.match(key) "#{SHARED_STATE_NAMESPACE}#{key}" end diff --git a/lib/gitlab/exclusive_lease_helpers.rb b/lib/gitlab/exclusive_lease_helpers.rb index 7961d4bbd6e..2743b7ccdaa 100644 --- a/lib/gitlab/exclusive_lease_helpers.rb +++ b/lib/gitlab/exclusive_lease_helpers.rb @@ -12,7 +12,7 @@ module Gitlab # because it holds the connection until all `retries` is consumed. # This could potentially eat up all connection pools. def in_lock(key, ttl: 1.minute, retries: 10, sleep_sec: 0.01.seconds) - raise ArgumentError, 'Key needs to be specified' unless key + raise ArgumentError, _('Key needs to be specified') unless key lease = Gitlab::ExclusiveLease.new(key, timeout: ttl) @@ -23,7 +23,7 @@ module Gitlab break if (retries -= 1) < 0 end - raise FailedToObtainLockError, 'Failed to obtain a lock' unless uuid + raise FailedToObtainLockError, _('Failed to obtain a lock') unless uuid yield ensure diff --git a/lib/gitlab/git/bundle_file.rb b/lib/gitlab/git/bundle_file.rb index 8384a436fcc..91f6d50c08f 100644 --- a/lib/gitlab/git/bundle_file.rb +++ b/lib/gitlab/git/bundle_file.rb @@ -23,7 +23,7 @@ module Gitlab def check! data = File.open(filename, 'r') { |f| f.read(MAGIC.size) } - raise InvalidBundleError, 'Invalid bundle file' unless data == MAGIC + raise InvalidBundleError, _('Invalid bundle file') unless data == MAGIC end end end diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 5863815ca85..ac8657450c9 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -39,7 +39,7 @@ module Gitlab # def where(options) repo = options.delete(:repo) - raise 'Gitlab::Git::Repository is required' unless repo.respond_to?(:log) + raise _('Gitlab::Git::Repository is required') unless repo.respond_to?(:log) repo.log(options) end @@ -180,7 +180,7 @@ module Gitlab end def initialize(repository, raw_commit, head = nil) - raise "Nil as raw commit passed" unless raw_commit + raise _("Nil as raw commit passed") unless raw_commit @repository = repository @head = head diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb index 74a4633424f..6309a00476c 100644 --- a/lib/gitlab/git/diff.rb +++ b/lib/gitlab/git/diff.rb @@ -146,7 +146,7 @@ module Gitlab when Gitaly::CommitDelta init_from_gitaly(raw_diff) when nil - raise "Nil as raw diff passed" + raise _("Nil as raw diff passed") else raise "Invalid raw diff type: #{raw_diff.class}" end diff --git a/lib/gitlab/git/hook_env.rb b/lib/gitlab/git/hook_env.rb index 892a069a3b7..d19334fafe6 100644 --- a/lib/gitlab/git/hook_env.rb +++ b/lib/gitlab/git/hook_env.rb @@ -21,7 +21,7 @@ module Gitlab def self.set(gl_repository, env) return unless Gitlab::SafeRequestStore.active? - raise "missing gl_repository" if gl_repository.blank? + raise _("missing gl_repository") if gl_repository.blank? Gitlab::SafeRequestStore[:gitlab_git_env] ||= {} Gitlab::SafeRequestStore[:gitlab_git_env][gl_repository] = whitelist_git_env(env) diff --git a/lib/gitlab/git/push.rb b/lib/gitlab/git/push.rb index b6577ba17f1..11073a12ba3 100644 --- a/lib/gitlab/git/push.rb +++ b/lib/gitlab/git/push.rb @@ -44,7 +44,7 @@ module Gitlab def modified_paths unless branch_updated? - raise ArgumentError, 'Unable to calculate modified paths!' + raise ArgumentError, _('Unable to calculate modified paths!') end strong_memoize(:modified_paths) do diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 786c90f9272..63521580555 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -449,7 +449,7 @@ module Gitlab # Returns a RefName for a given SHA def ref_name_for_sha(ref_path, sha) - raise ArgumentError, "sha can't be empty" unless sha.present? + raise ArgumentError, _("sha can't be empty") unless sha.present? gitaly_ref_client.find_ref_name(sha, ref_path) end @@ -854,7 +854,7 @@ module Gitlab return unless full_path.present? # This guard avoids Gitaly log/error spam - raise NoRepository, 'repository does not exist' unless exists? + raise NoRepository, _('repository does not exist') unless exists? set_config('gitlab.fullpath' => full_path) end @@ -971,7 +971,7 @@ module Gitlab def checksum # The exists? RPC is much cheaper, so we perform this request first - raise NoRepository, "Repository does not exists" unless exists? + raise NoRepository, _("Repository does not exists") unless exists? gitaly_repository_client.calculate_checksum rescue GRPC::NotFound diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 010bd0e520c..cc556950d80 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -17,19 +17,19 @@ module Gitlab ANY = '_any' ERROR_MESSAGES = { - upload: 'You are not allowed to upload code for this project.', - download: 'You are not allowed to download code from this project.', - auth_upload: 'You are not allowed to upload code.', - auth_download: 'You are not allowed to download code.', - deploy_key_upload: 'This deploy key does not have write access to this project.', - no_repo: 'A repository for this project does not exist yet.', - project_not_found: 'The project you were looking for could not be found.', - command_not_allowed: "The command you're trying to execute is not allowed.", - upload_pack_disabled_over_http: 'Pulling over HTTP is not allowed.', - receive_pack_disabled_over_http: 'Pushing over HTTP is not allowed.', - read_only: 'The repository is temporarily read-only. Please try again later.', - cannot_push_to_read_only: "You can't push code to a read-only GitLab instance.", - push_code: 'You are not allowed to push code to this project.' + upload: _('You are not allowed to upload code for this project.'), + download: _('You are not allowed to download code from this project.'), + auth_upload: _('You are not allowed to upload code.'), + auth_download: _('You are not allowed to download code.'), + deploy_key_upload: _('This deploy key does not have write access to this project.'), + no_repo: _('A repository for this project does not exist yet.'), + project_not_found: _('The project you were looking for could not be found.'), + command_not_allowed: _("The command you're trying to execute is not allowed."), + upload_pack_disabled_over_http: _('Pulling over HTTP is not allowed.'), + receive_pack_disabled_over_http: _('Pushing over HTTP is not allowed.'), + read_only: _('The repository is temporarily read-only. Please try again later.'), + cannot_push_to_read_only: _("You can't push code to a read-only GitLab instance."), + push_code: _('You are not allowed to push code to this project.') }.freeze INTERNAL_TIMEOUT = 50.seconds.freeze diff --git a/lib/gitlab/git_access_wiki.rb b/lib/gitlab/git_access_wiki.rb index 0af91957fa8..dbd79992ac9 100644 --- a/lib/gitlab/git_access_wiki.rb +++ b/lib/gitlab/git_access_wiki.rb @@ -3,8 +3,8 @@ module Gitlab class GitAccessWiki < GitAccess ERROR_MESSAGES = { - read_only: "You can't push code to a read-only GitLab instance.", - write_to_wiki: "You are not allowed to write to this project's wiki." + read_only: _("You can't push code to a read-only GitLab instance."), + write_to_wiki: _("You are not allowed to write to this project's wiki.") }.freeze def guest_can_download_code? diff --git a/lib/gitlab/graphql/authorize/authorize_resource.rb b/lib/gitlab/graphql/authorize/authorize_resource.rb index a56c4f6368d..38a8067d1e5 100644 --- a/lib/gitlab/graphql/authorize/authorize_resource.rb +++ b/lib/gitlab/graphql/authorize/authorize_resource.rb @@ -30,7 +30,7 @@ module Gitlab def authorize!(object) unless authorized?(object) raise Gitlab::Graphql::Errors::ResourceNotAvailable, - "The resource that you are attempting to access does not exist or you don't have permission to perform this action" + _("The resource that you are attempting to access does not exist or you don't have permission to perform this action") end end diff --git a/lib/gitlab/http_io.rb b/lib/gitlab/http_io.rb index 6a9fb85b054..3815875cea9 100644 --- a/lib/gitlab/http_io.rb +++ b/lib/gitlab/http_io.rb @@ -57,7 +57,7 @@ module Gitlab -1 end - raise 'new position is outside of file' if new_pos < 0 || new_pos > size + raise _('new position is outside of file') if new_pos < 0 || new_pos > size @tell = new_pos end diff --git a/lib/gitlab/i18n/po_linter.rb b/lib/gitlab/i18n/po_linter.rb index 3e9a035010f..c4e49f06f09 100644 --- a/lib/gitlab/i18n/po_linter.rb +++ b/lib/gitlab/i18n/po_linter.rb @@ -34,7 +34,7 @@ module Gitlab if entries.first[:msgid].empty? @metadata_entry = Gitlab::I18n::MetadataEntry.new(entries.shift) else - return 'Missing metadata entry.' + return _('Missing metadata entry.') end @translation_entries = entries.map do |entry_data| diff --git a/lib/gitlab/issuable_metadata.rb b/lib/gitlab/issuable_metadata.rb index 351d15605e0..8bd4edd0b5a 100644 --- a/lib/gitlab/issuable_metadata.rb +++ b/lib/gitlab/issuable_metadata.rb @@ -8,7 +8,7 @@ module Gitlab issuable_collection.respond_to?(:limit_value) && issuable_collection.limit_value.nil? - raise 'Collection must have a limit applied for preloading meta-data' + raise _('Collection must have a limit applied for preloading meta-data') end # map has to be used here since using pluck or select will diff --git a/lib/gitlab/kubernetes/helm/base_command.rb b/lib/gitlab/kubernetes/helm/base_command.rb index 2bcb428b25d..d14ce27cd6b 100644 --- a/lib/gitlab/kubernetes/helm/base_command.rb +++ b/lib/gitlab/kubernetes/helm/base_command.rb @@ -37,15 +37,15 @@ module Gitlab end def name - raise "Not implemented" + raise _("Not implemented") end def rbac? - raise "Not implemented" + raise _("Not implemented") end def files - raise "Not implemented" + raise _("Not implemented") end private diff --git a/lib/gitlab/legacy_github_import/client.rb b/lib/gitlab/legacy_github_import/client.rb index bc952147667..1eafe929d48 100644 --- a/lib/gitlab/legacy_github_import/client.rb +++ b/lib/gitlab/legacy_github_import/client.rb @@ -34,7 +34,7 @@ module Gitlab def client unless config raise Projects::ImportService::Error, - 'OAuth configuration for GitHub missing.' + _('OAuth configuration for GitHub missing.') end @client ||= ::OAuth2::Client.new( diff --git a/lib/gitlab/legacy_github_import/importer.rb b/lib/gitlab/legacy_github_import/importer.rb index c526d31a591..f0e344716dd 100644 --- a/lib/gitlab/legacy_github_import/importer.rb +++ b/lib/gitlab/legacy_github_import/importer.rb @@ -81,7 +81,7 @@ module Gitlab return unless errors.any? project.import_state.update_column(:last_error, { - message: 'The remote data could not be fully imported.', + message: _('The remote data could not be fully imported.'), errors: errors }.to_json) end diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb index c09d3ebc7be..7e5d431e699 100644 --- a/lib/gitlab/lfs_token.rb +++ b/lib/gitlab/lfs_token.rb @@ -26,7 +26,7 @@ module Gitlab when Key actor.user else - raise 'Bad Actor' + raise _('Bad Actor') end end diff --git a/lib/gitlab/manifest_import/manifest.rb b/lib/gitlab/manifest_import/manifest.rb index 7208fe5bbc5..f1252e450cf 100644 --- a/lib/gitlab/manifest_import/manifest.rb +++ b/lib/gitlab/manifest_import/manifest.rb @@ -22,7 +22,7 @@ module Gitlab @parsed_xml = Nokogiri::XML(file) { |config| config.strict } @errors = [] rescue Nokogiri::XML::SyntaxError - @errors = ['The uploaded file is not a valid XML file.'] + @errors = [_('The uploaded file is not a valid XML file.')] end def projects @@ -40,11 +40,11 @@ module Gitlab return false if @errors.any? unless validate_remote - @errors << 'Make sure a <remote> tag is present and is valid.' + @errors << _('Make sure a <remote> tag is present and is valid.') end unless validate_projects - @errors << 'Make sure every <project> tag has name and path attributes.' + @errors << _('Make sure every <project> tag has name and path attributes.') end @errors.empty? diff --git a/lib/gitlab/metrics/influx_db.rb b/lib/gitlab/metrics/influx_db.rb index 1359e973590..c7d176cc444 100644 --- a/lib/gitlab/metrics/influx_db.rb +++ b/lib/gitlab/metrics/influx_db.rb @@ -59,7 +59,7 @@ module Gitlab end end rescue Errno::EADDRNOTAVAIL, SocketError => ex - Gitlab::EnvironmentLogger.error('Cannot resolve InfluxDB address. GitLab Performance Monitoring will not work.') + Gitlab::EnvironmentLogger.error(_('Cannot resolve InfluxDB address. GitLab Performance Monitoring will not work.')) Gitlab::EnvironmentLogger.error(ex) end diff --git a/lib/gitlab/metrics/methods.rb b/lib/gitlab/metrics/methods.rb index 447d03bfca4..648c2157aea 100644 --- a/lib/gitlab/metrics/methods.rb +++ b/lib/gitlab/metrics/methods.rb @@ -64,7 +64,7 @@ module Gitlab when :histogram Gitlab::Metrics.histogram(name, options.docstring, options.base_labels, options.buckets) when :summary - raise NotImplementedError, "summary metrics are not currently supported" + raise NotImplementedError, _("summary metrics are not currently supported") else raise ArgumentError, "uknown metric type #{type}" end diff --git a/lib/gitlab/omniauth_initializer.rb b/lib/gitlab/omniauth_initializer.rb index e0ac9eec1f2..15985446ed9 100644 --- a/lib/gitlab/omniauth_initializer.rb +++ b/lib/gitlab/omniauth_initializer.rb @@ -58,7 +58,7 @@ module Gitlab def cas3_signout_handler lambda do |request| ticket = request.params[:session_index] - raise "Service Ticket not found." unless Gitlab::Auth::OAuth::Session.valid?(:cas3, ticket) + raise _("Service Ticket not found.") unless Gitlab::Auth::OAuth::Session.valid?(:cas3, ticket) Gitlab::Auth::OAuth::Session.destroy(:cas3, ticket) true diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index 7fa00d0c68c..9fe49b713bd 100644 --- a/lib/gitlab/popen.rb +++ b/lib/gitlab/popen.rb @@ -19,7 +19,7 @@ module Gitlab # Returns Result def popen_with_detail(cmd, path = nil, vars = {}) unless cmd.is_a?(Array) - raise "System commands must be given as an array of strings" + raise _("System commands must be given as an array of strings") end path ||= Dir.pwd diff --git a/lib/gitlab/project_template.rb b/lib/gitlab/project_template.rb index 3bfd6ee892c..b7685d52ce3 100644 --- a/lib/gitlab/project_template.rb +++ b/lib/gitlab/project_template.rb @@ -27,9 +27,9 @@ module Gitlab end TEMPLATES_TABLE = [ - ProjectTemplate.new('rails', 'Ruby on Rails', 'Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/rails'), - ProjectTemplate.new('spring', 'Spring', 'Includes an MVC structure, mvnw and pom.xml to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/spring'), - ProjectTemplate.new('express', 'NodeJS Express', 'Includes an MVC structure to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/express') + ProjectTemplate.new('rails', 'Ruby on Rails', _('Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/rails'), + ProjectTemplate.new('spring', 'Spring', _('Includes an MVC structure, mvnw and pom.xml to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/spring'), + ProjectTemplate.new('express', 'NodeJS Express', _('Includes an MVC structure to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/express') ].freeze class << self diff --git a/lib/gitlab/prometheus_client.rb b/lib/gitlab/prometheus_client.rb index 45828c77a33..06f84cc35fe 100644 --- a/lib/gitlab/prometheus_client.rb +++ b/lib/gitlab/prometheus_client.rb @@ -46,9 +46,9 @@ module Gitlab path = ['api', 'v1', type].join('/') get(path, args) rescue JSON::ParserError - raise PrometheusClient::Error, 'Parsing response failed' + raise PrometheusClient::Error, _('Parsing response failed') rescue Errno::ECONNREFUSED - raise PrometheusClient::Error, 'Connection refused' + raise PrometheusClient::Error, _('Connection refused') end def get(path, args) @@ -62,10 +62,10 @@ module Gitlab if ex.response handle_exception_response(ex.response) else - raise PrometheusClient::Error, "Network connection error" + raise PrometheusClient::Error, _("Network connection error") end rescue RestClient::Exception - raise PrometheusClient::Error, "Network connection error" + raise PrometheusClient::Error, _("Network connection error") end def handle_response(response) diff --git a/lib/gitlab/query_limiting.rb b/lib/gitlab/query_limiting.rb index 31e6b120e45..67d3586444a 100644 --- a/lib/gitlab/query_limiting.rb +++ b/lib/gitlab/query_limiting.rb @@ -24,7 +24,7 @@ module Gitlab unless issue_url.start_with?('https://') raise( ArgumentError, - 'You must provide a valid issue URL in order to whitelist a block of code' + _('You must provide a valid issue URL in order to whitelist a block of code') ) end diff --git a/lib/gitlab/route_map.rb b/lib/gitlab/route_map.rb index a555bf1d812..a861b0ada96 100644 --- a/lib/gitlab/route_map.rb +++ b/lib/gitlab/route_map.rb @@ -8,10 +8,10 @@ module Gitlab begin entries = YAML.safe_load(data) rescue - raise FormatError, 'Route map is not valid YAML' + raise FormatError, _('Route map is not valid YAML') end - raise FormatError, 'Route map is not an array' unless entries.is_a?(Array) + raise FormatError, _('Route map is not an array') unless entries.is_a?(Array) @map = entries.map { |entry| parse_entry(entry) } end @@ -30,9 +30,9 @@ module Gitlab private def parse_entry(entry) - raise FormatError, 'Route map entry is not a hash' unless entry.is_a?(Hash) - raise FormatError, 'Route map entry does not have a source key' unless entry.key?('source') - raise FormatError, 'Route map entry does not have a public key' unless entry.key?('public') + raise FormatError, _('Route map entry is not a hash') unless entry.is_a?(Hash) + raise FormatError, _('Route map entry does not have a source key') unless entry.key?('source') + raise FormatError, _('Route map entry does not have a public key') unless entry.key?('public') source_pattern = entry['source'] public_path = entry['public'] diff --git a/lib/gitlab/setup_helper.rb b/lib/gitlab/setup_helper.rb index 2b7e12639be..1109c5dcd63 100644 --- a/lib/gitlab/setup_helper.rb +++ b/lib/gitlab/setup_helper.rb @@ -20,10 +20,10 @@ module Gitlab Gitlab.config.repositories.storages.each do |key, val| if address if address != val['gitaly_address'] - raise ArgumentError, "Your gitlab.yml contains more than one gitaly_address." + raise ArgumentError, _("Your gitlab.yml contains more than one gitaly_address.") end elsif URI(val['gitaly_address']).scheme != 'unix' - raise ArgumentError, "Automatic config.toml generation only supports 'unix:' addresses." + raise ArgumentError, _("Automatic config.toml generation only supports 'unix:' addresses.") else address = val['gitaly_address'] end @@ -57,7 +57,7 @@ module Gitlab end rescue Errno::EEXIST puts "Skipping config.toml generation:" - puts "A configuration file already exists." + puts _("A configuration file already exists.") rescue ArgumentError => e puts "Skipping config.toml generation:" puts e.message diff --git a/lib/gitlab/sherlock/line_profiler.rb b/lib/gitlab/sherlock/line_profiler.rb index 209ba784f9c..4eff27ee5e8 100644 --- a/lib/gitlab/sherlock/line_profiler.rb +++ b/lib/gitlab/sherlock/line_profiler.rb @@ -36,7 +36,7 @@ module Gitlab profile_mri(&block) else raise NotImplementedError, - 'Line profiling is not supported on this platform' + _('Line profiling is not supported on this platform') end end diff --git a/lib/gitlab/task_helpers.rb b/lib/gitlab/task_helpers.rb index 224bb648d8f..347f18877e5 100644 --- a/lib/gitlab/task_helpers.rb +++ b/lib/gitlab/task_helpers.rb @@ -123,7 +123,7 @@ module Gitlab puts " Warning ".color(:black).background(:yellow) puts " You are running as user #{current_user.color(:magenta)}, we hope you know what you are doing." - puts " Things may work\/fail for the wrong reasons." + puts _(" Things may work\/fail for the wrong reasons.") puts " For correct results you should run this as user #{gitlab_user.color(:magenta)}." puts "" end diff --git a/lib/gitlab/tracing/factory.rb b/lib/gitlab/tracing/factory.rb index fc714164353..51f24de6b69 100644 --- a/lib/gitlab/tracing/factory.rb +++ b/lib/gitlab/tracing/factory.rb @@ -31,7 +31,7 @@ module Gitlab parsed = URI.parse(connection_string) unless valid_uri?(parsed) - raise "Invalid tracing connection string" + raise _("Invalid tracing connection string") end { diff --git a/lib/gitlab/untrusted_regexp.rb b/lib/gitlab/untrusted_regexp.rb index ba1137313d8..1a723bf82c8 100644 --- a/lib/gitlab/untrusted_regexp.rb +++ b/lib/gitlab/untrusted_regexp.rb @@ -65,7 +65,7 @@ module Gitlab def self.fabricate(pattern) matches = pattern.match(%r{^/(?<regexp>.+)/(?<flags>[ismU]*)$}) - raise RegexpError, 'Invalid regular expression!' if matches.nil? + raise RegexpError, _('Invalid regular expression!') if matches.nil? expression = matches[:regexp] flags = matches[:flags] diff --git a/lib/gitlab/url_blocker.rb b/lib/gitlab/url_blocker.rb index 9b7b0db9525..9a934bf0285 100644 --- a/lib/gitlab/url_blocker.rb +++ b/lib/gitlab/url_blocker.rb @@ -60,7 +60,7 @@ module Gitlab uri_str = uri.to_s sanitized_uri = ActionController::Base.helpers.sanitize(uri_str, tags: []) if sanitized_uri != uri_str - raise BlockedUrlError, 'HTML/CSS/JS tags are not allowed' + raise BlockedUrlError, _('HTML/CSS/JS tags are not allowed') end end @@ -69,7 +69,7 @@ module Gitlab Addressable::URI.parse(url) rescue Addressable::URI::InvalidURIError, URI::InvalidURIError - raise BlockedUrlError, 'URI is invalid' + raise BlockedUrlError, _('URI is invalid') end def multiline?(url) @@ -95,7 +95,7 @@ module Gitlab return if value.blank? return if value =~ /\A\p{Alnum}/ - raise BlockedUrlError, "Username needs to start with an alphanumeric character" + raise BlockedUrlError, _("Username needs to start with an alphanumeric character") end def validate_hostname!(value) @@ -103,7 +103,7 @@ module Gitlab return if IPAddress.valid?(value) return if value =~ /\A\p{Alnum}/ - raise BlockedUrlError, "Hostname or IP address invalid" + raise BlockedUrlError, _("Hostname or IP address invalid") end def validate_unicode_restriction!(uri) @@ -118,26 +118,26 @@ module Gitlab return if (local_ips & addrs_info.map(&:ip_address)).empty? - raise BlockedUrlError, "Requests to localhost are not allowed" + raise BlockedUrlError, _("Requests to localhost are not allowed") end def validate_loopback!(addrs_info) return unless addrs_info.any? { |addr| addr.ipv4_loopback? || addr.ipv6_loopback? } - raise BlockedUrlError, "Requests to loopback addresses are not allowed" + raise BlockedUrlError, _("Requests to loopback addresses are not allowed") end def validate_local_network!(addrs_info) return unless addrs_info.any? { |addr| addr.ipv4_private? || addr.ipv6_sitelocal? || addr.ipv6_unique_local? } - raise BlockedUrlError, "Requests to the local network are not allowed" + raise BlockedUrlError, _("Requests to the local network are not allowed") end def validate_link_local!(addrs_info) netmask = IPAddr.new('169.254.0.0/16') return unless addrs_info.any? { |addr| addr.ipv6_linklocal? || netmask.include?(addr.ip_address) } - raise BlockedUrlError, "Requests to the link local network are not allowed" + raise BlockedUrlError, _("Requests to the link local network are not allowed") end def internal?(uri) diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb index 99fa65e0e90..5334ccbfcea 100644 --- a/lib/gitlab/utils.rb +++ b/lib/gitlab/utils.rb @@ -26,8 +26,8 @@ module Gitlab end def ensure_utf8_size(str, bytes:) - raise ArgumentError, 'Empty string provided!' if str.empty? - raise ArgumentError, 'Negative string size provided!' if bytes.negative? + raise ArgumentError, _('Empty string provided!') if str.empty? + raise ArgumentError, _('Negative string size provided!') if bytes.negative? truncated = str.each_char.each_with_object(+'') do |char, object| if object.bytesize + char.bytesize > bytes diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 265f6213a99..fa415784d30 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -67,7 +67,7 @@ module Gitlab format ||= 'tar.gz' format = format.downcase params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha: append_sha) - raise "Repository or ref not found" if params.empty? + raise _("Repository or ref not found") if params.empty? params['GitalyServer'] = gitaly_server_hash(repository) diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb index e2083848a8d..c83a1cec213 100644 --- a/lib/mattermost/session.rb +++ b/lib/mattermost/session.rb @@ -3,7 +3,7 @@ module Mattermost class NoSessionError < Mattermost::Error def message - 'No session could be set up, is Mattermost configured with Single Sign On?' + _('No session could be set up, is Mattermost configured with Single Sign On?') end end diff --git a/lib/object_storage/direct_upload.rb b/lib/object_storage/direct_upload.rb index fd26663fef0..7f2d33429d8 100644 --- a/lib/object_storage/direct_upload.rb +++ b/lib/object_storage/direct_upload.rb @@ -27,7 +27,7 @@ module ObjectStorage def initialize(credentials, bucket_name, object_name, has_length:, maximum_size: nil) unless has_length - raise ArgumentError, 'maximum_size has to be specified if length is unknown' unless maximum_size + raise ArgumentError, _('maximum_size has to be specified if length is unknown') unless maximum_size end @credentials = credentials diff --git a/lib/omni_auth/strategies/jwt.rb b/lib/omni_auth/strategies/jwt.rb index 2f3d477a591..39a29f6ac12 100644 --- a/lib/omni_auth/strategies/jwt.rb +++ b/lib/omni_auth/strategies/jwt.rb @@ -56,10 +56,10 @@ module OmniAuth raise ClaimInvalid, "Missing required '#{field}' claim" unless @decoded.key?(field.to_s) end - raise ClaimInvalid, "Missing required 'iat' claim" if options.valid_within && !@decoded["iat"] + raise ClaimInvalid, _("Missing required 'iat' claim") if options.valid_within && !@decoded["iat"] if options.valid_within && (Time.now.to_i - @decoded["iat"]).abs > options.valid_within.to_i - raise ClaimInvalid, "'iat' timestamp claim is too skewed from present" + raise ClaimInvalid, _("'iat' timestamp claim is too skewed from present") end @decoded diff --git a/lib/system_check/app/database_config_exists_check.rb b/lib/system_check/app/database_config_exists_check.rb index 1769145ed63..af1bdcd9ba2 100644 --- a/lib/system_check/app/database_config_exists_check.rb +++ b/lib/system_check/app/database_config_exists_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class DatabaseConfigExistsCheck < SystemCheck::BaseCheck - set_name 'Database config exists?' + set_name _('Database config exists?') def check? database_config_file = Rails.root.join('config', 'database.yml') diff --git a/lib/system_check/app/git_config_check.rb b/lib/system_check/app/git_config_check.rb index 4e8d607096c..b1ca41a193c 100644 --- a/lib/system_check/app/git_config_check.rb +++ b/lib/system_check/app/git_config_check.rb @@ -7,7 +7,7 @@ module SystemCheck 'core.autocrlf' => 'input' }.freeze - set_name 'Git configured correctly?' + set_name _('Git configured correctly?') def check? correct_options = OPTIONS.map do |name, value| diff --git a/lib/system_check/app/git_user_default_ssh_config_check.rb b/lib/system_check/app/git_user_default_ssh_config_check.rb index 6cd53779bfd..cb0b5913983 100644 --- a/lib/system_check/app/git_user_default_ssh_config_check.rb +++ b/lib/system_check/app/git_user_default_ssh_config_check.rb @@ -12,7 +12,7 @@ module SystemCheck known_hosts ].freeze - set_name 'Git user has default SSH configuration?' + set_name _('Git user has default SSH configuration?') set_skip_reason 'skipped (git user is not present / configured)' def skip? diff --git a/lib/system_check/app/gitlab_config_exists_check.rb b/lib/system_check/app/gitlab_config_exists_check.rb index 1cc5ead0d89..e1c8708fe6c 100644 --- a/lib/system_check/app/gitlab_config_exists_check.rb +++ b/lib/system_check/app/gitlab_config_exists_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class GitlabConfigExistsCheck < SystemCheck::BaseCheck - set_name 'GitLab config exists?' + set_name _('GitLab config exists?') def check? gitlab_config_file = Rails.root.join('config', 'gitlab.yml') diff --git a/lib/system_check/app/gitlab_config_up_to_date_check.rb b/lib/system_check/app/gitlab_config_up_to_date_check.rb index 58c7e3039c8..8f73635ab79 100644 --- a/lib/system_check/app/gitlab_config_up_to_date_check.rb +++ b/lib/system_check/app/gitlab_config_up_to_date_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class GitlabConfigUpToDateCheck < SystemCheck::BaseCheck - set_name 'GitLab config up to date?' + set_name _('GitLab config up to date?') set_skip_reason "can't check because of previous errors" def skip? diff --git a/lib/system_check/app/init_script_exists_check.rb b/lib/system_check/app/init_script_exists_check.rb index d36dbe7d67d..e0ca4c91dc1 100644 --- a/lib/system_check/app/init_script_exists_check.rb +++ b/lib/system_check/app/init_script_exists_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class InitScriptExistsCheck < SystemCheck::BaseCheck - set_name 'Init script exists?' + set_name _('Init script exists?') set_skip_reason 'skipped (omnibus-gitlab has no init script)' def skip? diff --git a/lib/system_check/app/init_script_up_to_date_check.rb b/lib/system_check/app/init_script_up_to_date_check.rb index 569c41df6e4..7fdf2817808 100644 --- a/lib/system_check/app/init_script_up_to_date_check.rb +++ b/lib/system_check/app/init_script_up_to_date_check.rb @@ -5,7 +5,7 @@ module SystemCheck class InitScriptUpToDateCheck < SystemCheck::BaseCheck SCRIPT_PATH = '/etc/init.d/gitlab'.freeze - set_name 'Init script up-to-date?' + set_name _('Init script up-to-date?') set_skip_reason 'skipped (omnibus-gitlab has no init script)' def skip? diff --git a/lib/system_check/app/log_writable_check.rb b/lib/system_check/app/log_writable_check.rb index e26ad143eb8..b2dd6ac7326 100644 --- a/lib/system_check/app/log_writable_check.rb +++ b/lib/system_check/app/log_writable_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class LogWritableCheck < SystemCheck::BaseCheck - set_name 'Log directory writable?' + set_name _('Log directory writable?') def check? File.writable?(log_path) diff --git a/lib/system_check/app/migrations_are_up_check.rb b/lib/system_check/app/migrations_are_up_check.rb index b12e9ac6bba..daf5c8df395 100644 --- a/lib/system_check/app/migrations_are_up_check.rb +++ b/lib/system_check/app/migrations_are_up_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class MigrationsAreUpCheck < SystemCheck::BaseCheck - set_name 'All migrations up?' + set_name _('All migrations up?') def check? migration_status, _ = Gitlab::Popen.popen(%w(bundle exec rake db:migrate:status)) diff --git a/lib/system_check/app/orphaned_group_members_check.rb b/lib/system_check/app/orphaned_group_members_check.rb index 3e6ffb8190b..72ed8141e9b 100644 --- a/lib/system_check/app/orphaned_group_members_check.rb +++ b/lib/system_check/app/orphaned_group_members_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class OrphanedGroupMembersCheck < SystemCheck::BaseCheck - set_name 'Database contains orphaned GroupMembers?' + set_name _('Database contains orphaned GroupMembers?') set_check_pass 'no' set_check_fail 'yes' diff --git a/lib/system_check/app/tmp_writable_check.rb b/lib/system_check/app/tmp_writable_check.rb index 6687df091d3..6aee19f6554 100644 --- a/lib/system_check/app/tmp_writable_check.rb +++ b/lib/system_check/app/tmp_writable_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class TmpWritableCheck < SystemCheck::BaseCheck - set_name 'Tmp directory writable?' + set_name _('Tmp directory writable?') def check? File.writable?(tmp_path) diff --git a/lib/system_check/app/uploads_directory_exists_check.rb b/lib/system_check/app/uploads_directory_exists_check.rb index 940eff9d4cf..9d313579195 100644 --- a/lib/system_check/app/uploads_directory_exists_check.rb +++ b/lib/system_check/app/uploads_directory_exists_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class UploadsDirectoryExistsCheck < SystemCheck::BaseCheck - set_name 'Uploads directory exists?' + set_name _('Uploads directory exists?') def check? File.directory?(Rails.root.join('public/uploads')) diff --git a/lib/system_check/app/uploads_path_permission_check.rb b/lib/system_check/app/uploads_path_permission_check.rb index 4a49f3bc2bb..38202185978 100644 --- a/lib/system_check/app/uploads_path_permission_check.rb +++ b/lib/system_check/app/uploads_path_permission_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class UploadsPathPermissionCheck < SystemCheck::BaseCheck - set_name 'Uploads directory has correct permissions?' + set_name _('Uploads directory has correct permissions?') set_skip_reason 'skipped (no uploads folder found)' def skip? diff --git a/lib/system_check/app/uploads_path_tmp_permission_check.rb b/lib/system_check/app/uploads_path_tmp_permission_check.rb index ae374f4707c..47953e50cba 100644 --- a/lib/system_check/app/uploads_path_tmp_permission_check.rb +++ b/lib/system_check/app/uploads_path_tmp_permission_check.rb @@ -3,7 +3,7 @@ module SystemCheck module App class UploadsPathTmpPermissionCheck < SystemCheck::BaseCheck - set_name 'Uploads directory tmp has correct permissions?' + set_name _('Uploads directory tmp has correct permissions?') set_skip_reason 'skipped (no tmp uploads folder yet)' def skip? diff --git a/lib/system_check/helpers.rb b/lib/system_check/helpers.rb index 07d479848fe..e0023ebc4aa 100644 --- a/lib/system_check/helpers.rb +++ b/lib/system_check/helpers.rb @@ -6,7 +6,7 @@ module SystemCheck # Display a message telling to fix and rerun the checks def fix_and_rerun - $stdout.puts ' Please fix the error above and rerun the checks.'.color(:red) + $stdout.puts _(' Please fix the error above and rerun the checks.').color(:red) end # Display a formatted list of references (documentation or links) where to find more information diff --git a/lib/system_check/incoming_email/foreman_configured_check.rb b/lib/system_check/incoming_email/foreman_configured_check.rb index 944913087da..fa0e711fb09 100644 --- a/lib/system_check/incoming_email/foreman_configured_check.rb +++ b/lib/system_check/incoming_email/foreman_configured_check.rb @@ -3,7 +3,7 @@ module SystemCheck module IncomingEmail class ForemanConfiguredCheck < SystemCheck::BaseCheck - set_name 'Foreman configured correctly?' + set_name _('Foreman configured correctly?') def check? path = Rails.root.join('Procfile') @@ -13,7 +13,7 @@ module SystemCheck def show_error try_fixing_it( - 'Enable mail_room in your Procfile.' + _('Enable mail_room in your Procfile.') ) for_more_information( 'doc/administration/reply_by_email.md' diff --git a/lib/system_check/incoming_email/imap_authentication_check.rb b/lib/system_check/incoming_email/imap_authentication_check.rb index 613c2296375..7d229216055 100644 --- a/lib/system_check/incoming_email/imap_authentication_check.rb +++ b/lib/system_check/incoming_email/imap_authentication_check.rb @@ -3,7 +3,7 @@ module SystemCheck module IncomingEmail class ImapAuthenticationCheck < SystemCheck::BaseCheck - set_name 'IMAP server credentials are correct?' + set_name _('IMAP server credentials are correct?') def check? if config diff --git a/lib/system_check/incoming_email/initd_configured_check.rb b/lib/system_check/incoming_email/initd_configured_check.rb index acb4b5a9e74..194e8226984 100644 --- a/lib/system_check/incoming_email/initd_configured_check.rb +++ b/lib/system_check/incoming_email/initd_configured_check.rb @@ -15,7 +15,7 @@ module SystemCheck def show_error try_fixing_it( - 'Enable mail_room in the init.d configuration.' + _('Enable mail_room in the init.d configuration.') ) for_more_information( 'doc/administration/reply_by_email.md' diff --git a/lib/system_check/incoming_email/mail_room_running_check.rb b/lib/system_check/incoming_email/mail_room_running_check.rb index b7aead4624e..1c97c7ac689 100644 --- a/lib/system_check/incoming_email/mail_room_running_check.rb +++ b/lib/system_check/incoming_email/mail_room_running_check.rb @@ -3,7 +3,7 @@ module SystemCheck module IncomingEmail class MailRoomRunningCheck < SystemCheck::BaseCheck - set_name 'MailRoom running?' + set_name _('MailRoom running?') def skip? return true if omnibus_gitlab? diff --git a/lib/system_check/simple_executor.rb b/lib/system_check/simple_executor.rb index 11818ae54f8..137e7311f73 100644 --- a/lib/system_check/simple_executor.rb +++ b/lib/system_check/simple_executor.rb @@ -67,7 +67,7 @@ module SystemCheck print_check_failure(check_klass) if check.can_repair? - $stdout.print 'Trying to fix error automatically. ...' + $stdout.print _('Trying to fix error automatically. ...') if check.repair! print_success diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index 2235a6ba194..c5bdf43925a 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -62,7 +62,7 @@ namespace :gettext do failed_linters = linters.select { |linter| linter.errors.any? } if failed_linters.empty? - puts 'All PO files are valid.' + puts _('All PO files are valid.') else failed_linters.each do |linter| report_errors_for_file(linter.po_path, linter.errors) diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index e96fbb64372..422d44e6f2d 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -72,7 +72,7 @@ namespace :gitlab do namespace :repo do task create: :gitlab_environment do - progress.puts "Dumping repositories ...".color(:blue) + progress.puts _("Dumping repositories ...").color(:blue) if ENV["SKIP"] && ENV["SKIP"].include?("repositories") progress.puts "[SKIPPED]".color(:cyan) @@ -83,7 +83,7 @@ namespace :gitlab do end task restore: :gitlab_environment do - progress.puts "Restoring repositories ...".color(:blue) + progress.puts _("Restoring repositories ...").color(:blue) Backup::Repository.new(progress).restore progress.puts "done".color(:green) end diff --git a/lib/tasks/gitlab/exclusive_lease.rake b/lib/tasks/gitlab/exclusive_lease.rake index 83722bf6d94..1e11c55a017 100644 --- a/lib/tasks/gitlab/exclusive_lease.rake +++ b/lib/tasks/gitlab/exclusive_lease.rake @@ -3,7 +3,7 @@ namespace :gitlab do desc 'GitLab | Clear existing exclusive leases for specified scope (default: *)' task :clear, [:scope] => [:environment] do |_, args| args[:scope].nil? ? Gitlab::ExclusiveLease.reset_all! : Gitlab::ExclusiveLease.reset_all!(args[:scope]) - puts 'All exclusive lease entries were removed.' + puts _('All exclusive lease entries were removed.') end end end diff --git a/lib/tasks/gitlab/ldap.rake b/lib/tasks/gitlab/ldap.rake index 0459de27c96..7dea1addc56 100644 --- a/lib/tasks/gitlab/ldap.rake +++ b/lib/tasks/gitlab/ldap.rake @@ -13,7 +13,7 @@ namespace :gitlab do if identities.empty? puts "Found no user identities with '#{old_provider}' provider." - puts 'Please check the provider name and try again.' + puts _('Please check the provider name and try again.') exit 1 end diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake index f71e69987cb..278bdfe3932 100644 --- a/lib/tasks/gitlab/setup.rake +++ b/lib/tasks/gitlab/setup.rake @@ -10,7 +10,7 @@ namespace :gitlab do Gitlab::GitalyClient::ServerService.new(name).info end rescue GRPC::Unavailable => ex - puts "Failed to connect to Gitaly...".color(:red) + puts _("Failed to connect to Gitaly...").color(:red) puts "Error: #{ex}" exit 1 end @@ -19,8 +19,8 @@ namespace :gitlab do warn_user_is_not_gitlab unless ENV['force'] == 'yes' - puts "This will create the necessary database tables and seed the database." - puts "You will lose any previous data stored in the database." + puts _("This will create the necessary database tables and seed the database.") + puts _("You will lose any previous data stored in the database.") ask_to_continue puts "" end diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 0ebc6f00793..f4fa1a801ca 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -95,8 +95,8 @@ namespace :gitlab do ensure_write_to_authorized_keys_is_enabled unless ENV['force'] == 'yes' - puts "This task will now rebuild the authorized_keys file." - puts "You will lose any data stored in the authorized_keys file." + puts _("This task will now rebuild the authorized_keys file.") + puts _("You will lose any data stored in the authorized_keys file.") ask_to_continue puts "" end @@ -112,7 +112,7 @@ namespace :gitlab do puts "" unless $?.success? - puts "Failed to add keys...".color(:red) + puts _("Failed to add keys...").color(:red) exit 1 end @@ -127,14 +127,14 @@ namespace :gitlab do puts authorized_keys_is_disabled_warning unless ENV['force'] == 'yes' - puts 'Do you want to permanently enable the "Write to authorized_keys file" setting now?' + puts _('Do you want to permanently enable the "Write to authorized_keys file" setting now?') ask_to_continue end - puts 'Enabling the "Write to authorized_keys file" setting...' + puts _('Enabling the "Write to authorized_keys file" setting...') Gitlab::CurrentSettings.current_application_settings.update!(authorized_keys_enabled: true) - puts 'Successfully enabled "Write to authorized_keys file"!' + puts _('Successfully enabled "Write to authorized_keys file"!') puts '' end diff --git a/lib/tasks/gitlab/storage.rake b/lib/tasks/gitlab/storage.rake index 09dc3aa9882..59bfb28ea3a 100644 --- a/lib/tasks/gitlab/storage.rake +++ b/lib/tasks/gitlab/storage.rake @@ -3,7 +3,7 @@ namespace :gitlab do desc 'GitLab | Storage | Migrate existing projects to Hashed Storage' task migrate_to_hashed: :environment do if Gitlab::Database.read_only? - warn 'This task requires database write access. Exiting.' + warn _('This task requires database write access. Exiting.') next end @@ -29,7 +29,7 @@ namespace :gitlab do legacy_projects_count = Project.with_unmigrated_storage.count if legacy_projects_count == 0 - warn 'There are no projects requiring storage migration. Nothing to do!' + warn _('There are no projects requiring storage migration. Nothing to do!') next end diff --git a/lib/tasks/gitlab/tcp_check.rake b/lib/tasks/gitlab/tcp_check.rake index 1400f57d6b9..91458a72d70 100644 --- a/lib/tasks/gitlab/tcp_check.rake +++ b/lib/tasks/gitlab/tcp_check.rake @@ -13,7 +13,7 @@ namespace :gitlab do else puts "TCP connection to #{checker.remote} failed: #{checker.error}".color(:red) puts - puts 'Check that host and port are correct, and that the traffic is permitted through any firewalls.' + puts _('Check that host and port are correct, and that the traffic is permitted through any firewalls.') exit 1 end end diff --git a/lib/tasks/gitlab/two_factor.rake b/lib/tasks/gitlab/two_factor.rake index 6b22499a5c8..bd0c5ed5423 100644 --- a/lib/tasks/gitlab/two_factor.rake +++ b/lib/tasks/gitlab/two_factor.rake @@ -16,7 +16,7 @@ namespace :gitlab do puts "Quitting...".color(:red) end else - puts "There are currently no users with 2FA enabled.".color(:yellow) + puts _("There are currently no users with 2FA enabled.").color(:yellow) end end diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index f912f521dfb..709e4d3ef2d 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -21,7 +21,7 @@ class GithubImport .new(@options[:token], @current_user, @github_repo) .choose_one! - raise 'No repo found!' unless @repo + raise _('No repo found!') unless @repo show_warning! @@ -34,7 +34,7 @@ class GithubImport def show_warning! puts "This will import GitHub #{@repo.full_name.bright} into GitLab #{@project_path.bright} as #{@current_user.name}" - puts "Permission checks are ignored. Press any key to continue.".color(:red) + puts _("Permission checks are ignored. Press any key to continue.").color(:red) STDIN.getch diff --git a/lib/tasks/yarn.rake b/lib/tasks/yarn.rake index 2ac88a039e7..1f95f52beaf 100644 --- a/lib/tasks/yarn.rake +++ b/lib/tasks/yarn.rake @@ -16,7 +16,7 @@ namespace :yarn do unless system('yarn check --ignore-engines', out: File::NULL) warn( 'Error: You have unmet dependencies. (`yarn check` command failed)'.color(:red), - 'Run `yarn install` to install missing modules.'.color(:green) + _('Run `yarn install` to install missing modules.').color(:green) ) abort end diff --git a/lib/uploaded_file.rb b/lib/uploaded_file.rb index aae542f02ac..a34adfda07b 100644 --- a/lib/uploaded_file.rb +++ b/lib/uploaded_file.rb @@ -32,7 +32,7 @@ class UploadedFile def self.from_params(params, field, upload_paths) unless params["#{field}.path"] - raise InvalidPathError, "file is invalid" if params["#{field}.remote_id"] + raise InvalidPathError, _("file is invalid") if params["#{field}.remote_id"] return end diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index ac8dcbf0d83..eb582aa6e47 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -132,7 +132,7 @@ module QA end def git_protocol=(value) - raise ArgumentError, "Please specify the protocol you would like to use: 0, 1, or 2" unless %w[0 1 2].include?(value.to_s) + raise ArgumentError, _("Please specify the protocol you would like to use: 0, 1, or 2") unless %w[0 1 2].include?(value.to_s) run("git config protocol.version #{value}") end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index c3c90f254b7..f0a76cc5087 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -162,7 +162,7 @@ module QA def self.errors if views.empty? - return ["Page class does not have views / elements defined!"] + return [_("Page class does not have views / elements defined!")] end views.map(&:errors).flatten diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb index 9ca498012eb..fee64d7fe97 100644 --- a/qa/qa/page/main/sign_up.rb +++ b/qa/qa/page/main/sign_up.rb @@ -29,7 +29,7 @@ module QA Page::Main::Menu.act { has_personal_area? } end - raise "Failed to register and sign in" unless signed_in + raise _("Failed to register and sign in") unless signed_in end end end diff --git a/qa/qa/page/mattermost/login.rb b/qa/qa/page/mattermost/login.rb index 9b21300ea3c..77d524583fc 100644 --- a/qa/qa/page/mattermost/login.rb +++ b/qa/qa/page/mattermost/login.rb @@ -12,7 +12,7 @@ module QA def sign_in_using_oauth click_link class: 'btn btn-custom-login gitlab' - if page.has_content?('Authorize GitLab Mattermost to use your account?') + if page.has_content?(_('Authorize GitLab Mattermost to use your account?')) click_button 'Authorize' end end diff --git a/qa/qa/page/project/settings/mirroring_repositories.rb b/qa/qa/page/project/settings/mirroring_repositories.rb index a73be7dfeda..14fb49b2500 100644 --- a/qa/qa/page/project/settings/mirroring_repositories.rb +++ b/qa/qa/page/project/settings/mirroring_repositories.rb @@ -35,13 +35,13 @@ module QA end def mirror_direction=(value) - raise ArgumentError, "Mirror direction must be :push or :pull" unless [:push, :pull].include? value + raise ArgumentError, _("Mirror direction must be :push or :pull") unless [:push, :pull].include? value select_element(:mirror_direction, value) end def authentication_method=(value) - raise ArgumentError, "Authentication method must be :password or :none" unless [:password, :none].include? value + raise ArgumentError, _("Authentication method must be :password or :none") unless [:password, :none].include? value select_element(:authentication_method, value) end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index a3e126b51da..7497af346d8 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -88,7 +88,7 @@ module QA end end - raise "The changes do not appear to have been committed successfully." unless commit_success_msg_shown + raise _("The changes do not appear to have been committed successfully.") unless commit_success_msg_shown end end end diff --git a/qa/qa/page/validator.rb b/qa/qa/page/validator.rb index 117d8d4db67..826735ff7ca 100644 --- a/qa/qa/page/validator.rb +++ b/qa/qa/page/validator.rb @@ -45,7 +45,7 @@ module QA def validate! return if errors.none? - raise ValidationError, 'Page views / elements validation error!' + raise ValidationError, _('Page views / elements validation error!') end end end diff --git a/qa/qa/resource/fork.rb b/qa/qa/resource/fork.rb index c6243ff43fa..a3ec0cfbe86 100644 --- a/qa/qa/resource/fork.rb +++ b/qa/qa/resource/fork.rb @@ -42,7 +42,7 @@ module QA end Page::Layout::Banner.perform do |page| - page.has_notice?('The project was successfully forked.') + page.has_notice?(_('The project was successfully forked.')) end populate(:project) diff --git a/qa/qa/resource/repository/push.rb b/qa/qa/resource/repository/push.rb index 32f15547da2..96275e4aeaf 100644 --- a/qa/qa/resource/repository/push.rb +++ b/qa/qa/resource/repository/push.rb @@ -28,7 +28,7 @@ module QA end def directory=(dir) - raise "Must set directory as a Pathname" unless dir.is_a?(Pathname) + raise _("Must set directory as a Pathname") unless dir.is_a?(Pathname) @directory = dir end @@ -37,7 +37,7 @@ module QA if !files.is_a?(Array) || files.empty? || files.any? { |file| !file.has_key?(:name) || !file.has_key?(:content) } - raise ArgumentError, "Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]" + raise ArgumentError, _("Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]") end @files = files diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 23a2ace6a55..d113ac29916 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -172,7 +172,7 @@ module QA def require_github_access_token! return unless github_access_token.empty? - raise ArgumentError, "Please provide GITHUB_ACCESS_TOKEN" + raise ArgumentError, _("Please provide GITHUB_ACCESS_TOKEN") end # Returns true if there is an environment variable that indicates that diff --git a/qa/qa/scenario/test/sanity/selectors.rb b/qa/qa/scenario/test/sanity/selectors.rb index cff320cb751..834f98bfd77 100644 --- a/qa/qa/scenario/test/sanity/selectors.rb +++ b/qa/qa/scenario/test/sanity/selectors.rb @@ -45,7 +45,7 @@ module QA validators.each(&:validate!) - puts 'Views / selectors validation passed!' + puts _('Views / selectors validation passed!') end end end diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb index c5f12255d72..77f144ff06e 100644 --- a/qa/qa/service/kubernetes_cluster.rb +++ b/qa/qa/service/kubernetes_cluster.rb @@ -109,8 +109,8 @@ module QA end def validate_dependencies - find_executable('gcloud') || raise("You must first install `gcloud` executable to run these tests.") - find_executable('kubectl') || raise("You must first install `kubectl` executable to run these tests.") + find_executable('gcloud') || raise(_("You must first install `gcloud` executable to run these tests.")) + find_executable('kubectl') || raise(_("You must first install `kubectl` executable to run these tests.")) end def login_if_not_already_logged_in @@ -119,7 +119,7 @@ module QA else account = `gcloud auth list --filter=status:ACTIVE --format="value(account)"` if account.empty? - raise "Failed to login to gcloud. No credentials provided in environment and no credentials found locally." + raise _("Failed to login to gcloud. No credentials provided in environment and no credentials found locally.") else puts "gcloud account found. Using: #{account} for creating K8s cluster." end @@ -127,7 +127,7 @@ module QA end def attempt_login_with_env_vars - puts "No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY." + puts _("No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY.") gcloud_account_key = Tempfile.new('gcloud-account-key') gcloud_account_key.write(Runtime::Env.gcloud_account_key) gcloud_account_key.close diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index 3ce48de2c25..bde6c892a3d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -43,7 +43,7 @@ module QA end def verify_repository_import - expect(page).to have_content('This test project is used for automated GitHub import by GitLab QA.') + expect(page).to have_content(_('This test project is used for automated GitHub import by GitLab QA.')) expect(page).to have_content(imported_project.name) end @@ -53,10 +53,10 @@ module QA click_link 'This is a sample issue' - expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.') + expect(page).to have_content(_('We should populate this project with issues, pull requests and wiki pages.')) # Comments - expect(page).to have_content('This is a comment from @rymai.') + expect(page).to have_content(_('This is a comment from @rymai.')) Page::Issuable::Sidebar.perform do |issuable| expect(issuable).to have_label('enhancement') @@ -71,13 +71,13 @@ module QA click_link 'Improve README.md' - expect(page).to have_content('This improves the README file a bit.') + expect(page).to have_content(_('This improves the README file a bit.')) # Review comment are not supported yet - expect(page).not_to have_content('Really nice change.') + expect(page).not_to have_content(_('Really nice change.')) # Comments - expect(page).to have_content('Nice work! This is a comment from @rymai.') + expect(page).to have_content(_('Nice work! This is a comment from @rymai.')) # Diff comments expect(page).to have_content('[Review comment] I like that!') @@ -103,7 +103,7 @@ module QA def verify_wiki_import Page::Project::Menu.act { click_wiki } - expect(page).to have_content('Welcome to the test-project wiki!') + expect(page).to have_content(_('Welcome to the test-project wiki!')) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index e2d639fd150..26699de13fb 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb @@ -23,7 +23,7 @@ module QA Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.file_name = "other.txt" - push.file_content = "New file added!" + push.file_content = _("New file added!") push.branch_name = "master" push.new_branch = false end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb index de5c535c757..88d6969791b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb @@ -74,7 +74,7 @@ module QA Page::File::Form.perform(&:commit_changes) - expect(page).to have_content('The file has been successfully created.') + expect(page).to have_content(_('The file has been successfully created.')) expect(page).to have_content(template[:file_name]) expect(page).to have_content('Add new file') expect(page).to have_content(content[0..100]) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 0f0c627d79a..b339db3821b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -78,7 +78,7 @@ module QA Page::Project::Branches::Show.perform(&:delete_merged_branches) expect(page).to have_content( - 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.' + _('Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.') ) page.refresh diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb index 46346d1b984..342265d0f9c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb @@ -18,7 +18,7 @@ module QA file.commit_message = commit_message_for_create end - expect(page).to have_content('The file has been successfully created.') + expect(page).to have_content(_('The file has been successfully created.')) expect(page).to have_content(file_name) expect(page).to have_content(file_content) expect(page).to have_content(commit_message_for_create) @@ -36,7 +36,7 @@ module QA commit_changes end - expect(page).to have_content('Your changes have been successfully committed.') + expect(page).to have_content(_('Your changes have been successfully committed.')) expect(page).to have_content(updated_file_content) expect(page).to have_content(commit_message_for_update) @@ -49,7 +49,7 @@ module QA click_delete_file end - expect(page).to have_content('The file has been successfully deleted.') + expect(page).to have_content(_('The file has been successfully deleted.')) expect(page).to have_content(commit_message_for_delete) expect(page).to have_no_content(file_name) end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index 25cbe41c684..0ccfc516727 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -15,7 +15,7 @@ module QA project = Resource::Project.fabricate! do |project| project.name = 'project-with-pipelines' - project.description = 'Project with CI/CD Pipelines.' + project.description = _('Project with CI/CD Pipelines.') end Resource::Runner.fabricate! do |runner| diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb index e2320c92343..e2e2404dbd7 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb @@ -99,7 +99,7 @@ module QA job.completed? && !job.trace_loading? end - expect(job.passed?).to be_truthy, "Job status did not become \"passed\"." + expect(job.passed?).to be_truthy, _("Job status did not become \"passed\".") expect(job.output).to include(sha1sum) end end diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index 5147b17d7ab..777cad4f047 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -85,7 +85,7 @@ module QA end Page::Project::Operations::Environments::Show.perform do |show| show.view_deployment do - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) end end end @@ -127,7 +127,7 @@ module QA Page::Project::Operations::Environments::Show.perform do |show| show.view_deployment do - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) expect(page).to have_content('You can see this application secret') end end diff --git a/qa/qa/tools/revoke_all_personal_access_tokens.rb b/qa/qa/tools/revoke_all_personal_access_tokens.rb index 7484b633bf6..d7394b1c34e 100644 --- a/qa/qa/tools/revoke_all_personal_access_tokens.rb +++ b/qa/qa/tools/revoke_all_personal_access_tokens.rb @@ -19,9 +19,9 @@ module QA private def do_run - raise ArgumentError, "Please provide GITLAB_USERNAME" unless ENV['GITLAB_USERNAME'] - raise ArgumentError, "Please provide GITLAB_PASSWORD" unless ENV['GITLAB_PASSWORD'] - raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV['GITLAB_ADDRESS'] + raise ArgumentError, _("Please provide GITLAB_USERNAME") unless ENV['GITLAB_USERNAME'] + raise ArgumentError, _("Please provide GITLAB_PASSWORD") unless ENV['GITLAB_PASSWORD'] + raise ArgumentError, _("Please provide GITLAB_ADDRESS") unless ENV['GITLAB_ADDRESS'] STDOUT.puts 'Running...' diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb index 076a8087db5..5a4344ca3e0 100644 --- a/qa/spec/page/base_spec.rb +++ b/qa/spec/page/base_spec.rb @@ -55,7 +55,7 @@ describe QA::Page::Base do it 'appends an error about missing views / elements block' do expect(described_class.errors) - .to include 'Page class does not have views / elements defined!' + .to include _('Page class does not have views / elements defined!') end end end diff --git a/qa/spec/resource/api_fabricator_spec.rb b/qa/spec/resource/api_fabricator_spec.rb index a5ed4422f6e..600a4f44e68 100644 --- a/qa/spec/resource/api_fabricator_spec.rb +++ b/qa/spec/resource/api_fabricator_spec.rb @@ -71,7 +71,7 @@ describe QA::Resource::ApiFabricator do let(:resource) { resource_without_api_support } it 'raises a NotImplementedError exception' do - expect { subject.fabricate_via_api! }.to raise_error(NotImplementedError, "Resource FooBarResource does not support fabrication via the API!") + expect { subject.fabricate_via_api! }.to raise_error(NotImplementedError, _("Resource FooBarResource does not support fabrication via the API!")) end end @@ -107,7 +107,7 @@ describe QA::Resource::ApiFabricator do end context 'when the POST fails' do - let(:post_response) { { error: "Name already taken." } } + let(:post_response) { { error: _("Name already taken.") } } let(:raw_post) { double('Raw POST response', code: 400, body: post_response.to_json) } it 'raises a ResourceFabricationFailedError exception' do diff --git a/scripts/trigger-build b/scripts/trigger-build index 4032ba853e6..144f65da3fa 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -196,7 +196,7 @@ module Trigger puts "Pipeline succeeded in #{duration} minutes!" break else - raise "Pipeline did not succeed!" + raise _("Pipeline did not succeed!") end STDOUT.flush diff --git a/spec/controllers/abuse_reports_controller_spec.rb b/spec/controllers/abuse_reports_controller_spec.rb index 7104305e9d2..83cae3dae12 100644 --- a/spec/controllers/abuse_reports_controller_spec.rb +++ b/spec/controllers/abuse_reports_controller_spec.rb @@ -22,7 +22,7 @@ describe AbuseReportsController do get :new, params: { user_id: user_id } expect(response).to redirect_to root_path - expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.') + expect(flash[:alert]).to eq(_('Cannot create the abuse report. The user has been deleted.')) end end @@ -33,7 +33,7 @@ describe AbuseReportsController do get :new, params: { user_id: user.id } expect(response).to redirect_to user - expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.') + expect(flash[:alert]).to eq(_('Cannot create the abuse report. This user has been blocked.')) end end end diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb index 647fce0ecef..4d2726d01f5 100644 --- a/spec/controllers/admin/groups_controller_spec.rb +++ b/spec/controllers/admin/groups_controller_spec.rb @@ -33,7 +33,7 @@ describe Admin::GroupsController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'Users were successfully added.' + expect(response).to set_flash.to _('Users were successfully added.') expect(response).to redirect_to(admin_group_path(group)) expect(group.users).to include group_user end @@ -45,7 +45,7 @@ describe Admin::GroupsController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'Users were successfully added.' + expect(response).to set_flash.to _('Users were successfully added.') expect(response).to redirect_to(admin_group_path(group)) end @@ -56,7 +56,7 @@ describe Admin::GroupsController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'No users specified.' + expect(response).to set_flash.to _('No users specified.') expect(response).to redirect_to(admin_group_path(group)) expect(group.users).not_to include group_user end diff --git a/spec/controllers/groups/clusters_controller_spec.rb b/spec/controllers/groups/clusters_controller_spec.rb index 0f28499194e..89cc2bc88fd 100644 --- a/spec/controllers/groups/clusters_controller_spec.rb +++ b/spec/controllers/groups/clusters_controller_spec.rb @@ -444,7 +444,7 @@ describe Groups::ClustersController do cluster.reload expect(response).to redirect_to(group_cluster_path(group, cluster)) - expect(flash[:notice]).to eq('Kubernetes cluster was successfully updated.') + expect(flash[:notice]).to eq(_('Kubernetes cluster was successfully updated.')) expect(cluster.enabled).to be_falsey expect(cluster.name).to eq('my-new-cluster-name') end @@ -525,7 +525,7 @@ describe Groups::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(-1) expect(response).to redirect_to(group_clusters_path(group)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end @@ -538,7 +538,7 @@ describe Groups::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(-1) expect(response).to redirect_to(group_clusters_path(group)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end end @@ -553,7 +553,7 @@ describe Groups::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(0) expect(response).to redirect_to(group_clusters_path(group)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end end diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb index ed38dadfd6b..71a13926cef 100644 --- a/spec/controllers/groups/group_members_controller_spec.rb +++ b/spec/controllers/groups/group_members_controller_spec.rb @@ -49,7 +49,7 @@ describe Groups::GroupMembersController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'Users were successfully added.' + expect(response).to set_flash.to _('Users were successfully added.') expect(response).to redirect_to(group_group_members_path(group)) expect(group.users).to include group_user end @@ -61,7 +61,7 @@ describe Groups::GroupMembersController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'No users specified.' + expect(response).to set_flash.to _('No users specified.') expect(response).to redirect_to(group_group_members_path(group)) expect(group.users).not_to include group_user end @@ -126,7 +126,7 @@ describe Groups::GroupMembersController do it '[HTML] removes user from members' do delete :destroy, params: { group_id: group, id: member } - expect(response).to set_flash.to 'User was successfully removed from group.' + expect(response).to set_flash.to _('User was successfully removed from group.') expect(response).to redirect_to(group_group_members_path(group)) expect(group.members).not_to include member end @@ -196,7 +196,7 @@ describe Groups::GroupMembersController do it 'removes user from members' do delete :leave, params: { group_id: group } - expect(response).to set_flash.to 'Your access request to the group has been withdrawn.' + expect(response).to set_flash.to _('Your access request to the group has been withdrawn.') expect(response).to redirect_to(group_path(group)) expect(group.requesters).to be_empty expect(group.users).not_to include user @@ -213,7 +213,7 @@ describe Groups::GroupMembersController do it 'creates a new GroupMember that is not a team member' do post :request_access, params: { group_id: group } - expect(response).to set_flash.to 'Your request for access has been queued for review.' + expect(response).to set_flash.to _('Your request for access has been queued for review.') expect(response).to redirect_to(group_path(group)) expect(group.requesters.exists?(user_id: user)).to be_truthy expect(group.users).not_to include user diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb index 59463462e5a..d41fd7b0567 100644 --- a/spec/controllers/omniauth_callbacks_controller_spec.rb +++ b/spec/controllers/omniauth_callbacks_controller_spec.rb @@ -156,7 +156,7 @@ describe OmniauthCallbacksController, type: :controller do expect(request.env['warden']).not_to be_authenticated expect(response.status).to eq(302) - expect(controller).to set_flash[:alert].to('Wrong extern UID provided. Make sure Auth0 is configured correctly.') + expect(controller).to set_flash[:alert].to(_('Wrong extern UID provided. Make sure Auth0 is configured correctly.')) end end end diff --git a/spec/controllers/passwords_controller_spec.rb b/spec/controllers/passwords_controller_spec.rb index 0af55cf3408..e5fff3a9d0b 100644 --- a/spec/controllers/passwords_controller_spec.rb +++ b/spec/controllers/passwords_controller_spec.rb @@ -14,7 +14,7 @@ describe PasswordsController do post :create expect(response).to have_gitlab_http_status(302) - expect(flash[:alert]).to eq 'Password authentication is unavailable.' + expect(flash[:alert]).to eq _('Password authentication is unavailable.') end end @@ -24,7 +24,7 @@ describe PasswordsController do it 'prevents a password reset' do post :create, params: { user: { email: user.email } } - expect(flash[:alert]).to eq 'Password authentication is unavailable.' + expect(flash[:alert]).to eq _('Password authentication is unavailable.') end end end diff --git a/spec/controllers/profiles/preferences_controller_spec.rb b/spec/controllers/profiles/preferences_controller_spec.rb index 012f016b091..b73b85793f8 100644 --- a/spec/controllers/profiles/preferences_controller_spec.rb +++ b/spec/controllers/profiles/preferences_controller_spec.rb @@ -35,7 +35,7 @@ describe Profiles::PreferencesController do context 'on successful update' do it 'sets the flash' do go - expect(flash[:notice]).to eq 'Preferences saved.' + expect(flash[:notice]).to eq _('Preferences saved.') end it "changes the user's preferences" do @@ -58,7 +58,7 @@ describe Profiles::PreferencesController do go - expect(flash[:alert]).to eq('Failed to save preferences.') + expect(flash[:alert]).to eq(_('Failed to save preferences.')) end end diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index 11cb59aa12a..f912fafc74d 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -82,9 +82,9 @@ describe ProfilesController, :request_store do it 'allows setting a user status' do sign_in(user) - put :update, params: { user: { status: { message: 'Working hard!' } } } + put :update, params: { user: { status: { message: _('Working hard!') } } } - expect(user.reload.status.message).to eq('Working hard!') + expect(user.reload.status.message).to eq(_('Working hard!')) expect(response).to have_gitlab_http_status(302) end end diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index d94c18ddc02..16555b4cbf8 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -432,7 +432,7 @@ describe Projects::ClustersController do cluster.reload expect(response).to redirect_to(project_cluster_path(project, cluster)) - expect(flash[:notice]).to eq('Kubernetes cluster was successfully updated.') + expect(flash[:notice]).to eq(_('Kubernetes cluster was successfully updated.')) expect(cluster.enabled).to be_falsey expect(cluster.name).to eq('my-new-cluster-name') expect(cluster.platform_kubernetes.namespace).to eq('my-namespace') @@ -521,7 +521,7 @@ describe Projects::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(-1) expect(response).to redirect_to(project_clusters_path(project)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end @@ -534,7 +534,7 @@ describe Projects::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(-1) expect(response).to redirect_to(project_clusters_path(project)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end end @@ -549,7 +549,7 @@ describe Projects::ClustersController do .and change { Clusters::Providers::Gcp.count }.by(0) expect(response).to redirect_to(project_clusters_path(project)) - expect(flash[:notice]).to eq('Kubernetes cluster integration was successfully removed.') + expect(flash[:notice]).to eq(_('Kubernetes cluster integration was successfully removed.')) end end end diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index 26eec90da06..2ff635634b4 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -191,7 +191,7 @@ describe Projects::CommitController do }) expect(response).to redirect_to project_commits_path(project, 'master') - expect(flash[:notice]).to eq('The commit has been successfully reverted.') + expect(flash[:notice]).to eq(_('The commit has been successfully reverted.')) end end @@ -248,7 +248,7 @@ describe Projects::CommitController do }) expect(response).to redirect_to project_commits_path(project, 'master') - expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into master.') + expect(flash[:notice]).to eq(_('The commit has been successfully cherry-picked into master.')) end end diff --git a/spec/controllers/projects/group_links_controller_spec.rb b/spec/controllers/projects/group_links_controller_spec.rb index 675eeff8d12..dc0bc35b794 100644 --- a/spec/controllers/projects/group_links_controller_spec.rb +++ b/spec/controllers/projects/group_links_controller_spec.rb @@ -99,7 +99,7 @@ describe Projects::GroupLinksController do expect(response).to redirect_to( project_project_members_path(project) ) - expect(flash[:alert]).to eq('Please select a group.') + expect(flash[:alert]).to eq(_('Please select a group.')) end end end diff --git a/spec/controllers/projects/imports_controller_spec.rb b/spec/controllers/projects/imports_controller_spec.rb index 3ebfe4b0918..a66eb9b2485 100644 --- a/spec/controllers/projects/imports_controller_spec.rb +++ b/spec/controllers/projects/imports_controller_spec.rb @@ -69,7 +69,7 @@ describe Projects::ImportsController do get :show, params: { namespace_id: project.namespace.to_param, project_id: project } - expect(flash[:notice]).to eq 'The project was successfully forked.' + expect(flash[:notice]).to eq _('The project was successfully forked.') expect(response).to redirect_to project_path(project) end end @@ -78,7 +78,7 @@ describe Projects::ImportsController do it 'redirects to namespace_project_path' do get :show, params: { namespace_id: project.namespace.to_param, project_id: project } - expect(flash[:notice]).to eq 'The project was successfully imported.' + expect(flash[:notice]).to eq _('The project was successfully imported.') expect(response).to redirect_to project_path(project) end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index a2c3bb2919d..65cc276ad90 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -131,7 +131,7 @@ describe Projects::IssuesController do it 'redirects to signin if not logged in' do get :new, params: { namespace_id: project.namespace, project_id: project } - expect(flash[:notice]).to eq 'Please sign in to create the new issue.' + expect(flash[:notice]).to eq _('Please sign in to create the new issue.') expect(response).to redirect_to(new_user_session_path) end @@ -768,7 +768,7 @@ describe Projects::IssuesController do it 'sets a flash message' do post_issue(title: 'Hello') - expect(flash[:notice]).to eq('Resolved all discussions.') + expect(flash[:notice]).to eq(_('Resolved all discussions.')) end describe "resolving a single discussion" do @@ -782,7 +782,7 @@ describe Projects::IssuesController do end it 'sets a flash message that one discussion was resolved' do - expect(flash[:notice]).to eq('Resolved 1 discussion.') + expect(flash[:notice]).to eq(_('Resolved 1 discussion.')) end end end @@ -1067,7 +1067,7 @@ describe Projects::IssuesController do import_csv - expect(flash[:alert]).to include('File upload error.') + expect(flash[:alert]).to include(_('File upload error.')) expect(response).to redirect_to(project_issues_path(project)) end end diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 80506249ea9..b1d9dc22e91 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -410,7 +410,7 @@ describe Projects::PipelineSchedulesController do end expect(flash.to_a.size).to eq(2) - expect(flash[:alert]).to eq 'You cannot play this scheduled pipeline at the moment. Please wait a minute.' + expect(flash[:alert]).to eq _('You cannot play this scheduled pipeline at the moment. Please wait a minute.') expect(response).to have_gitlab_http_status(302) end end diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index 3cc3fe69fba..99b7f3304a7 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -52,7 +52,7 @@ describe Projects::ProjectMembersController do access_level: Gitlab::Access::GUEST } - expect(response).to set_flash.to 'Users were successfully added.' + expect(response).to set_flash.to _('Users were successfully added.') expect(response).to redirect_to(project_project_members_path(project)) end @@ -225,7 +225,7 @@ describe Projects::ProjectMembersController do project_id: project } - expect(response).to set_flash.to 'Your access request to the project has been withdrawn.' + expect(response).to set_flash.to _('Your access request to the project has been withdrawn.') expect(response).to redirect_to(project_path(project)) expect(project.requesters).to be_empty expect(project.users).not_to include user @@ -245,7 +245,7 @@ describe Projects::ProjectMembersController do project_id: project } - expect(response).to set_flash.to 'Your request for access has been queued for review.' + expect(response).to set_flash.to _('Your request for access has been queued for review.') expect(response).to redirect_to( project_path(project) ) diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index 4a5d2bdecb7..b4af153d77a 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -28,7 +28,7 @@ describe Projects::ServicesController do it 'returns error messages in JSON response' do put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params } - expect(json_response['message']).to eq "Validations failed." + expect(json_response['message']).to eq _("Validations failed.") expect(json_response['service_response']).to include "Url can't be blank" expect(response).to have_gitlab_http_status(200) end @@ -111,7 +111,7 @@ describe Projects::ServicesController do expect(response).to have_gitlab_http_status(200) expect(json_response).to eq( 'error' => true, - 'message' => 'Test failed.', + 'message' => _('Test failed.'), 'service_response' => '', 'test_failed' => true ) @@ -126,7 +126,7 @@ describe Projects::ServicesController do params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: true } } expect(response).to redirect_to(project_settings_integrations_path(project)) - expect(flash[:notice]).to eq 'JIRA activated.' + expect(flash[:notice]).to eq _('JIRA activated.') end end @@ -135,7 +135,7 @@ describe Projects::ServicesController do put :update, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: false } } - expect(flash[:notice]).to eq 'JIRA settings saved, but not activated.' + expect(flash[:notice]).to eq _('JIRA settings saved, but not activated.') end end diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb index b15a2bc84a5..77cc55937ee 100644 --- a/spec/controllers/projects/tree_controller_spec.rb +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -114,7 +114,7 @@ describe Projects::TreeController do it 'redirects to the new directory' do expect(subject) .to redirect_to("/#{project.full_path}/tree/#{branch_name}/#{path}") - expect(flash[:notice]).to eq('The directory has been successfully created.') + expect(flash[:notice]).to eq(_('The directory has been successfully created.')) end end diff --git a/spec/controllers/projects/wikis_controller_spec.rb b/spec/controllers/projects/wikis_controller_spec.rb index b2f40231796..7a8dc98c257 100644 --- a/spec/controllers/projects/wikis_controller_spec.rb +++ b/spec/controllers/projects/wikis_controller_spec.rb @@ -43,7 +43,7 @@ describe Projects::WikisController do subject expect(response).to have_http_status(:ok) - expect(flash[:notice]).to eq 'The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.' + expect(flash[:notice]).to eq _('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.') end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 9801ed19957..b64f170efa6 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -435,7 +435,7 @@ describe ProjectsController do expect(project.namespace).to eq(old_namespace) expect(response).to have_gitlab_http_status(200) - expect(flash[:alert]).to eq 'Please select a new namespace for your project.' + expect(flash[:alert]).to eq _('Please select a new namespace for your project.') end end end @@ -587,7 +587,7 @@ describe ProjectsController do format: :js) expect(forked_project.reload.forked?).to be_falsey - expect(flash[:notice]).to eq('The fork relationship has been removed.') + expect(flash[:notice]).to eq(_('The fork relationship has been removed.')) expect(response).to render_template(:remove_fork) end end diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index fd151e8a298..aae27e238d3 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -55,7 +55,7 @@ describe RegistrationsController do post(:create, params: user_params) expect(response).to render_template(:new) - expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' + expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.') end it 'redirects to the dashboard when the recaptcha is solved' do @@ -112,7 +112,7 @@ describe RegistrationsController do end def expect_success - expect(flash[:notice]).to eq 'Account scheduled for removal.' + expect(flash[:notice]).to eq _('Account scheduled for removal.') expect(response.status).to eq(303) expect(response).to redirect_to new_user_session_path end diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index ea7242c1aa8..fa71ebb7d1b 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -101,7 +101,7 @@ describe SessionsController do post(:create, params: { user: user_params }) expect(response).to render_template(:new) - expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' + expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.') expect(subject.current_user).to be_nil end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 3b354c0d96b..753003a1572 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -9,7 +9,7 @@ FactoryBot.define do if group.owner # We could remove this after we have proper constraint: # https://gitlab.com/gitlab-org/gitlab-ce/issues/43292 - raise "Don't set owner for groups, use `group.add_owner(user)` instead" + raise _("Don't set owner for groups, use `group.add_owner(user)` instead") end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 1906c06a211..98a8994b7df 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -146,7 +146,7 @@ FactoryBot.define do end after :create do |project, evaluator| - raise "Failed to create repository!" unless project.create_repository + raise _("Failed to create repository!") unless project.create_repository evaluator.files.each do |filename, content| project.repository.create_file( @@ -196,7 +196,7 @@ FactoryBot.define do trait :empty_repo do after(:create) do |project| - raise "Failed to create repository!" unless project.create_repository + raise _("Failed to create repository!") unless project.create_repository end end @@ -220,7 +220,7 @@ FactoryBot.define do trait :wiki_repo do after(:create) do |project| - raise 'Failed to create wiki repository!' unless project.create_wiki + raise _('Failed to create wiki repository!') unless project.create_wiki end end @@ -230,7 +230,7 @@ FactoryBot.define do trait :broken_repo do after(:create) do |project| - raise "Failed to create repository!" unless project.create_repository + raise _("Failed to create repository!") unless project.create_repository project.gitlab_shell.rm_directory(project.repository_storage, File.join("#{project.disk_path}.git", 'refs')) diff --git a/spec/factories/terms.rb b/spec/factories/terms.rb index 5ffca365a5f..45307cbb34e 100644 --- a/spec/factories/terms.rb +++ b/spec/factories/terms.rb @@ -1,5 +1,5 @@ FactoryBot.define do factory :term, class: ApplicationSetting::Term do - terms "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + terms _("Lorem ipsum dolor sit amet, consectetur adipiscing elit.") end end diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 790051dd933..253065bafda 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -29,7 +29,7 @@ describe "Admin Health Check", :feature do orig_token = Gitlab::CurrentSettings.health_check_access_token click_button 'Reset health check access token' - expect(page).to have_content('New health check access token has been generated!') + expect(page).to have_content(_('New health check access token has been generated!')) expect(find('#health-check-token').text).not_to eq orig_token end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 04f39b807d7..99a3eff8212 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -128,13 +128,13 @@ describe 'Admin updates settings' do accept_terms(admin) page.within('.as-terms') do - check 'Require all users to accept Terms of Service and Privacy Policy when they access GitLab.' - fill_in 'Terms of Service Agreement', with: 'Be nice!' + check _('Require all users to accept Terms of Service and Privacy Policy when they access GitLab.') + fill_in 'Terms of Service Agreement', with: _('Be nice!') click_button 'Save changes' end expect(Gitlab::CurrentSettings.enforce_terms).to be(true) - expect(Gitlab::CurrentSettings.terms).to eq 'Be nice!' + expect(Gitlab::CurrentSettings.terms).to eq _('Be nice!') expect(page).to have_content 'Application settings saved successfully' end diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index c7860bebb06..af346ad35b9 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -68,7 +68,7 @@ describe 'Admin > Users > Impersonation Tokens', :js do accept_confirm { click_on "Revoke" } expect(page).to have_selector(".settings-message") - expect(no_personal_access_tokens_message).to have_text("This user has no active Impersonation Tokens.") + expect(no_personal_access_tokens_message).to have_text(_("This user has no active Impersonation Tokens.")) end it "removes expired tokens from 'active' section" do @@ -77,7 +77,7 @@ describe 'Admin > Users > Impersonation Tokens', :js do visit admin_user_impersonation_tokens_path(user_id: user.username) expect(page).to have_selector(".settings-message") - expect(no_personal_access_tokens_message).to have_text("This user has no active Impersonation Tokens.") + expect(no_personal_access_tokens_message).to have_text(_("This user has no active Impersonation Tokens.")) end end end diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index d04bb9acd9e..c368b2ee1a7 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -39,7 +39,7 @@ describe 'Admin uses repository checks' do accept_confirm { find(:link, 'Clear all repository checks').send_keys(:return) } - expect(page).to have_content('Started asynchronous removal of all repository check states.') + expect(page).to have_content(_('Started asynchronous removal of all repository check states.')) end def visit_admin_project_page(project) diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb index 8d7df346abb..3316726b4c8 100644 --- a/spec/features/atom/users_spec.rb +++ b/spec/features/atom/users_spec.rb @@ -26,7 +26,7 @@ describe "User Feed" do create(:issue, project: project, author: user, - description: "Houston, we have a bug!\n\n***\n\nI guess.") + description: _("Houston, we have a bug!\n\n***\n\nI guess.")) end let(:note) do create(:note, diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index 030993462b5..19362d6cd39 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -30,7 +30,7 @@ describe 'Issue Boards add issue modal', :js do page.within('.add-issues-modal') do expect(find('.form-control').value).to eq('') expect(page).to have_selector('.clear-search', visible: false) - expect(find('.form-control')[:placeholder]).to eq('Search or filter results...') + expect(find('.form-control')[:placeholder]).to eq(_('Search or filter results...')) end end diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 08c27354bd2..f14aab5de84 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -27,7 +27,7 @@ describe 'Issue Boards', :js do end it 'shows blank state' do - expect(page).to have_content('Welcome to your Issue Board!') + expect(page).to have_content(_('Welcome to your Issue Board!')) end it 'shows tooltip on add issues button' do diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb index d96707e55fd..037dd9b96db 100644 --- a/spec/features/boards/modal_filter_spec.rb +++ b/spec/features/boards/modal_filter_spec.rb @@ -24,7 +24,7 @@ describe 'Issue Boards add issue modal filtering', :js do wait_for_requests - expect(page).to have_content('There are no issues to show.') + expect(page).to have_content(_('There are no issues to show.')) end end diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index 32c75cae0a1..9524f59d3bd 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -32,7 +32,7 @@ describe 'Cycle Analytics', :js do it 'shows active stage with empty message' do expect(page).to have_selector('.stage-nav-item.active', text: 'Issue') - expect(page).to have_content("We don't have enough data to show this stage.") + expect(page).to have_content(_("We don't have enough data to show this stage.")) end end @@ -129,10 +129,10 @@ describe 'Cycle Analytics', :js do expect(find('.stage-events')).to have_content(issue.title) click_stage('Code') - expect(find('.stage-events')).to have_content('You need permission.') + expect(find('.stage-events')).to have_content(_('You need permission.')) click_stage('Review') - expect(find('.stage-events')).to have_content('You need permission.') + expect(find('.stage-events')).to have_content(_('You need permission.')) end end diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 8d801161148..17e33e04cb1 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -257,7 +257,7 @@ describe 'Expand and collapse diffs', :js do # Wait for elements to appear to ensure full page reload expect(page).to have_content('This diff was suppressed by a .gitattributes entry') - expect(page).to have_content('This source diff could not be displayed because it is too large.') + expect(page).to have_content(_('This source diff could not be displayed because it is too large.')) expect(page).to have_content('too_large_image.jpg') find('.note-textarea') diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 8ed4051856e..9f4b6c6ce3f 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -69,13 +69,13 @@ describe 'Explore Groups page', :js do describe 'landing component' do it 'should show a landing component' do - expect(page).to have_content('Below you will find all the groups that are public.') + expect(page).to have_content(_('Below you will find all the groups that are public.')) end it 'should be dismissable' do find('.dismiss-button').click - expect(page).not_to have_content('Below you will find all the groups that are public.') + expect(page).not_to have_content(_('Below you will find all the groups that are public.')) end it 'should persistently not show once dismissed' do @@ -83,7 +83,7 @@ describe 'Explore Groups page', :js do visit explore_groups_path - expect(page).not_to have_content('Below you will find all the groups that are public.') + expect(page).not_to have_content(_('Below you will find all the groups that are public.')) end end end diff --git a/spec/features/groups/clusters/user_spec.rb b/spec/features/groups/clusters/user_spec.rb index 2410cd92e3f..77a5d76ea08 100644 --- a/spec/features/groups/clusters/user_spec.rb +++ b/spec/features/groups/clusters/user_spec.rb @@ -92,7 +92,7 @@ describe 'User Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) end end @@ -104,7 +104,7 @@ describe 'User Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) expect(cluster.reload.name).to eq('my-dev-cluster') expect(cluster.reload.platform_kubernetes.token).to eq('new-token') end @@ -118,7 +118,7 @@ describe 'User Cluster', :js do end it 'user sees creation form with the successful message' do - expect(page).to have_content('Kubernetes cluster integration was successfully removed.') + expect(page).to have_content(_('Kubernetes cluster integration was successfully removed.')) expect(page).to have_link('Add Kubernetes cluster') end end diff --git a/spec/features/groups/members/request_access_spec.rb b/spec/features/groups/members/request_access_spec.rb index 94510f917a3..9aa70df8222 100644 --- a/spec/features/groups/members/request_access_spec.rb +++ b/spec/features/groups/members/request_access_spec.rb @@ -26,7 +26,7 @@ describe 'Groups > Members > Request access' do expect(ActionMailer::Base.deliveries.last.subject).to match "Request to join the #{group.name} group" expect(group.requesters.exists?(user_id: user)).to be_truthy - expect(page).to have_content 'Your request for access has been queued for review.' + expect(page).to have_content _('Your request for access has been queued for review.') expect(page).to have_content 'Withdraw Access Request' expect(page).not_to have_content 'Leave group' @@ -66,7 +66,7 @@ describe 'Groups > Members > Request access' do click_link 'Withdraw Access Request' expect(group.requesters.exists?(user_id: user)).to be_falsey - expect(page).to have_content 'Your access request to the group has been withdrawn.' + expect(page).to have_content _('Your access request to the group has been withdrawn.') end it 'member does not see the request access button' do diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index d57eb87ca77..45665d32a5f 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -27,7 +27,7 @@ describe 'Group milestones' do preview = find('.js-md-preview') - expect(preview).to have_content('Nothing to preview.') + expect(preview).to have_content(_('Nothing to preview.')) click_button('Write') diff --git a/spec/features/groups/settings/group_badges_spec.rb b/spec/features/groups/settings/group_badges_spec.rb index a5c8dbf18d0..fb717076e52 100644 --- a/spec/features/groups/settings/group_badges_spec.rb +++ b/spec/features/groups/settings/group_badges_spec.rb @@ -104,7 +104,7 @@ describe 'Group Badges' do click_delete_button(rows[1]) - expect(find('.modal .modal-title')).to have_content 'Delete badge?' + expect(find('.modal .modal-title')).to have_content _('Delete badge?') end it 'deletes a badge when confirming the modal' do diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 00d81b26ce2..187daeb18e6 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -9,7 +9,7 @@ describe 'Group' do matcher :have_namespace_error_message do match do |page| - page.has_content?("Group URL can contain only letters, digits, '_', '-' and '.'. Cannot start with '-' or end in '.', '.git' or '.atom'.") + page.has_content?(_("Group URL can contain only letters, digits, '_', '-' and '.'. Cannot start with '-' or end in '.', '.git' or '.atom'.")) end end @@ -119,7 +119,7 @@ describe 'Group' do click_button 'Create group' expect(current_path).to eq(group_path('foo/bar')) - expect(page).to have_content("Group 'bar' was successfully created.") + expect(page).to have_content(_("Group 'bar' was successfully created.")) end end @@ -138,7 +138,7 @@ describe 'Group' do click_button 'Create group' expect(current_path).to eq(group_path('foo/bar')) - expect(page).to have_content("Group 'bar' was successfully created.") + expect(page).to have_content(_("Group 'bar' was successfully created.")) end end end diff --git a/spec/features/import/manifest_import_spec.rb b/spec/features/import/manifest_import_spec.rb index a90cdd8d920..55989fcdb7b 100644 --- a/spec/features/import/manifest_import_spec.rb +++ b/spec/features/import/manifest_import_spec.rb @@ -42,7 +42,7 @@ describe 'Import multiple repositories by uploading a manifest file', :js, :post attach_file('manifest', Rails.root.join('spec/fixtures/banana_sample.gif')) click_on 'List available repositories' - expect(page).to have_content 'The uploaded file is not a valid XML file.' + expect(page).to have_content _('The uploaded file is not a valid XML file.') end def first_row diff --git a/spec/features/invites_spec.rb b/spec/features/invites_spec.rb index 9e1a12a9c2a..2d3be4986ff 100644 --- a/spec/features/invites_spec.rb +++ b/spec/features/invites_spec.rb @@ -52,7 +52,7 @@ describe 'Invites' do expect(current_path).to eq(invite_path(group_invite.raw_invite_token)) expect(page).to have_content( - 'You have been invited by John Doe to join group Owned as Developer.' + _('You have been invited by John Doe to join group Owned as Developer.') ) expect(page).to have_link('Accept invitation') expect(page).to have_link('Decline') @@ -80,7 +80,7 @@ describe 'Invites' do page.click_link 'Accept invitation' expect(current_path).to eq(group_path(group)) expect(page).to have_content( - 'You have been granted Developer access to group Owned.' + _('You have been granted Developer access to group Owned.') ) end end @@ -96,7 +96,7 @@ describe 'Invites' do page.click_link 'Decline' expect(current_path).to eq(dashboard_projects_path) expect(page).to have_content( - 'You have declined the invitation to join group Owned.' + _('You have declined the invitation to join group Owned.') ) end end @@ -109,7 +109,7 @@ describe 'Invites' do it 'declines application and redirects to sign in page' do expect(current_path).to eq(new_user_session_path) expect(page).to have_content( - 'You have declined the invitation to join group Owned.' + _('You have declined the invitation to join group Owned.') ) end end diff --git a/spec/features/issuables/discussion_lock_spec.rb b/spec/features/issuables/discussion_lock_spec.rb index 7ea29ff252b..3582f153df0 100644 --- a/spec/features/issuables/discussion_lock_spec.rb +++ b/spec/features/issuables/discussion_lock_spec.rb @@ -98,7 +98,7 @@ describe 'Discussion Lock', :js do page.within('#notes') do expect(page).not_to have_selector('js-main-target-form') expect(page.find('.disabled-comment')) - .to have_content('This issue is locked. Only project members can comment.') + .to have_content(_('This issue is locked. Only project members can comment.')) end end end diff --git a/spec/features/issuables/shortcuts_issuable_spec.rb b/spec/features/issuables/shortcuts_issuable_spec.rb index a0ae6720a9f..e1e2b53704b 100644 --- a/spec/features/issuables/shortcuts_issuable_spec.rb +++ b/spec/features/issuables/shortcuts_issuable_spec.rb @@ -5,7 +5,7 @@ describe 'Blob shortcuts', :js do let(:project) { create(:project, :public, :repository) } let(:issue) { create(:issue, project: project, author: user) } let(:merge_request) { create(:merge_request, source_project: project) } - let(:note_text) { 'I got this!' } + let(:note_text) { _('I got this!') } before do project.add_developer(user) diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index ada57285abf..600bdd9d16b 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -65,7 +65,7 @@ describe 'Resolving all open discussions in a merge request from an issue', :js end it 'shows a warning that the merge request contains unresolved discussions' do - expect(page).to have_content 'There are unresolved discussions.' + expect(page).to have_content _('There are unresolved discussions.') end it 'has a link to resolve all discussions by creating an issue' do diff --git a/spec/features/issues/note_polling_spec.rb b/spec/features/issues/note_polling_spec.rb index 3cd7ce6dada..342760c85f6 100644 --- a/spec/features/issues/note_polling_spec.rb +++ b/spec/features/issues/note_polling_spec.rb @@ -12,10 +12,10 @@ describe 'Issue notes polling', :js do end it 'displays the new comment' do - note = create(:note, noteable: issue, project: project, note: 'Looks good!') + note = create(:note, noteable: issue, project: project, note: _('Looks good!')) wait_for_requests - expect(page).to have_selector("#note_#{note.id}", text: 'Looks good!') + expect(page).to have_selector("#note_#{note.id}", text: _('Looks good!')) end end diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb index e60486f6dcb..1b028b8933e 100644 --- a/spec/features/issues/user_creates_issue_spec.rb +++ b/spec/features/issues/user_creates_issue_spec.rb @@ -57,7 +57,7 @@ describe "User creates issue" do preview = find(".js-md-preview") # this element is findable only when the "Preview" link is clicked. - expect(preview).to have_content("Nothing to preview.") + expect(preview).to have_content(_("Nothing to preview.")) click_button("Write") fill_in("Description", with: "Bug fixed :smile:") diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 406e80e91aa..38f5d9358d1 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -25,8 +25,8 @@ describe 'Issues' do visit project_issues_path(project) expect(page).to have_content('Register / Sign In') - expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project.') - expect(page).to have_content('You can register or sign in to create issues for this project.') + expect(page).to have_content(_('The Issue Tracker is the place to add things that need to be improved or solved in a project.')) + expect(page).to have_content(_('You can register or sign in to create issues for this project.')) end it_behaves_like 'empty state with filters' @@ -47,7 +47,7 @@ describe 'Issues' do visit project_issues_path(project) expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project') - expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.') + expect(page).to have_content(_('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')) expect(page).to have_content('New issue') end diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index 7839b97122c..0195d37c515 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -29,7 +29,7 @@ describe 'a maintainer edits files on a source-branch of an MR from a fork', :js end it 'mentions commits will go to the source branch' do - expect(page).to have_content('Your changes can be committed to fix because a merge request is open.') + expect(page).to have_content(_('Your changes can be committed to fix because a merge request is open.')) end it 'allows committing to the source branch' do diff --git a/spec/features/merge_request/user_expands_diff_spec.rb b/spec/features/merge_request/user_expands_diff_spec.rb index 3560b8d90bb..9d1188d2324 100644 --- a/spec/features/merge_request/user_expands_diff_spec.rb +++ b/spec/features/merge_request/user_expands_diff_spec.rb @@ -15,11 +15,11 @@ describe 'User expands diff', :js do it 'allows user to expand diff' do page.within find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd"]') do - click_link 'Click to expand it.' + click_link _('Click to expand it.') wait_for_requests - expect(page).not_to have_content('Click to expand it.') + expect(page).not_to have_content(_('Click to expand it.')) expect(page).to have_selector('.code') end end diff --git a/spec/features/merge_request/user_locks_discussion_spec.rb b/spec/features/merge_request/user_locks_discussion_spec.rb index 76c759ab8d3..4cc3194a3a7 100644 --- a/spec/features/merge_request/user_locks_discussion_spec.rb +++ b/spec/features/merge_request/user_locks_discussion_spec.rb @@ -41,7 +41,7 @@ describe 'Merge request > User locks discussion', :js do page.within('.js-vue-notes-event') do expect(page).not_to have_selector('js-main-target-form') expect(page.find('.issuable-note-warning')) - .to have_content('This merge request is locked. Only project members can comment.') + .to have_content(_('This merge request is locked. Only project members can comment.')) end end end diff --git a/spec/features/merge_request/user_posts_notes_spec.rb b/spec/features/merge_request/user_posts_notes_spec.rb index ee5f5377ca6..7ee4f017495 100644 --- a/spec/features/merge_request/user_posts_notes_spec.rb +++ b/spec/features/merge_request/user_posts_notes_spec.rb @@ -49,16 +49,16 @@ describe 'Merge request > User posts notes', :js do describe 'when posting a note' do before do page.within('.js-main-target-form') do - fill_in 'note[note]', with: 'This is awesome!' + fill_in 'note[note]', with: _('This is awesome!') find('.js-md-preview-button').click click_button 'Comment' end end it 'is added and form reset' do - is_expected.to have_content('This is awesome!') + is_expected.to have_content(_('This is awesome!')) page.within('.js-main-target-form') do - expect(page).to have_no_field('note[note]', with: 'This is awesome!') + expect(page).to have_no_field('note[note]', with: _('This is awesome!')) expect(page).to have_css('.js-vue-md-preview', visible: :hidden) end wait_for_requests diff --git a/spec/features/merge_request/user_resolves_conflicts_spec.rb b/spec/features/merge_request/user_resolves_conflicts_spec.rb index 50c723776a3..fb4220addaf 100644 --- a/spec/features/merge_request/user_resolves_conflicts_spec.rb +++ b/spec/features/merge_request/user_resolves_conflicts_spec.rb @@ -189,7 +189,7 @@ describe 'Merge request > User resolves conflicts', :js do visit current_url + '/conflicts' wait_for_requests - expect(find('#conflicts')).to have_content('Please try to resolve them locally.') + expect(find('#conflicts')).to have_content(_('Please try to resolve them locally.')) end end end diff --git a/spec/features/merge_request/user_reverts_merge_request_spec.rb b/spec/features/merge_request/user_reverts_merge_request_spec.rb index 67b6aefb2d8..b11b9708a2e 100644 --- a/spec/features/merge_request/user_reverts_merge_request_spec.rb +++ b/spec/features/merge_request/user_reverts_merge_request_spec.rb @@ -26,7 +26,7 @@ describe 'User reverts a merge request', :js do click_button('Revert') end - expect(page).to have_content('The merge request has been successfully reverted.') + expect(page).to have_content(_('The merge request has been successfully reverted.')) wait_for_requests end @@ -56,7 +56,7 @@ describe 'User reverts a merge request', :js do click_button('Revert') end - expect(page).to have_content('The merge request has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + expect(page).to have_content(_('The merge request has been successfully reverted. You can now submit a merge request to get this change into the original branch.')) end it 'cannot revert a merge requests for an archived project' do diff --git a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb index f6b771facf8..24de4517528 100644 --- a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb @@ -19,7 +19,7 @@ describe 'Merge request > User sees merge button depending on unresolved discuss context 'with unresolved discussions' do it 'does not allow to merge' do expect(page).not_to have_button 'Merge' - expect(page).to have_content('There are unresolved discussions.') + expect(page).to have_content(_('There are unresolved discussions.')) end end diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index afb978d7c45..4729b7a3b8e 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -180,7 +180,7 @@ describe 'Merge request > User sees merge widget', :js do # Wait for the `ci_status` and `merge_check` requests wait_for_requests - expect(page).to have_text("Could not retrieve the pipeline status. For troubleshooting steps, read the documentation.") + expect(page).to have_text(_("Could not retrieve the pipeline status. For troubleshooting steps, read the documentation.")) end end diff --git a/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb b/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb index fd4175d5227..313d0bfbf86 100644 --- a/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb +++ b/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb @@ -15,7 +15,7 @@ describe 'Merge request > User sees MR with deleted source branch', :js do end it 'shows a message about missing source branch' do - expect(page).to have_content('Source branch does not exist.') + expect(page).to have_content(_('Source branch does not exist.')) end it 'still contains Discussion, Commits and Changes tabs' do @@ -29,6 +29,6 @@ describe 'Merge request > User sees MR with deleted source branch', :js do wait_for_requests expect(page).to have_selector('.diffs.tab-pane .file-holder') - expect(page).to have_content('Source branch does not exist.') + expect(page).to have_content(_('Source branch does not exist.')) end end diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index 8faddee4daa..a450f658c57 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -41,7 +41,7 @@ describe 'Merge request > User sees pipelines', :js do visit project_merge_request_path(project, merge_request) wait_for_requests - expect(page.find('.ci-widget')).to have_text("Could not retrieve the pipeline status. For troubleshooting steps, read the documentation.") + expect(page.find('.ci-widget')).to have_text(_("Could not retrieve the pipeline status. For troubleshooting steps, read the documentation.")) end end diff --git a/spec/features/merge_request/user_uses_quick_actions_spec.rb b/spec/features/merge_request/user_uses_quick_actions_spec.rb index b81478a481f..3289ade4ea1 100644 --- a/spec/features/merge_request/user_uses_quick_actions_spec.rb +++ b/spec/features/merge_request/user_uses_quick_actions_spec.rb @@ -106,7 +106,7 @@ describe 'Merge request > User uses quick actions', :js do it 'does not merge the MR' do add_note("/merge") - expect(page).not_to have_content 'Your commands have been executed!' + expect(page).not_to have_content _('Your commands have been executed!') expect(merge_request.reload).not_to be_merged end @@ -122,7 +122,7 @@ describe 'Merge request > User uses quick actions', :js do it 'does not merge the MR' do add_note("/merge") - expect(page).not_to have_content 'Your commands have been executed!' + expect(page).not_to have_content _('Your commands have been executed!') expect(merge_request.reload).not_to be_merged end diff --git a/spec/features/merge_request/user_views_open_merge_request_spec.rb b/spec/features/merge_request/user_views_open_merge_request_spec.rb index 71022c6bb08..0176469b101 100644 --- a/spec/features/merge_request/user_views_open_merge_request_spec.rb +++ b/spec/features/merge_request/user_views_open_merge_request_spec.rb @@ -43,7 +43,7 @@ describe 'User views an open merge request' do page.within('.gfm-form') do click_button('Preview') - expect(find('.js-md-preview')).to have_content('Nothing to preview.') + expect(find('.js-md-preview')).to have_content(_('Nothing to preview.')) end end diff --git a/spec/features/milestone_spec.rb b/spec/features/milestone_spec.rb index a0673b12738..c5144669a14 100644 --- a/spec/features/milestone_spec.rb +++ b/spec/features/milestone_spec.rb @@ -23,7 +23,7 @@ describe 'Milestone' do find('input[name="commit"]').click - expect(find('.alert-success')).to have_content('Assign some issues to this milestone.') + expect(find('.alert-success')).to have_content(_('Assign some issues to this milestone.')) expect(page).to have_content('Nov 16, 2016–Dec 16, 2016') end end @@ -35,7 +35,7 @@ describe 'Milestone' do create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed") visit project_milestone_path(project, milestone) - expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.') + expect(find('.alert-success')).to have_content(_('All issues for this milestone are closed. You may close this milestone now.')) end end diff --git a/spec/features/password_reset_spec.rb b/spec/features/password_reset_spec.rb index dcc63dff9f5..c9e2e871a95 100644 --- a/spec/features/password_reset_spec.rb +++ b/spec/features/password_reset_spec.rb @@ -54,7 +54,7 @@ describe 'Password reset' do def forgot_password(user) visit root_path - click_on 'Forgot your password?' + click_on _('Forgot your password?') fill_in 'Email', with: user.email click_button 'Reset password' user.reload diff --git a/spec/features/profiles/active_sessions_spec.rb b/spec/features/profiles/active_sessions_spec.rb index d3050760c06..a971c58ab2d 100644 --- a/spec/features/profiles/active_sessions_spec.rb +++ b/spec/features/profiles/active_sessions_spec.rb @@ -83,7 +83,7 @@ describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do using_session :session2 do visit profile_active_sessions_path - expect(page).to have_content('You need to sign in or sign up before continuing.') + expect(page).to have_content(_('You need to sign in or sign up before continuing.')) end end end diff --git a/spec/features/profiles/chat_names_spec.rb b/spec/features/profiles/chat_names_spec.rb index c72069f6262..c5aeb0f29b6 100644 --- a/spec/features/profiles/chat_names_spec.rb +++ b/spec/features/profiles/chat_names_spec.rb @@ -71,7 +71,7 @@ describe 'Profile > Chat' do it 'removes chat account' do click_link 'Remove' - expect(page).to have_content("You don't have any active chat names.") + expect(page).to have_content(_("You don't have any active chat names.")) end end end diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb index 7d204f89fba..7f59f2e8714 100644 --- a/spec/features/profiles/oauth_applications_spec.rb +++ b/spec/features/profiles/oauth_applications_spec.rb @@ -39,7 +39,7 @@ describe 'Profile > Applications' do accept_confirm { click_button 'Revoke' } end - expect(page).to have_content('The application was revoked access.') + expect(page).to have_content(_('The application was revoked access.')) expect(page).to have_content('Your applications (0)') expect(page).to have_content('Authorized applications (0)') end diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index dee213a11d4..0ded974f353 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -84,7 +84,7 @@ describe 'Profile > Personal Access Tokens', :js do accept_confirm { click_on "Revoke" } expect(page).to have_selector(".settings-message") - expect(no_personal_access_tokens_message).to have_text("This user has no active Personal Access Tokens.") + expect(no_personal_access_tokens_message).to have_text(_("This user has no active Personal Access Tokens.")) end it "removes expired tokens from 'active' section" do @@ -92,7 +92,7 @@ describe 'Profile > Personal Access Tokens', :js do visit profile_personal_access_tokens_path expect(page).to have_selector(".settings-message") - expect(no_personal_access_tokens_message).to have_text("This user has no active Personal Access Tokens.") + expect(no_personal_access_tokens_message).to have_text(_("This user has no active Personal Access Tokens.")) end context "when revocation fails" do diff --git a/spec/features/profiles/user_visits_profile_preferences_page_spec.rb b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb index 90d6841af0e..32fecf24c07 100644 --- a/spec/features/profiles/user_visits_profile_preferences_page_spec.rb +++ b/spec/features/profiles/user_visits_profile_preferences_page_spec.rb @@ -62,7 +62,7 @@ describe 'User visits the profile preferences page' do def expect_preferences_saved_message page.within('.flash-container') do - expect(page).to have_content('Preferences saved.') + expect(page).to have_content(_('Preferences saved.')) end end end diff --git a/spec/features/projects/artifacts/file_spec.rb b/spec/features/projects/artifacts/file_spec.rb index 993d0040434..8970116eea7 100644 --- a/spec/features/projects/artifacts/file_spec.rb +++ b/spec/features/projects/artifacts/file_spec.rb @@ -23,7 +23,7 @@ describe 'Artifact file', :js do it 'displays an error' do aggregate_failures do # shows an error message - expect(page).to have_content('The source could not be displayed because it is stored as a job artifact. You can download it instead.') + expect(page).to have_content(_('The source could not be displayed because it is stored as a job artifact. You can download it instead.')) # does not show a viewer switcher expect(page).not_to have_selector('.js-blob-viewer-switcher') diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb index e2f9e7e9cc5..dd68d01e88b 100644 --- a/spec/features/projects/blobs/blob_show_spec.rb +++ b/spec/features/projects/blobs/blob_show_spec.rb @@ -220,7 +220,7 @@ describe 'File blob', :js do expect(page).to have_selector('.blob-viewer[data-type="rich"]') # shows an error message - expect(page).to have_content('The rendered file could not be displayed because it is stored in LFS. You can download it instead.') + expect(page).to have_content(_('The rendered file could not be displayed because it is stored in LFS. You can download it instead.')) # shows a viewer switcher expect(page).to have_selector('.js-blob-viewer-switcher') @@ -247,7 +247,7 @@ describe 'File blob', :js do expect(page).to have_selector('.blob-viewer[data-type="rich"]', visible: false) # shows an error message - expect(page).to have_content('The source could not be displayed because it is stored in LFS. You can download it instead.') + expect(page).to have_content(_('The source could not be displayed because it is stored in LFS. You can download it instead.')) # does not show a copy button expect(page).not_to have_selector('.js-copy-blob-source-btn') @@ -482,7 +482,7 @@ describe 'File blob', :js do it 'displays an auxiliary viewer' do aggregate_failures do # shows that configuration is valid - expect(page).to have_content('This GitLab CI configuration is valid.') + expect(page).to have_content(_('This GitLab CI configuration is valid.')) # shows a learn more link expect(page).to have_link('Learn more') @@ -514,7 +514,7 @@ describe 'File blob', :js do it 'displays an auxiliary viewer' do aggregate_failures do # shows that map is valid - expect(page).to have_content('This Route Map is valid.') + expect(page).to have_content(_('This Route Map is valid.')) # shows a learn more link expect(page).to have_link('Learn more') @@ -530,7 +530,7 @@ describe 'File blob', :js do it 'displays an auxiliary viewer' do aggregate_failures do # shows license - expect(page).to have_content('This project is licensed under the MIT License.') + expect(page).to have_content(_('This project is licensed under the MIT License.')) # shows a learn more link expect(page).to have_link('Learn more', href: 'http://choosealicense.com/licenses/mit/') @@ -563,7 +563,7 @@ describe 'File blob', :js do it 'displays an auxiliary viewer' do aggregate_failures do # shows names of dependency manager and package - expect(page).to have_content('This project manages its dependencies using RubyGems and defines a gem named activerecord.') + expect(page).to have_content(_('This project manages its dependencies using RubyGems and defines a gem named activerecord.')) # shows a link to the gem expect(page).to have_link('activerecord', href: 'https://rubygems.org/gems/activerecord') diff --git a/spec/features/projects/clusters/applications_spec.rb b/spec/features/projects/clusters/applications_spec.rb index fab9e035d53..5b14457318b 100644 --- a/spec/features/projects/clusters/applications_spec.rb +++ b/spec/features/projects/clusters/applications_spec.rb @@ -189,7 +189,7 @@ describe 'Clusters Applications', :js do retries = 0 while Clusters::Cluster.last.application_helm.nil? - raise "Timed out waiting for helm application to be created in DB" if (retries += 1) > 3 + raise _("Timed out waiting for helm application to be created in DB") if (retries += 1) > 3 sleep(1) end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 9322e29d744..3343ed319b8 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -63,7 +63,7 @@ describe 'Gcp Cluster', :js do it 'user sees a cluster details page and creation status' do subject - expect(page).to have_content('Kubernetes cluster is being created on Google Kubernetes Engine...') + expect(page).to have_content(_('Kubernetes cluster is being created on Google Kubernetes Engine...')) Clusters::Cluster.last.provider.make_created! @@ -73,11 +73,11 @@ describe 'Gcp Cluster', :js do it 'user sees a error if something wrong during creation' do subject - expect(page).to have_content('Kubernetes cluster is being created on Google Kubernetes Engine...') + expect(page).to have_content(_('Kubernetes cluster is being created on Google Kubernetes Engine...')) - Clusters::Cluster.last.provider.make_errored!('Something wrong!') + Clusters::Cluster.last.provider.make_errored!(_('Something wrong!')) - expect(page).to have_content('Something wrong!') + expect(page).to have_content(_('Something wrong!')) end it 'user sees RBAC is enabled by default' do @@ -116,7 +116,7 @@ describe 'Gcp Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) end end @@ -128,7 +128,7 @@ describe 'Gcp Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) expect(cluster.reload.platform_kubernetes.namespace).to eq('my-namespace') end end @@ -141,7 +141,7 @@ describe 'Gcp Cluster', :js do end it 'user sees creation form with the successful message' do - expect(page).to have_content('Kubernetes cluster integration was successfully removed.') + expect(page).to have_content(_('Kubernetes cluster integration was successfully removed.')) expect(page).to have_link('Add Kubernetes cluster') end end diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index 1f2f7592d8b..a57b99ea23a 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -76,7 +76,7 @@ describe 'User Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) end end @@ -88,7 +88,7 @@ describe 'User Cluster', :js do end it 'user sees the successful message' do - expect(page).to have_content('Kubernetes cluster was successfully updated.') + expect(page).to have_content(_('Kubernetes cluster was successfully updated.')) expect(cluster.reload.name).to eq('my-dev-cluster') expect(cluster.reload.platform_kubernetes.namespace).to eq('my-namespace') end @@ -102,7 +102,7 @@ describe 'User Cluster', :js do end it 'user sees creation form with the successful message' do - expect(page).to have_content('Kubernetes cluster integration was successfully removed.') + expect(page).to have_content(_('Kubernetes cluster integration was successfully removed.')) expect(page).to have_link('Add Kubernetes cluster') end end diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index a61b614dbc8..5790c3c30f0 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -21,7 +21,7 @@ describe 'Cherry-pick Commits' do uncheck 'create_merge_request' click_button 'Cherry-pick' end - expect(page).to have_content('The commit has been successfully cherry-picked into master.') + expect(page).to have_content(_('The commit has been successfully cherry-picked into master.')) end end @@ -32,7 +32,7 @@ describe 'Cherry-pick Commits' do uncheck 'create_merge_request' click_button 'Cherry-pick' end - expect(page).to have_content('The commit has been successfully cherry-picked into master.') + expect(page).to have_content(_('The commit has been successfully cherry-picked into master.')) end end @@ -86,7 +86,7 @@ describe 'Cherry-pick Commits' do click_button 'Cherry-pick' end - expect(page).to have_content('The commit has been successfully cherry-picked into feature.') + expect(page).to have_content(_('The commit has been successfully cherry-picked into feature.')) end end diff --git a/spec/features/projects/commit/user_reverts_commit_spec.rb b/spec/features/projects/commit/user_reverts_commit_spec.rb index 42844a03ea6..0a99de1990b 100644 --- a/spec/features/projects/commit/user_reverts_commit_spec.rb +++ b/spec/features/projects/commit/user_reverts_commit_spec.rb @@ -27,7 +27,7 @@ describe 'User reverts a commit', :js do end it 'reverts a commit' do - expect(page).to have_content('The commit has been successfully reverted.') + expect(page).to have_content(_('The commit has been successfully reverted.')) end it 'does not revert a previously reverted commit' do @@ -56,7 +56,7 @@ describe 'User reverts a commit', :js do click_button('Revert') end - expect(page).to have_content('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + expect(page).to have_content(_('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.')) expect(page).to have_content("From revert-#{Commit.truncate_sha(sample_commit.id)} into master") end end diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index 574a8aefd63..d8f70bb5cf7 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -127,7 +127,7 @@ describe 'User browses commits' do end context 'when a commit links to a confidential issue' do - let(:confidential_issue) { create(:issue, confidential: true, title: 'Secret issue!', project: project) } + let(:confidential_issue) { create(:issue, confidential: true, title: _('Secret issue!'), project: project) } before do project.repository.create_file(user, 'dummy-file', 'dummy content', diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index 5f7cf68987e..51f3d5265d6 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -98,7 +98,7 @@ describe "Compare", :js do click_button('Compare') page.within('.alert') do - expect(page).to have_text("Too many changes to show. To preserve performance only 3 of 3+ files are displayed.") + expect(page).to have_text(_("Too many changes to show. To preserve performance only 3 of 3+ files are displayed.")) end end end diff --git a/spec/features/projects/diffs/diff_show_spec.rb b/spec/features/projects/diffs/diff_show_spec.rb index df05625d105..99b35945741 100644 --- a/spec/features/projects/diffs/diff_show_spec.rb +++ b/spec/features/projects/diffs/diff_show_spec.rb @@ -46,7 +46,7 @@ describe 'Diff file viewer', :js do end it 'shows an error message' do - expect(page).to have_content('This source diff could not be displayed because it is stored in LFS. You can view the blob instead.') + expect(page).to have_content(_('This source diff could not be displayed because it is stored in LFS. You can view the blob instead.')) end end @@ -161,12 +161,12 @@ describe 'Diff file viewer', :js do end it 'shows the diff is collapsed' do - expect(page).to have_content('This diff is collapsed. Click to expand it.') + expect(page).to have_content(_('This diff is collapsed. Click to expand it.')) end context 'expanding the diff' do before do - click_button 'Click to expand it.' + click_button _('Click to expand it.') wait_for_requests end diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index a8a3b6910fb..3e057cf307f 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -26,7 +26,7 @@ describe 'Environment' do context 'without deployments' do it 'does not show deployments' do - expect(page).to have_content('You don\'t have any deployments right now.') + expect(page).to have_content(_('You don\'t have any deployments right now.')) end end @@ -65,7 +65,7 @@ describe 'Environment' do end it 'does not show deployments' do - expect(page).to have_content('You don\'t have any deployments right now.') + expect(page).to have_content(_('You don\'t have any deployments right now.')) end end @@ -78,7 +78,7 @@ describe 'Environment' do end it 'does not show deployments' do - expect(page).to have_content('You don\'t have any deployments right now.') + expect(page).to have_content(_('You don\'t have any deployments right now.')) end end diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index ab16fdee883..a9f612cbd7c 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -192,7 +192,7 @@ describe 'Edit Project Settings' do visit project_path(project) - expect(page).to have_content "Customize your workflow!" + expect(page).to have_content _("Customize your workflow!") end it "hides project activity tabs" do diff --git a/spec/features/projects/files/editing_a_file_spec.rb b/spec/features/projects/files/editing_a_file_spec.rb index 4074e67e2d2..3285111b46d 100644 --- a/spec/features/projects/files/editing_a_file_spec.rb +++ b/spec/features/projects/files/editing_a_file_spec.rb @@ -26,6 +26,6 @@ describe 'Projects > Files > User wants to edit a file' do click_button 'Commit changes' - expect(page).to have_content 'Someone edited the file the same time you did.' + expect(page).to have_content _('Someone edited the file the same time you did.') end end diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb index 66268355345..c12f835c567 100644 --- a/spec/features/projects/files/user_browses_files_spec.rb +++ b/spec/features/projects/files/user_browses_files_spec.rb @@ -113,7 +113,7 @@ describe "User browses files" do click_link("Users") expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/users.md")) - expect(page).to have_content("Get a list of users.") + expect(page).to have_content(_("Get a list of users.")) page.go_back @@ -161,7 +161,7 @@ describe "User browses files" do click_link("Users") expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/users.md")) - expect(page).to have_content("List users").and have_content("Get a list of users.") + expect(page).to have_content("List users").and have_content(_("Get a list of users.")) end end end @@ -189,7 +189,7 @@ describe "User browses files" do visit(project_tree_path(project, "'test'")) - expect(page).to have_css(".tree-commit-link").and have_no_content("Loading commit data...") + expect(page).to have_css(".tree-commit-link").and have_no_content(_("Loading commit data...")) end it "shows the code with a leading dot in the directory", :js do @@ -201,7 +201,7 @@ describe "User browses files" do visit(project_tree_path(project, "fix/.testdir")) - expect(page).to have_css(".tree-commit-link").and have_no_content("Loading commit data...") + expect(page).to have_css(".tree-commit-link").and have_no_content(_("Loading commit data...")) end it "does not show the permalink link" do diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index a4f94b7a76d..2dd3593b520 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -71,7 +71,7 @@ describe 'Projects > Files > User creates files' do it 'allows Chinese characters in file name' do submit_new_file(file_name: '测试.md') - expect(page).to have_content 'The file has been successfully created.' + expect(page).to have_content _('The file has been successfully created.') end it 'allows Chinese characters in directory name' do @@ -164,7 +164,7 @@ describe 'Projects > Files > User creates files' do end it 'shows a message saying the file will be committed in a fork' do - message = "A new branch will be created in your fork and a new merge request will be started." + message = _("A new branch will be created in your fork and a new merge request will be started.") expect(page).to have_content(message) end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 8230396a4cc..18d788643ab 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -507,7 +507,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do let!(:environment) { create(:environment, name: 'staging', project: project) } it 'shows deployment message' do - expected_text = 'The deployment of this job to staging did not succeed.' + expected_text = _('The deployment of this job to staging did not succeed.') expect(page).to have_css('.environment-information', text: expected_text) end @@ -616,7 +616,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'shows delayed job', :js do expect(page).to have_content('This is a delayed job to run in') - expect(page).to have_content("This job will automatically run after its timer finishes.") + expect(page).to have_content(_("This job will automatically run after its timer finishes.")) expect(page).to have_link('Unschedule job') end @@ -708,7 +708,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do visit project_job_path(project, job) expect(job).not_to have_trace - expect(page).to have_content('This job does not have a trace.') + expect(page).to have_content(_('This job does not have a trace.')) end end @@ -774,7 +774,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'renders message about job being stuck because no runners are active' do expect(page).to have_css('.js-stuck-no-active-runner') - expect(page).to have_content("This job is stuck because you don't have any active runners that can run this job.") + expect(page).to have_content(_("This job is stuck because you don't have any active runners that can run this job.")) end end @@ -803,7 +803,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'renders message about job being stuck because not runners are available' do expect(page).to have_css('.js-stuck-no-active-runner') - expect(page).to have_content("This job is stuck because you don't have any active runners that can run this job.") + expect(page).to have_content(_("This job is stuck because you don't have any active runners that can run this job.")) end end @@ -813,7 +813,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'renders message about job being stuck because runners are offline' do expect(page).to have_css('.js-stuck-no-runners') - expect(page).to have_content("This job is stuck because the project doesn't have any runners online assigned to it.") + expect(page).to have_content(_("This job is stuck because the project doesn't have any runners online assigned to it.")) end end end diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 50ba67f0ffc..27b3e102cca 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -24,7 +24,7 @@ describe 'Projects > Members > User requests access', :js do expect(ActionMailer::Base.deliveries.last.subject).to eq "Request to join the #{project.full_name} project" expect(project.requesters.exists?(user_id: user)).to be_truthy - expect(page).to have_content 'Your request for access has been queued for review.' + expect(page).to have_content _('Your request for access has been queued for review.') expect(page).to have_content 'Withdraw Access Request' expect(page).not_to have_content 'Leave Project' @@ -63,7 +63,7 @@ describe 'Projects > Members > User requests access', :js do accept_confirm { click_link 'Withdraw Access Request' } expect(project.requesters.exists?(user_id: user)).to be_falsey - expect(page).to have_content 'Your access request to the project has been withdrawn.' + expect(page).to have_content _('Your access request to the project has been withdrawn.') end def open_project_settings_menu diff --git a/spec/features/projects/milestones/milestone_spec.rb b/spec/features/projects/milestones/milestone_spec.rb index ff31092b910..67920bf2c26 100644 --- a/spec/features/projects/milestones/milestone_spec.rb +++ b/spec/features/projects/milestones/milestone_spec.rb @@ -60,7 +60,7 @@ describe 'Project milestone' do end it 'does not show an informative message' do - expect(page).not_to have_content('Assign some issues to this milestone.') + expect(page).not_to have_content(_('Assign some issues to this milestone.')) end end diff --git a/spec/features/projects/network_graph_spec.rb b/spec/features/projects/network_graph_spec.rb index 9f9a7787093..3e6166aa528 100644 --- a/spec/features/projects/network_graph_spec.rb +++ b/spec/features/projects/network_graph_spec.rb @@ -94,7 +94,7 @@ describe 'Project Network Graph', :js do find('button').click end - expect(page).to have_selector '.flash-alert', text: "Git revision ';' does not exist." + expect(page).to have_selector '.flash-alert', text: _("Git revision ';' does not exist.") end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index b75dee66592..574aaea1418 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -87,7 +87,7 @@ describe 'Pipelines', :js do it 'updates content when tab is clicked' do page.find('.js-pipelines-tab-pending').click wait_for_requests - expect(page).to have_content('There are currently no pending pipelines.') + expect(page).to have_content(_('There are currently no pending pipelines.')) end end @@ -662,7 +662,7 @@ describe 'Pipelines', :js do it 'increments jobs_cache_index' do click_button 'Clear Runner Caches' wait_for_requests - expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.' + expect(page.find('.flash-notice')).to have_content _('Project cache successfully reset.') end end @@ -670,7 +670,7 @@ describe 'Pipelines', :js do it 'sets jobs_cache_index to 1' do click_button 'Clear Runner Caches' wait_for_requests - expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.' + expect(page.find('.flash-notice')).to have_content _('Project cache successfully reset.') end end end @@ -699,7 +699,7 @@ describe 'Pipelines', :js do let(:project) { create(:project, :public, :repository) } context 'without pipelines' do - it { expect(page).to have_content 'This project is not currently set up to run pipelines.' } + it { expect(page).to have_content _('This project is not currently set up to run pipelines.') } end end diff --git a/spec/features/projects/services/user_activates_asana_spec.rb b/spec/features/projects/services/user_activates_asana_spec.rb index c44e07dd3b4..948c930707c 100644 --- a/spec/features/projects/services/user_activates_asana_spec.rb +++ b/spec/features/projects/services/user_activates_asana_spec.rb @@ -19,6 +19,6 @@ describe 'User activates Asana' do fill_in('Restrict to branch', with: 'verySecret') click_button('Save') - expect(page).to have_content('Asana activated.') + expect(page).to have_content(_('Asana activated.')) end end diff --git a/spec/features/projects/services/user_activates_assembla_spec.rb b/spec/features/projects/services/user_activates_assembla_spec.rb index 9c3884a7c74..23032e0de6d 100644 --- a/spec/features/projects/services/user_activates_assembla_spec.rb +++ b/spec/features/projects/services/user_activates_assembla_spec.rb @@ -18,6 +18,6 @@ describe 'User activates Assembla' do fill_in('Token', with: 'verySecret') click_button('Save') - expect(page).to have_content('Assembla activated.') + expect(page).to have_content(_('Assembla activated.')) end end diff --git a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb index 19573565265..d7b932597ab 100644 --- a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb +++ b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb @@ -21,7 +21,7 @@ describe 'User activates Atlassian Bamboo CI' do fill_in('Password', with: 'verySecret') click_button('Save') - expect(page).to have_content('Atlassian Bamboo CI activated.') + expect(page).to have_content(_('Atlassian Bamboo CI activated.')) # Password field should not be filled in. click_link('Atlassian Bamboo CI') diff --git a/spec/features/projects/services/user_activates_emails_on_push_spec.rb b/spec/features/projects/services/user_activates_emails_on_push_spec.rb index cc55f7b2060..de4cb99bc52 100644 --- a/spec/features/projects/services/user_activates_emails_on_push_spec.rb +++ b/spec/features/projects/services/user_activates_emails_on_push_spec.rb @@ -18,6 +18,6 @@ describe 'User activates Emails on push' do fill_in('Recipients', with: 'qa@company.name') click_button('Save') - expect(page).to have_content('Emails on push activated.') + expect(page).to have_content(_('Emails on push activated.')) end end diff --git a/spec/features/projects/services/user_activates_flowdock_spec.rb b/spec/features/projects/services/user_activates_flowdock_spec.rb index f981b7e9da9..9ad4dbfb4f3 100644 --- a/spec/features/projects/services/user_activates_flowdock_spec.rb +++ b/spec/features/projects/services/user_activates_flowdock_spec.rb @@ -18,6 +18,6 @@ describe 'User activates Flowdock' do fill_in('Token', with: 'verySecret') click_button('Save') - expect(page).to have_content('Flowdock activated.') + expect(page).to have_content(_('Flowdock activated.')) end end diff --git a/spec/features/projects/services/user_activates_hipchat_spec.rb b/spec/features/projects/services/user_activates_hipchat_spec.rb index 2f5313c91f9..c9481316940 100644 --- a/spec/features/projects/services/user_activates_hipchat_spec.rb +++ b/spec/features/projects/services/user_activates_hipchat_spec.rb @@ -20,7 +20,7 @@ describe 'User activates HipChat' do fill_in('Token', with: 'verySecret') click_button('Save') - expect(page).to have_content('HipChat activated.') + expect(page).to have_content(_('HipChat activated.')) end end @@ -32,7 +32,7 @@ describe 'User activates HipChat' do fill_in('Server', with: 'https://chat.example.com') click_button('Save') - expect(page).to have_content('HipChat activated.') + expect(page).to have_content(_('HipChat activated.')) end end end diff --git a/spec/features/projects/services/user_activates_irker_spec.rb b/spec/features/projects/services/user_activates_irker_spec.rb index 4c8e321b411..0dd75deed0c 100644 --- a/spec/features/projects/services/user_activates_irker_spec.rb +++ b/spec/features/projects/services/user_activates_irker_spec.rb @@ -19,6 +19,6 @@ describe 'User activates Irker (IRC gateway)' do fill_in('Recipients', with: 'irc://chat.freenode.net/#commits') click_button('Save') - expect(page).to have_content('Irker (IRC gateway) activated.') + expect(page).to have_content(_('Irker (IRC gateway) activated.')) end end diff --git a/spec/features/projects/services/user_activates_issue_tracker_spec.rb b/spec/features/projects/services/user_activates_issue_tracker_spec.rb index 7cd5b12802b..6fe1c640e58 100644 --- a/spec/features/projects/services/user_activates_issue_tracker_spec.rb +++ b/spec/features/projects/services/user_activates_issue_tracker_spec.rb @@ -54,7 +54,7 @@ describe 'User activates issue tracker', :js do click_button('Test settings and save changes') wait_for_requests - expect(find('.flash-container-page')).to have_content 'Test failed.' + expect(find('.flash-container-page')).to have_content _('Test failed.') expect(find('.flash-container-page')).to have_content 'Save anyway' find('.flash-alert .flash-action').click diff --git a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb index 28d83a8b961..1c40f6f7e0e 100644 --- a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb +++ b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb @@ -21,6 +21,6 @@ describe 'User activates JetBrains TeamCity CI' do fill_in('Password', with: 'verySecret') click_button('Save') - expect(page).to have_content('JetBrains TeamCity CI activated.') + expect(page).to have_content(_('JetBrains TeamCity CI activated.')) end end diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 08e1855d034..8b5a85ccf24 100644 --- a/spec/features/projects/services/user_activates_jira_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -36,7 +36,7 @@ describe 'User activates Jira', :js do end it 'activates the JIRA service' do - expect(page).to have_content('JIRA activated.') + expect(page).to have_content(_('JIRA activated.')) expect(current_path).to eq(project_settings_integrations_path(project)) end @@ -56,7 +56,7 @@ describe 'User activates Jira', :js do click_button('Test settings and save changes') page.within('.service-settings') do - expect(page).to have_content('This field is required.') + expect(page).to have_content(_('This field is required.')) end end @@ -75,7 +75,7 @@ describe 'User activates Jira', :js do find('.flash-alert .flash-action').click wait_for_requests - expect(page).to have_content('JIRA activated.') + expect(page).to have_content(_('JIRA activated.')) expect(current_path).to eq(project_settings_integrations_path(project)) end end @@ -89,7 +89,7 @@ describe 'User activates Jira', :js do end it 'saves but does not activate the JIRA service' do - expect(page).to have_content('JIRA settings saved, but not activated.') + expect(page).to have_content(_('JIRA settings saved, but not activated.')) expect(current_path).to eq(project_settings_integrations_path(project)) end diff --git a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb index 70f3a812ee9..d1d450f2a22 100644 --- a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb @@ -31,7 +31,7 @@ describe 'Set up Mattermost slash commands', :js do click_on 'Save changes' expect(current_path).to eq(project_settings_integrations_path(project)) - expect(page).to have_content('Mattermost slash commands settings saved, but not activated.') + expect(page).to have_content(_('Mattermost slash commands settings saved, but not activated.')) end it 'redirects to the integrations page after activating' do @@ -42,7 +42,7 @@ describe 'Set up Mattermost slash commands', :js do click_on 'Save changes' expect(current_path).to eq(project_settings_integrations_path(project)) - expect(page).to have_content('Mattermost slash commands activated.') + expect(page).to have_content(_('Mattermost slash commands activated.')) end it 'shows the add to mattermost button' do @@ -64,7 +64,7 @@ describe 'Set up Mattermost slash commands', :js do click_link 'Add to Mattermost' expect(page).to have_content('The team where the slash commands will be used in') - expect(page).to have_content('This is the only available team that you are a member of.') + expect(page).to have_content(_('This is the only available team that you are a member of.')) end it 'shows a disabled prefilled select if user is a member of 1 team' do @@ -94,7 +94,7 @@ describe 'Set up Mattermost slash commands', :js do click_link 'Add to Mattermost' expect(page).to have_content('Select the team where the slash commands will be used in') - expect(page).to have_content('The list shows all available teams that you are a member of.') + expect(page).to have_content(_('The list shows all available teams that you are a member of.')) end it 'shows a select with team options user is a member of multiple teams' do diff --git a/spec/features/projects/services/user_activates_packagist_spec.rb b/spec/features/projects/services/user_activates_packagist_spec.rb index 756e9b33c07..11032b24767 100644 --- a/spec/features/projects/services/user_activates_packagist_spec.rb +++ b/spec/features/projects/services/user_activates_packagist_spec.rb @@ -19,6 +19,6 @@ describe 'User activates Packagist' do fill_in('Token', with: 'verySecret') click_button('Save') - expect(page).to have_content('Packagist activated.') + expect(page).to have_content(_('Packagist activated.')) end end diff --git a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb index 1d6b19e0b0c..bf2c95ed60b 100644 --- a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb +++ b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb @@ -18,6 +18,6 @@ describe 'User activates PivotalTracker' do fill_in('Token', with: 'verySecret') click_button('Save') - expect(page).to have_content('PivotalTracker activated.') + expect(page).to have_content(_('PivotalTracker activated.')) end end diff --git a/spec/features/projects/services/user_activates_prometheus_spec.rb b/spec/features/projects/services/user_activates_prometheus_spec.rb index 61361c8a2e3..b7a18613247 100644 --- a/spec/features/projects/services/user_activates_prometheus_spec.rb +++ b/spec/features/projects/services/user_activates_prometheus_spec.rb @@ -18,6 +18,6 @@ describe 'User activates Prometheus' do fill_in('API URL', with: 'http://prometheus.example.com') click_button('Save changes') - expect(page).to have_content('Prometheus activated.') + expect(page).to have_content(_('Prometheus activated.')) end end diff --git a/spec/features/projects/services/user_activates_pushover_spec.rb b/spec/features/projects/services/user_activates_pushover_spec.rb index 24612ee1457..a54f7b43402 100644 --- a/spec/features/projects/services/user_activates_pushover_spec.rb +++ b/spec/features/projects/services/user_activates_pushover_spec.rb @@ -22,6 +22,6 @@ describe 'User activates Pushover' do select('Bike', from: 'Sound') click_button('Save') - expect(page).to have_content('Pushover activated.') + expect(page).to have_content(_('Pushover activated.')) end end diff --git a/spec/features/projects/services/user_activates_slack_notifications_spec.rb b/spec/features/projects/services/user_activates_slack_notifications_spec.rb index 24b5d5259db..af8895ed82a 100644 --- a/spec/features/projects/services/user_activates_slack_notifications_spec.rb +++ b/spec/features/projects/services/user_activates_slack_notifications_spec.rb @@ -22,7 +22,7 @@ describe 'User activates Slack notifications' do fill_in('Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685') click_button('Save') - expect(page).to have_content('Slack notifications activated.') + expect(page).to have_content(_('Slack notifications activated.')) end end diff --git a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb index 08cfddf7993..1ed41298c1a 100644 --- a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb @@ -26,7 +26,7 @@ describe 'Slack slash commands' do click_on 'Save' expect(current_path).to eq(project_settings_integrations_path(project)) - expect(page).to have_content('Slack slash commands settings saved, but not activated.') + expect(page).to have_content(_('Slack slash commands settings saved, but not activated.')) end it 'redirects to the integrations page after activating' do @@ -35,7 +35,7 @@ describe 'Slack slash commands' do click_on 'Save' expect(current_path).to eq(project_settings_integrations_path(project)) - expect(page).to have_content('Slack slash commands activated.') + expect(page).to have_content(_('Slack slash commands activated.')) end it 'shows the correct trigger url' do diff --git a/spec/features/projects/settings/forked_project_settings_spec.rb b/spec/features/projects/settings/forked_project_settings_spec.rb index df33d215602..be3122999f7 100644 --- a/spec/features/projects/settings/forked_project_settings_spec.rb +++ b/spec/features/projects/settings/forked_project_settings_spec.rb @@ -23,7 +23,7 @@ describe 'Projects > Settings > For a forked project', :js do fill_in('confirm_name_input', with: forked_project.name) click_button('Confirm') - expect(page).to have_content('The fork relationship has been removed.') + expect(page).to have_content(_('The fork relationship has been removed.')) expect(forked_project.reload.forked?).to be_falsy end end diff --git a/spec/features/projects/settings/project_badges_spec.rb b/spec/features/projects/settings/project_badges_spec.rb index 42b5547d43b..39637ce8eda 100644 --- a/spec/features/projects/settings/project_badges_spec.rb +++ b/spec/features/projects/settings/project_badges_spec.rb @@ -105,7 +105,7 @@ describe 'Project Badges' do click_delete_button(rows[1]) - expect(find('.modal .modal-title')).to have_content 'Delete badge?' + expect(find('.modal .modal-title')).to have_content _('Delete badge?') end it 'deletes a badge when confirming the modal' do diff --git a/spec/features/projects/settings/user_renames_a_project_spec.rb b/spec/features/projects/settings/user_renames_a_project_spec.rb index 64c9af4b706..746043b2bee 100644 --- a/spec/features/projects/settings/user_renames_a_project_spec.rb +++ b/spec/features/projects/settings/user_renames_a_project_spec.rb @@ -26,7 +26,7 @@ describe 'Projects > Settings > User renames a project' do rename_project(project, name: 'foo&bar', path: 'foo&bar') expect(page).to have_field 'Project name', with: 'foo&bar' expect(page).to have_field 'Path', with: 'foo&bar' - expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'." + expect(page).to have_content _("Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'.") expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'" end end @@ -37,7 +37,7 @@ describe 'Projects > Settings > User renames a project' do click_button 'Save changes' end - expect(page).to have_content "Project 'hello world' was successfully updated." + expect(page).to have_content _("Project 'hello world' was successfully updated.") end context 'when changing project name' do @@ -50,7 +50,7 @@ describe 'Projects > Settings > User renames a project' do it 'shows error for invalid project name' do rename_project(project, name: '🚀 foo bar ☁️') expect(page).to have_field 'Project name', with: '🚀 foo bar ☁️' - expect(page).not_to have_content "Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'." + expect(page).not_to have_content _("Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'.") end end end diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 1fbc108697f..a4af9b23ecc 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -14,7 +14,7 @@ describe 'Projects > Settings > Visibility settings', :js do visibility_select_container = find('.project-visibility-setting') expect(visibility_select_container.find('select').value).to eq project.visibility_level.to_s - expect(visibility_select_container).to have_content 'The project can be accessed by anyone, regardless of authentication.' + expect(visibility_select_container).to have_content _('The project can be accessed by anyone, regardless of authentication.') end it 'project visibility description updates on change' do @@ -23,7 +23,7 @@ describe 'Projects > Settings > Visibility settings', :js do visibility_select.select('Private') expect(visibility_select.value).to eq '0' - expect(visibility_select_container).to have_content 'Access must be granted explicitly to each user.' + expect(visibility_select_container).to have_content _('Access must be granted explicitly to each user.') end context 'merge requests select' do @@ -72,7 +72,7 @@ describe 'Projects > Settings > Visibility settings', :js do visibility_select_container = find('.project-visibility-setting') expect(visibility_select_container).to have_selector 'select[name="project[visibility_level]"]:disabled' - expect(visibility_select_container).to have_content 'The project can be accessed by anyone, regardless of authentication.' + expect(visibility_select_container).to have_content _('The project can be accessed by anyone, regardless of authentication.') end end end diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index 6d8a72dd6a3..1fbc04d55a5 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -10,7 +10,7 @@ describe 'Projects > Snippets > Create Snippet', :js do fill_in 'project_snippet_title', with: 'My Snippet Title' fill_in 'project_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_text-input', visible: false).send_keys('Hello World!') + find('.ace_text-input', visible: false).send_keys(_('Hello World!')) end end @@ -30,7 +30,7 @@ describe 'Projects > Snippets > Create Snippet', :js do wait_for_requests expect(page).to have_content('My Snippet Title') - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) page.within('.snippet-header .description') do expect(page).to have_content('My Snippet Description') expect(page).to have_selector('strong') @@ -63,7 +63,7 @@ describe 'Projects > Snippets > Create Snippet', :js do wait_for_requests expect(page).to have_content('My Snippet Title') - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) page.within('.snippet-header .description') do expect(page).to have_content('My Snippet Description') expect(page).to have_selector('strong') diff --git a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb index d82e350e0f7..9c770b1db4c 100644 --- a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb +++ b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb @@ -14,13 +14,13 @@ describe 'Projects > Snippets > User comments on a snippet', :js do it 'leaves a comment on a snippet' do page.within('.js-main-target-form') do - fill_in('note_note', with: 'Good snippet!') + fill_in('note_note', with: _('Good snippet!')) click_button('Comment') end wait_for_requests - expect(page).to have_content('Good snippet!') + expect(page).to have_content(_('Good snippet!')) end it 'should have autocomplete' do diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index 48a0d675f2d..83b9f894382 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -159,14 +159,14 @@ describe "User creates wiki page" do it "creates a page from the home page" do page.within(".wiki-form") do - fill_in(:wiki_content, with: "My awesome wiki!") + fill_in(:wiki_content, with: _("My awesome wiki!")) click_button("Create page") end expect(page).to have_content("Home") .and have_content("Last edited by #{user.name}") - .and have_content("My awesome wiki!") + .and have_content(_("My awesome wiki!")) end end end @@ -195,14 +195,14 @@ describe "User creates wiki page" do expect(page).to have_field("wiki[message]", with: "Create foo") page.within(".wiki-form") do - fill_in(:wiki_content, with: "My awesome wiki!") + fill_in(:wiki_content, with: _("My awesome wiki!")) click_button("Create page") end expect(page).to have_content("foo") .and have_content("Last edited by #{user.name}") - .and have_content("My awesome wiki!") + .and have_content(_("My awesome wiki!")) end it "creates a page with spaces in the name" do @@ -218,14 +218,14 @@ describe "User creates wiki page" do expect(page).to have_field("wiki[message]", with: "Create Spaces in the name") page.within(".wiki-form") do - fill_in(:wiki_content, with: "My awesome wiki!") + fill_in(:wiki_content, with: _("My awesome wiki!")) click_button("Create page") end expect(page).to have_content("Spaces in the name") .and have_content("Last edited by #{user.name}") - .and have_content("My awesome wiki!") + .and have_content(_("My awesome wiki!")) end it "creates a page with hyphens in the name" do @@ -241,14 +241,14 @@ describe "User creates wiki page" do expect(page).to have_field("wiki[message]", with: "Create hyphens in the name") page.within(".wiki-form") do - fill_in(:wiki_content, with: "My awesome wiki!") + fill_in(:wiki_content, with: _("My awesome wiki!")) click_button("Create page") end expect(page).to have_content("hyphens in the name") .and have_content("Last edited by #{user.name}") - .and have_content("My awesome wiki!") + .and have_content(_("My awesome wiki!")) end end @@ -288,14 +288,14 @@ describe "User creates wiki page" do expect(page).to have_field("wiki[message]", with: "Create foo") page.within(".wiki-form") do - fill_in(:wiki_content, with: "My awesome wiki!") + fill_in(:wiki_content, with: _("My awesome wiki!")) click_button("Create page") end expect(page).to have_content("foo") .and have_content("Last edited by #{user.name}") - .and have_content("My awesome wiki!") + .and have_content(_("My awesome wiki!")) end end end diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index f76e577b0d6..6920f6fd845 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -77,12 +77,12 @@ describe 'User updates wiki page' do # Commit message field should have correct value. expect(page).to have_field('wiki[message]', with: 'Update home') - fill_in(:wiki_content, with: 'My awesome wiki!') + fill_in(:wiki_content, with: _('My awesome wiki!')) click_button('Save changes') expect(page).to have_content('Home') expect(page).to have_content("Last edited by #{user.name}") - expect(page).to have_content('My awesome wiki!') + expect(page).to have_content(_('My awesome wiki!')) end it 'shows a validation error message' do @@ -108,7 +108,7 @@ describe 'User updates wiki page' do click_button('Save changes') - expect(page).to have_content('Someone edited the page the same time you did.') + expect(page).to have_content(_('Someone edited the page the same time you did.')) end it 'updates a page' do @@ -136,13 +136,13 @@ describe 'User updates wiki page' do # Commit message field should have correct value. expect(page).to have_field('wiki[message]', with: 'Update home') - fill_in(:wiki_content, with: 'My awesome wiki!') + fill_in(:wiki_content, with: _('My awesome wiki!')) click_button('Save changes') expect(page).to have_content('Home') expect(page).to have_content("Last edited by #{user.name}") - expect(page).to have_content('My awesome wiki!') + expect(page).to have_content(_('My awesome wiki!')) end it_behaves_like 'wiki file attachments' diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index d4691b669c1..2e49f4b23a8 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -148,7 +148,7 @@ describe 'User views a wiki page' do it 'shows error' do page.within(:css, '.flash-notice') do - expect(page).to have_content('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.') + expect(page).to have_content(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.')) end end end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index eb70a3c41c1..c9d246de536 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -162,7 +162,7 @@ describe 'Project' do remove_with_confirm('Remove fork relationship', project.path) - expect(page).to have_content 'The fork relationship has been removed.' + expect(page).to have_content _('The fork relationship has been removed.') expect(project.reload.forked?).to be_falsey expect(page).not_to have_content 'Remove fork relationship' end diff --git a/spec/features/read_only_spec.rb b/spec/features/read_only_spec.rb index 8bfaf558466..1e6f8c885d3 100644 --- a/spec/features/read_only_spec.rb +++ b/spec/features/read_only_spec.rb @@ -12,7 +12,7 @@ describe 'read-only message' do visit root_dashboard_path - expect(page).to have_content('You are on a read-only GitLab instance.') + expect(page).to have_content(_('You are on a read-only GitLab instance.')) end it 'does not show read-only banner when database is able to read-write' do @@ -20,6 +20,6 @@ describe 'read-only message' do visit root_dashboard_path - expect(page).not_to have_content('You are on a read-only GitLab instance.') + expect(page).not_to have_content(_('You are on a read-only GitLab instance.')) end end diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index 6eae0be4b9f..9d0dd670175 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -210,7 +210,7 @@ describe 'Runners' do it 'group runners are not available' do visit project_runners_path(project) - expect(page).to have_content 'This project does not belong to a group and can therefore not make use of group Runners.' + expect(page).to have_content _('This project does not belong to a group and can therefore not make use of group Runners.') end end @@ -221,10 +221,10 @@ describe 'Runners' do it 'group runners are not available' do visit project_runners_path(project) - expect(page).to have_content 'This group does not provide any group Runners yet.' + expect(page).to have_content _('This group does not provide any group Runners yet.') expect(page).not_to have_content 'Group maintainers can register group runners in the Group CI/CD settings' - expect(page).to have_content 'Ask your group maintainer to set up a group Runner.' + expect(page).to have_content _('Ask your group maintainer to set up a group Runner.') end end diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb index e2b3444272e..0de4957bad0 100644 --- a/spec/features/signed_commits_spec.rb +++ b/spec/features/signed_commits_spec.rb @@ -80,7 +80,7 @@ describe 'GPG signed commits' do click_on 'Unverified' within '.popover' do - expect(page).to have_content 'This commit was signed with an unverified signature.' + expect(page).to have_content _('This commit was signed with an unverified signature.') expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" end end @@ -93,7 +93,7 @@ describe 'GPG signed commits' do click_on 'Unverified' within '.popover' do - expect(page).to have_content 'This commit was signed with a verified signature, but the committer email is not verified to belong to the same user.' + expect(page).to have_content _('This commit was signed with a verified signature, but the committer email is not verified to belong to the same user.') expect(page).to have_content 'Bette Cartwright' expect(page).to have_content '@bette.cartwright' expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" @@ -108,7 +108,7 @@ describe 'GPG signed commits' do click_on 'Unverified' within '.popover' do - expect(page).to have_content "This commit was signed with a different user's verified signature." + expect(page).to have_content _("This commit was signed with a different user's verified signature.") expect(page).to have_content 'Bette Cartwright' expect(page).to have_content '@bette.cartwright' expect(page).to have_content "GPG Key ID: #{GpgHelpers::User2.primary_keyid}" @@ -123,7 +123,7 @@ describe 'GPG signed commits' do click_on 'Verified' within '.popover' do - expect(page).to have_content 'This commit was signed with a verified signature and the committer email is verified to belong to the same user.' + expect(page).to have_content _('This commit was signed with a verified signature and the committer email is verified to belong to the same user.') expect(page).to have_content 'Nannie Bernhard' expect(page).to have_content '@nannie.bernhard' expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" @@ -145,7 +145,7 @@ describe 'GPG signed commits' do click_on 'Verified' within '.popover' do - expect(page).to have_content 'This commit was signed with a verified signature and the committer email is verified to belong to the same user.' + expect(page).to have_content _('This commit was signed with a verified signature and the committer email is verified to belong to the same user.') expect(page).to have_content 'Nannie Bernhard' expect(page).to have_content 'nannie.bernhard@example.com' expect(page).to have_content "GPG Key ID: #{GpgHelpers::User1.primary_keyid}" diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index eeacaf5f72a..308c605b0b1 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -67,20 +67,20 @@ describe 'Comments on personal snippets', :js do end it 'previews a note' do - fill_in 'note[note]', with: 'This is **awesome**!' + fill_in 'note[note]', with: _('This is **awesome**!') find('.js-md-preview-button').click page.within('.new-note .md-preview') do - expect(page).to have_content('This is awesome!') + expect(page).to have_content(_('This is awesome!')) expect(page).to have_selector('strong') end end it 'creates a note' do - fill_in 'note[note]', with: 'This is **awesome**!' + fill_in 'note[note]', with: _('This is **awesome**!') click_button 'Comment' - expect(find('div#notes')).to have_content('This is awesome!') + expect(find('div#notes')).to have_content(_('This is awesome!')) end it 'should not have autocomplete' do diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 879c46d7c4e..c2157b54e43 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -14,7 +14,7 @@ describe 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' fill_in 'personal_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_text-input', visible: false).send_keys 'Hello World!' + find('.ace_text-input', visible: false).send_keys _('Hello World!') end end @@ -29,7 +29,7 @@ describe 'User creates snippet', :js do expect(page).to have_content('My Snippet Description') expect(page).to have_selector('strong') end - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) end it 'previews a snippet with file' do @@ -82,7 +82,7 @@ describe 'User creates snippet', :js do expect(page).to have_content('My Snippet Description') expect(page).to have_selector('strong') end - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] expect(link).to match(%r{/uploads/-/system/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) @@ -94,7 +94,7 @@ describe 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' page.within('.file-editor') do find(:xpath, "//input[@id='personal_snippet_file_name']").set 'snippet+file+name' - find('.ace_text-input', visible: false).send_keys 'Hello World!' + find('.ace_text-input', visible: false).send_keys _('Hello World!') end click_button 'Create snippet' @@ -102,6 +102,6 @@ describe 'User creates snippet', :js do expect(page).to have_content('My Snippet Title') expect(page).to have_content('snippet+file+name') - expect(page).to have_content('Hello World!') + expect(page).to have_content(_('Hello World!')) end end diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb index 36cfeb5ed84..af5d7d25ff3 100644 --- a/spec/features/tags/master_views_tags_spec.rb +++ b/spec/features/tags/master_views_tags_spec.rb @@ -20,7 +20,7 @@ describe 'Maintainer views tags' do end it 'displays a specific message' do - expect(page).to have_content 'Repository has no tags yet.' + expect(page).to have_content _('Repository has no tags yet.') end end @@ -50,7 +50,7 @@ describe 'Maintainer views tags' do expect(current_path).to eq( project_tag_path(project, 'v1.0.0')) expect(page).to have_content 'v1.0.0' - expect(page).to have_content 'This tag has no release notes.' + expect(page).to have_content _('This tag has no release notes.') end describe 'links on the tag page' do diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 919859c145a..18f0541e169 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -31,7 +31,7 @@ describe 'Triggers', :js do click_button 'Add trigger' # See if "trigger creation successful" message displayed and description and owner are correct - expect(page.find('.flash-notice')).to have_content 'Trigger was created successfully.' + expect(page.find('.flash-notice')).to have_content _('Trigger was created successfully.') expect(page.find('.triggers-list')).to have_content 'trigger desc' expect(page.find('.triggers-list .trigger-owner')).to have_content user.name end @@ -59,7 +59,7 @@ describe 'Triggers', :js do click_button 'Save trigger' # See if "trigger updated successfully" message displayed and description and owner are correct - expect(page.find('.flash-notice')).to have_content 'Trigger was successfully updated.' + expect(page.find('.flash-notice')).to have_content _('Trigger was successfully updated.') expect(page.find('.triggers-list')).to have_content new_trigger_title expect(page.find('.triggers-list .trigger-owner')).to have_content user.name end @@ -76,7 +76,7 @@ describe 'Triggers', :js do # See if trigger can be updated with description and saved successfully fill_in 'trigger_description', with: new_trigger_title click_button 'Save trigger' - expect(page.find('.flash-notice')).to have_content 'Trigger was successfully updated.' + expect(page.find('.flash-notice')).to have_content _('Trigger was successfully updated.') expect(page.find('.triggers-list')).to have_content new_trigger_title end end @@ -88,7 +88,7 @@ describe 'Triggers', :js do end it 'button "Take ownership" has correct alert' do - expected_alert = 'By taking ownership you will bind this trigger to your user account. With this the trigger will have access to all your projects as if it was you. Are you sure?' + expected_alert = _('By taking ownership you will bind this trigger to your user account. With this the trigger will have access to all your projects as if it was you. Are you sure?') expect(page.find('a.btn-trigger-take-ownership')['data-confirm']).to eq expected_alert end @@ -98,7 +98,7 @@ describe 'Triggers', :js do first(:link, "Take ownership").send_keys(:return) end - expect(page.find('.flash-notice')).to have_content 'Trigger was re-assigned.' + expect(page.find('.flash-notice')).to have_content _('Trigger was re-assigned.') expect(page.find('.triggers-list')).to have_content trigger_title expect(page.find('.triggers-list .trigger-owner')).to have_content user.name end @@ -111,7 +111,7 @@ describe 'Triggers', :js do end it 'button "Revoke" has correct alert' do - expected_alert = 'By revoking a trigger you will break any processes making use of it. Are you sure?' + expected_alert = _('By revoking a trigger you will break any processes making use of it. Are you sure?') expect(page.find('a.btn-trigger-revoke')['data-confirm']).to eq expected_alert end diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index ae9b65d1a39..8628e9ea2fb 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -226,12 +226,12 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do user = gitlab_sign_in(:user) user.update_attribute(:otp_required_for_login, true) visit profile_two_factor_auth_path - expect(page).to have_content("Your U2F device needs to be set up.") + expect(page).to have_content(_("Your U2F device needs to be set up.")) first_device = register_u2f_device # Register second device visit profile_two_factor_auth_path - expect(page).to have_content("Your U2F device needs to be set up.") + expect(page).to have_content(_("Your U2F device needs to be set up.")) second_device = register_u2f_device(name: 'My other device') gitlab_sign_out @@ -255,7 +255,7 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do user.update_attribute(:otp_required_for_login, true) visit profile_account_path manage_two_factor_authentication - expect(page).to have_content("Your U2F device needs to be set up.") + expect(page).to have_content(_("Your U2F device needs to be set up.")) register_u2f_device end diff --git a/spec/features/unsubscribe_links_spec.rb b/spec/features/unsubscribe_links_spec.rb index 392d8e3e1c1..61cabe6cda1 100644 --- a/spec/features/unsubscribe_links_spec.rb +++ b/spec/features/unsubscribe_links_spec.rb @@ -6,7 +6,7 @@ describe 'Unsubscribe links' do let(:recipient) { create(:user) } let(:author) { create(:user) } let(:project) { create(:project, :public) } - let(:params) { { title: 'A bug!', description: 'Fix it!', assignees: [recipient] } } + let(:params) { { title: _('A bug!'), description: _('Fix it!'), assignees: [recipient] } } let(:issue) { Issues::CreateService.new(project, author, params).execute } let(:mail) { ActionMailer::Base.deliveries.last } diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb index 24a00c86b0a..d0ad435297e 100644 --- a/spec/features/uploads/user_uploads_file_to_note_spec.rb +++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb @@ -53,7 +53,7 @@ describe 'User uploads file to note' do it 'shows error message, "retry" and "attach a new file" link a if file is too big', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4')], 0.01) - error_text = 'File is too big (0.06MiB). Max filesize: 0.01MiB.' + error_text = _('File is too big (0.06MiB). Max filesize: 0.01MiB.') expect(page).to have_selector('.uploading-error-message', visible: true, text: error_text) expect(page).to have_selector('.retry-uploading-link', visible: true, text: 'Try again') diff --git a/spec/features/usage_stats_consent_spec.rb b/spec/features/usage_stats_consent_spec.rb index dd8f3179895..14322465983 100644 --- a/spec/features/usage_stats_consent_spec.rb +++ b/spec/features/usage_stats_consent_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' describe 'Usage stats consent' do context 'when signed in' do let(:user) { create(:admin, created_at: 8.days.ago) } - let(:message) { 'To help improve GitLab, we would like to periodically collect usage information.' } + let(:message) { _('To help improve GitLab, we would like to periodically collect usage information.') } before do allow(user).to receive(:has_current_license?).and_return false diff --git a/spec/features/users/add_email_to_existing_account.rb b/spec/features/users/add_email_to_existing_account.rb index 4355f769429..a2cbb4c4803 100644 --- a/spec/features/users/add_email_to_existing_account.rb +++ b/spec/features/users/add_email_to_existing_account.rb @@ -9,7 +9,7 @@ describe 'AdditionalEmailToExistingAccount' do email = create(:email, user: user) visit email_confirmation_path(confirmation_token: email.confirmation_token) - expect(page).to have_content 'Your email address has been successfully confirmed.' + expect(page).to have_content _('Your email address has been successfully confirmed.') end end end diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index ad856bd062e..d51e579480c 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -45,7 +45,7 @@ describe 'Login' do visit root_path expect(current_path).to eq edit_user_password_path - expect(page).to have_content('Please create a password for your new account.') + expect(page).to have_content(_('Please create a password for your new account.')) fill_in 'user_password', with: 'password' fill_in 'user_password_confirmation', with: 'password' @@ -63,7 +63,7 @@ describe 'Login' do it 'does not show flash messages when login page' do visit root_path - expect(page).not_to have_content('You need to sign in or sign up before continuing.') + expect(page).not_to have_content(_('You need to sign in or sign up before continuing.')) end end @@ -78,7 +78,7 @@ describe 'Login' do gitlab_sign_in(user) - expect(page).to have_content('Your account has been blocked.') + expect(page).to have_content(_('Your account has been blocked.')) end it 'does not update Devise trackable attributes', :clean_gitlab_redis_shared_state do @@ -101,7 +101,7 @@ describe 'Login' do gitlab_sign_in(User.ghost) - expect(page).to have_content('Invalid Login or password.') + expect(page).to have_content(_('Invalid Login or password.')) end it 'does not update Devise trackable attributes', :clean_gitlab_redis_shared_state do @@ -137,7 +137,7 @@ describe 'Login' do enter_code(user.current_otp) - expect(page).not_to have_content('You are already signed in.') + expect(page).not_to have_content(_('You are already signed in.')) end context 'using one-time code' do @@ -244,7 +244,7 @@ describe 'Login' do expect(user.reload.otp_backup_codes.size).to eq 9 enter_code(code) - expect(page).to have_content('Invalid two-factor code.') + expect(page).to have_content(_('Invalid two-factor code.')) end end end @@ -317,7 +317,7 @@ describe 'Login' do gitlab_sign_in(user) expect(current_path).to eq root_path - expect(page).not_to have_content('You are already signed in.') + expect(page).not_to have_content(_('You are already signed in.')) end end @@ -331,7 +331,7 @@ describe 'Login' do gitlab_sign_in(user) - expect(page).to have_content('Invalid Login or password.') + expect(page).to have_content(_('Invalid Login or password.')) end end end @@ -384,7 +384,7 @@ describe 'Login' do expect(current_path).to eq profile_two_factor_auth_path expect(page).to have_content( - '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 @@ -413,7 +413,7 @@ describe 'Login' do expect(current_path).to eq profile_two_factor_auth_path expect(page).to have_content( - '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 end @@ -572,7 +572,7 @@ describe 'Login' do click_button 'Accept terms' expect(current_path).to eq(root_path) - expect(page).not_to have_content('You are already signed in.') + expect(page).not_to have_content(_('You are already signed in.')) end it 'does not ask for terms when the user already accepted them' do diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 86379164cf0..fed57666c0d 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -56,11 +56,11 @@ describe 'User page' do end it 'shows the status if there was one' do - create(:user_status, user: user, message: "Working hard!") + create(:user_status, user: user, message: _("Working hard!")) visit(user_path(user)) - expect(page).to have_content("Working hard!") + expect(page).to have_content(_("Working hard!")) end context 'signup disabled' do diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index bfe11ddf673..92a2693e171 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -47,7 +47,7 @@ describe 'Signup' do click_button "Register" - expect(page).to have_content("Please create a username with only alphanumeric characters.") + expect(page).to have_content(_("Please create a username with only alphanumeric characters.")) end end diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb index 5b2e7605c4d..876a6a2e1ec 100644 --- a/spec/features/users/terms_spec.rb +++ b/spec/features/users/terms_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Users > Terms' do include TermsHelper - let!(:term) { create(:term, terms: 'By accepting, you promise to be nice!') } + let!(:term) { create(:term, terms: _('By accepting, you promise to be nice!')) } before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') @@ -12,7 +12,7 @@ describe 'Users > Terms' do it 'shows the terms' do visit terms_path - expect(page).to have_content('By accepting, you promise to be nice!') + expect(page).to have_content(_('By accepting, you promise to be nice!')) end it 'does not show buttons to accept, decline or sign out', :aggregate_failures do diff --git a/spec/helpers/auto_devops_helper_spec.rb b/spec/helpers/auto_devops_helper_spec.rb index 75c30dbfe48..90ed0eaaa81 100644 --- a/spec/helpers/auto_devops_helper_spec.rb +++ b/spec/helpers/auto_devops_helper_spec.rb @@ -122,7 +122,7 @@ describe AutoDevopsHelper do allow(helper).to receive(:missing_auto_devops_domain?).and_return(true) end - it { is_expected.to eq('Auto Review Apps and Auto Deploy need a domain name to work correctly.') } + it { is_expected.to eq(_('Auto Review Apps and Auto Deploy need a domain name to work correctly.')) } end end end diff --git a/spec/helpers/button_helper_spec.rb b/spec/helpers/button_helper_spec.rb index eebae1d7290..a2c2fba676c 100644 --- a/spec/helpers/button_helper_spec.rb +++ b/spec/helpers/button_helper_spec.rb @@ -29,7 +29,7 @@ describe ButtonHelper do it 'shows the password text on the dropdown' do description = element.search('.dropdown-menu-inner-content').first - expect(description.inner_text).to eq 'Set a password on your account to pull or push via HTTP.' + expect(description.inner_text).to eq _('Set a password on your account to pull or push via HTTP.') end end end @@ -43,7 +43,7 @@ describe ButtonHelper do it 'has a personal access token text on the dropdown description' do description = element.search('.dropdown-menu-inner-content').first - expect(description.inner_text).to eq 'Create a personal access token on your account to pull or push via HTTP.' + expect(description.inner_text).to eq _('Create a personal access token on your account to pull or push via HTTP.') end end @@ -177,13 +177,13 @@ describe ButtonHelper do context 'when `text` attribute is provided' do it 'shows copy to clipboard button with provided `text` to copy' do - expect(element(text: 'Hello World!').attr('data-clipboard-text')).to eq('Hello World!') + expect(element(text: _('Hello World!')).attr('data-clipboard-text')).to eq(_('Hello World!')) end end context 'when `title` attribute is provided' do it 'shows copy to clipboard button with provided `title` as tooltip' do - expect(element(title: 'Copy to my clipboard!').attr('aria-label')).to eq('Copy to my clipboard!') + expect(element(title: _('Copy to my clipboard!')).attr('aria-label')).to eq(_('Copy to my clipboard!')) end end end diff --git a/spec/helpers/markup_helper_spec.rb b/spec/helpers/markup_helper_spec.rb index a0c0af94fa5..18efb5225b4 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -298,7 +298,7 @@ describe MarkupHelper do it 'truncates the text with multiple paragraphs' do object = create_object("Paragraph 1\n\nParagraph 2") - expected = 'Paragraph 1...' + expected = _('Paragraph 1...') expect(first_line_in_markdown(object, attribute, 100, project: project)).to match(expected) end diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index e565ac8c530..158c4d624f6 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -57,29 +57,29 @@ describe VisibilityLevelHelper do describe "#project_visibility_level_description" do it "describes private projects" do expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)) - .to eq "Project access must be granted explicitly to each user." + .to eq _("Project access must be granted explicitly to each user.") end it "describes public projects" do expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC)) - .to eq "The project can be accessed without any authentication." + .to eq _("The project can be accessed without any authentication.") end end describe "#snippet_visibility_level_description" do it 'describes visibility only for me' do expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet)) - .to eq "The snippet is visible only to me." + .to eq _("The snippet is visible only to me.") end it 'describes visibility for project members' do expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet)) - .to eq "The snippet is visible only to project members." + .to eq _("The snippet is visible only to project members.") end it 'defaults to personal snippet' do expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)) - .to eq "The snippet is visible only to me." + .to eq _("The snippet is visible only to me.") end end diff --git a/spec/initializers/fog_google_https_private_urls_spec.rb b/spec/initializers/fog_google_https_private_urls_spec.rb index 08346b71fee..d6b794a7610 100644 --- a/spec/initializers/fog_google_https_private_urls_spec.rb +++ b/spec/initializers/fog_google_https_private_urls_spec.rb @@ -13,7 +13,7 @@ describe 'Fog::Storage::GoogleXML::File', :fog_requests do let(:file) do directory = storage.directories.create(key: 'data') directory.files.create( - body: 'Hello World!', + body: _('Hello World!'), key: 'hello_world.txt' ) end diff --git a/spec/lib/banzai/filter/emoji_filter_spec.rb b/spec/lib/banzai/filter/emoji_filter_spec.rb index 85a4619e33d..856a0005a85 100644 --- a/spec/lib/banzai/filter/emoji_filter_spec.rb +++ b/spec/lib/banzai/filter/emoji_filter_spec.rb @@ -91,13 +91,13 @@ describe Banzai::Filter::EmojiFilter do end it 'keeps whitespace intact' do - doc = filter('This deserves a :+1:, big time.') + doc = filter(_('This deserves a :+1:, big time.')) expect(doc.to_html).to match(/^This deserves a <gl-emoji.+>, big time\.\z/) end it 'unicode keeps whitespace intact' do - doc = filter('This deserves a 🎱, big time.') + doc = filter(_('This deserves a 🎱, big time.')) expect(doc.to_html).to match(/^This deserves a <gl-emoji.+>, big time\.\z/) end diff --git a/spec/lib/banzai/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index 9cfdb9e53a2..36785bf7a67 100644 --- a/spec/lib/banzai/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -220,7 +220,7 @@ describe Banzai::Filter::LabelReferenceFilter do expect(doc.css('a').first.attr('href')).to eq urls .project_issues_url(project, label_name: label.name) - expect(doc.text).to eq 'See g.fm & references?' + expect(doc.text).to eq _('See g.fm & references?') end it 'links with adjacent text' do diff --git a/spec/lib/gitlab/auth/ldap/adapter_spec.rb b/spec/lib/gitlab/auth/ldap/adapter_spec.rb index 3eeaf3862f6..18d43bb563d 100644 --- a/spec/lib/gitlab/auth/ldap/adapter_spec.rb +++ b/spec/lib/gitlab/auth/ldap/adapter_spec.rb @@ -125,7 +125,7 @@ describe Gitlab::Auth::LDAP::Adapter do context "when the search raises an LDAP exception" do before do allow(adapter).to receive(:renew_connection_adapter).and_return(ldap) - allow(ldap).to receive(:search) { raise Net::LDAP::Error, "some error" } + allow(ldap).to receive(:search) { raise Net::LDAP::Error, _("some error") } allow(Rails.logger).to receive(:warn) end diff --git a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb index 70423823b89..a073dab49c3 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb @@ -199,7 +199,7 @@ describe Gitlab::BitbucketServerImport::Importer do file_path: '.gitmodules', old_pos: 8, new_pos: 9, - note: 'This is a note with an invalid line position.', + note: _('This is a note with an invalid line position.'), author_email: project.owner.email, author_username: 'Owner', comments: [reply], diff --git a/spec/lib/gitlab/checks/branch_check_spec.rb b/spec/lib/gitlab/checks/branch_check_spec.rb index 77366e91dca..65b1094f47c 100644 --- a/spec/lib/gitlab/checks/branch_check_spec.rb +++ b/spec/lib/gitlab/checks/branch_check_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::Checks::BranchCheck do let(:ref) { 'refs/heads/master' } it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'The default branch of a project cannot be deleted.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('The default branch of a project cannot be deleted.')) end end @@ -28,7 +28,7 @@ describe Gitlab::Checks::BranchCheck do it 'raises an error if the user is not allowed to do forced pushes to protected branches' do expect(Gitlab::Checks::ForcePush).to receive(:force_push?).and_return(true) - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to force push code to a protected branch on this project.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to force push code to a protected branch on this project.')) end it 'raises an error if the user is not allowed to merge to protected branches' do @@ -36,13 +36,13 @@ describe Gitlab::Checks::BranchCheck do expect(user_access).to receive(:can_merge_to_branch?).and_return(false) expect(user_access).to receive(:can_push_to_branch?).and_return(false) - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to merge code into protected branches on this project.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to merge code into protected branches on this project.')) end it 'raises an error if the user is not allowed to push to protected branches' do expect(user_access).to receive(:can_push_to_branch?).and_return(false) - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to push code to protected branches on this project.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to push code to protected branches on this project.')) end context 'when project repository is empty' do @@ -61,7 +61,7 @@ describe Gitlab::Checks::BranchCheck do context 'if the user is not allowed to delete protected branches' do it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to delete protected branches from this project. Only a project maintainer or owner can delete a protected branch.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to delete protected branches from this project. Only a project maintainer or owner can delete a protected branch.')) end end @@ -80,7 +80,7 @@ describe Gitlab::Checks::BranchCheck do context 'over SSH or HTTP' do it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You can only delete protected branches using the web interface.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You can only delete protected branches using the web interface.')) end end end diff --git a/spec/lib/gitlab/checks/push_check_spec.rb b/spec/lib/gitlab/checks/push_check_spec.rb index e1bd52d6c0b..b8f0daa43c1 100644 --- a/spec/lib/gitlab/checks/push_check_spec.rb +++ b/spec/lib/gitlab/checks/push_check_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::Checks::PushCheck do expect(user_access).to receive(:can_do_action?).with(:push_code).and_return(false) expect(project).to receive(:branch_allows_collaboration?).with(user_access.user, 'master').and_return(false) - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to push code to this project.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to push code to this project.')) end end end diff --git a/spec/lib/gitlab/checks/tag_check_spec.rb b/spec/lib/gitlab/checks/tag_check_spec.rb index b1258270611..52d3bc8544e 100644 --- a/spec/lib/gitlab/checks/tag_check_spec.rb +++ b/spec/lib/gitlab/checks/tag_check_spec.rb @@ -12,7 +12,7 @@ describe Gitlab::Checks::TagCheck do allow(user_access).to receive(:can_do_action?).with(:push_code).and_return(true) expect(user_access).to receive(:can_do_action?).with(:admin_project).and_return(false) - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to change existing tags on this project.') + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to change existing tags on this project.')) end context 'with protected tag' do diff --git a/spec/lib/gitlab/checks/timed_logger_spec.rb b/spec/lib/gitlab/checks/timed_logger_spec.rb index 0ed3940c038..8ff2f36cabb 100644 --- a/spec/lib/gitlab/checks/timed_logger_spec.rb +++ b/spec/lib/gitlab/checks/timed_logger_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::Checks::TimedLogger do let!(:logger) { described_class.new(start_time: start, timeout: timeout) } let!(:log_messages) do { - foo: "Foo message..." + foo: _("Foo message...") } end diff --git a/spec/lib/gitlab/ci/config/entry/global_spec.rb b/spec/lib/gitlab/ci/config/entry/global_spec.rb index 7651f594a4c..c2a46f9f713 100644 --- a/spec/lib/gitlab/ci/config/entry/global_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/global_spec.rb @@ -54,9 +54,9 @@ describe Gitlab::Ci::Config::Entry::Global do it 'sets correct description for nodes' do expect(global.descendants.first.description) - .to eq 'Script that will be executed before each job.' + .to eq _('Script that will be executed before each job.') expect(global.descendants.second.description) - .to eq 'Docker image that will be used to execute jobs.' + .to eq _('Docker image that will be used to execute jobs.') end describe '#leaf?' do diff --git a/spec/lib/gitlab/ci/config/extendable/entry_spec.rb b/spec/lib/gitlab/ci/config/extendable/entry_spec.rb index 0a148375d11..4a66622d15f 100644 --- a/spec/lib/gitlab/ci/config/extendable/entry_spec.rb +++ b/spec/lib/gitlab/ci/config/extendable/entry_spec.rb @@ -5,7 +5,7 @@ describe Gitlab::Ci::Config::Extendable::Entry do context 'when entry key is not included in the context hash' do it 'raises error' do expect { described_class.new(:test, something: 'something') } - .to raise_error StandardError, 'Invalid entry key!' + .to raise_error StandardError, _('Invalid entry key!') end end end diff --git a/spec/lib/gitlab/ci/config/external/file/project_spec.rb b/spec/lib/gitlab/ci/config/external/file/project_spec.rb index 11809adcaf6..9cfc196fae2 100644 --- a/spec/lib/gitlab/ci/config/external/file/project_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/project_spec.rb @@ -136,7 +136,7 @@ describe Gitlab::Ci::Config::External::File::Project do it 'should return false' do expect(subject).not_to be_valid - expect(subject.error_message).to include('Included file `/invalid-file` does not have YAML extension!') + expect(subject.error_message).to include(_('Included file `/invalid-file` does not have YAML extension!')) end end end diff --git a/spec/lib/gitlab/ci/config/external/file/template_spec.rb b/spec/lib/gitlab/ci/config/external/file/template_spec.rb index 1fb5655309a..8583f676b46 100644 --- a/spec/lib/gitlab/ci/config/external/file/template_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/template_spec.rb @@ -49,7 +49,7 @@ describe Gitlab::Ci::Config::External::File::Template do it 'should return false' do expect(subject).not_to be_valid - expect(subject.error_message).to include('Template file `Template.yml` is not a valid location!') + expect(subject.error_message).to include(_('Template file `Template.yml` is not a valid location!')) end end @@ -58,7 +58,7 @@ describe Gitlab::Ci::Config::External::File::Template do it 'should return false' do expect(subject).not_to be_valid - expect(subject.error_message).to include('Included file `I-Do-Not-Have-This-Template.gitlab-ci.yml` is empty or does not exist!') + expect(subject.error_message).to include(_('Included file `I-Do-Not-Have-This-Template.gitlab-ci.yml` is empty or does not exist!')) end end end diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index 1ac58139b25..343314390e9 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::External::Processor do it 'should raise an error' do expect { processor.perform }.to raise_error( described_class::IncludeError, - "Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!" + _("Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!") ) end end @@ -165,7 +165,7 @@ describe Gitlab::Ci::Config::External::Processor do it 'should raise an error' do expect { processor.perform }.to raise_error( described_class::IncludeError, - "Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!" + _("Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!") ) end end diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index cd6d2a2f343..405e3625a17 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -202,7 +202,7 @@ describe Gitlab::Ci::Config do it 'raises error YamlProcessor validationError' do expect { config }.to raise_error( described_class::ConfigError, - "Included file `invalid` does not have YAML extension!" + _("Included file `invalid` does not have YAML extension!") ) end end @@ -219,7 +219,7 @@ describe Gitlab::Ci::Config do it 'raises error YamlProcessor validationError' do expect { config }.to raise_error( described_class::ConfigError, - 'Include `{"remote":"http://url","local":"/local/file.yml"}` needs to match exactly one accessor!' + _('Include `{"remote":"http://url","local":"/local/file.yml"}` needs to match exactly one accessor!') ) end end diff --git a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb index 3459939267a..3ada64ef11a 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb @@ -71,7 +71,7 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do it 'appends an error about missing stages' do expect(pipeline.errors.to_a) - .to include 'No stages / jobs for this pipeline.' + .to include _('No stages / jobs for this pipeline.') end it 'wastes pipeline iid' do @@ -119,7 +119,7 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do it 'appends validation error' do expect(pipeline.errors.to_a) - .to include 'Failed to build the pipeline!' + .to include _('Failed to build the pipeline!') end it 'wastes pipeline iid' do diff --git a/spec/lib/gitlab/cleanup/project_uploads_spec.rb b/spec/lib/gitlab/cleanup/project_uploads_spec.rb index bf130b8fabd..cb7d6cbb27d 100644 --- a/spec/lib/gitlab/cleanup/project_uploads_spec.rb +++ b/spec/lib/gitlab/cleanup/project_uploads_spec.rb @@ -24,7 +24,7 @@ describe Gitlab::Cleanup::ProjectUploads do end it 'logs action as done' do - expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up...") + expect(logger).to receive(:info).with(_("Looking for orphaned project uploads to clean up...")) expect(logger).to receive(:info).with("Did #{action}") subject.run!(*args) @@ -40,7 +40,7 @@ describe Gitlab::Cleanup::ProjectUploads do end it 'logs action as able to be done' do - expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up. Dry run...") + expect(logger).to receive(:info).with(_("Looking for orphaned project uploads to clean up. Dry run...")) expect(logger).to receive(:info).with("Can #{action}") subject.run!(*args) diff --git a/spec/lib/gitlab/config/entry/attributable_spec.rb b/spec/lib/gitlab/config/entry/attributable_spec.rb index abb4fff3ad7..e27cc8420d7 100644 --- a/spec/lib/gitlab/config/entry/attributable_spec.rb +++ b/spec/lib/gitlab/config/entry/attributable_spec.rb @@ -54,7 +54,7 @@ describe Gitlab::Config::Entry::Attributable do end end - expectation.to raise_error(ArgumentError, 'Method already defined!') + expectation.to raise_error(ArgumentError, _('Method already defined!')) end end end diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb index 248cca25a2c..5f736ab76c8 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb @@ -262,7 +262,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :delete subject.track_rename('project', 'old_path', 'new_path') subject.reverts_for_type('project') do - raise 'whatever happens, keep going!' + raise _('whatever happens, keep going!') end key = 'rename:FakeRenameReservedPathMigrationV1:project' diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb index b1f48c15c21..972731281aa 100644 --- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb @@ -129,7 +129,7 @@ describe Gitlab::Email::Handler::CreateNoteHandler do expect(new_note.author).to eq(sent_notification.recipient) expect(new_note.position).to eq(note.position) - expect(new_note.note).to include("I could not disagree more.") + expect(new_note.note).to include(_("I could not disagree more.")) expect(new_note.in_reply_to?(note)).to be_truthy end @@ -153,7 +153,7 @@ describe Gitlab::Email::Handler::CreateNoteHandler do expect(new_note.author).to eq(sent_notification.recipient) expect(new_note.position).to eq(note.position) - expect(new_note.note).to include('I could not disagree more.') + expect(new_note.note).to include(_('I could not disagree more.')) end end diff --git a/spec/lib/gitlab/email/reply_parser_spec.rb b/spec/lib/gitlab/email/reply_parser_spec.rb index 376d3accd55..2264006a452 100644 --- a/spec/lib/gitlab/email/reply_parser_spec.rb +++ b/spec/lib/gitlab/email/reply_parser_spec.rb @@ -38,7 +38,7 @@ describe Gitlab::Email::ReplyParser do end it "supports a Dutch reply" do - expect(test_parse_body(fixture_file("emails/dutch.eml"))).to eq("Dit is een antwoord in het Nederlands.") + expect(test_parse_body(fixture_file("emails/dutch.eml"))).to eq(_("Dit is een antwoord in het Nederlands.")) end it "removes an 'on date wrote' quoting line" do diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index 429816efec3..4f2642fffb6 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -106,8 +106,8 @@ describe Gitlab::EncodingHelper do ], [ "encodes valid ISO-8859-1 encoded string to utf8", - "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("ISO-8859-1", "UTF-8"), - "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("UTF-8") + _("Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.").encode("ISO-8859-1", "UTF-8"), + _("Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.").encode("UTF-8") ], [ # Test case from https://gitlab.com/gitlab-org/gitlab-ce/issues/39227 diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index a19e3e84f83..d814009c4ba 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1835,7 +1835,7 @@ describe Gitlab::Git::Repository, :seed_helper do it 'cleans up the files' do create_worktree = %W[git -C #{repository_path} worktree add --detach #{worktree_path} master] - raise 'preparation failed' unless system(*create_worktree, err: '/dev/null') + raise _('preparation failed') unless system(*create_worktree, err: '/dev/null') FileUtils.touch(worktree_path, mtime: Time.now - 8.hours) # git rev-list --all will fail in git 2.16 if HEAD is pointing to a non-existent object, diff --git a/spec/lib/gitlab/git/wraps_gitaly_errors_spec.rb b/spec/lib/gitlab/git/wraps_gitaly_errors_spec.rb index bcf4814edb6..6846a78ec8d 100644 --- a/spec/lib/gitlab/git/wraps_gitaly_errors_spec.rb +++ b/spec/lib/gitlab/git/wraps_gitaly_errors_spec.rb @@ -21,7 +21,7 @@ describe Gitlab::Git::WrapsGitalyErrors do end it 'does not swallow other errors' do - expect { wrapper.wrapped_gitaly_errors { raise 'raised' } } + expect { wrapper.wrapped_gitaly_errors { raise _('raised') } } .to raise_error(RuntimeError) end end diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 3e34dd592f2..0f9dd469e0f 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -257,8 +257,8 @@ describe Gitlab::GitAccess do it 'does not allow keys which are too small', :aggregate_failures do expect(actor).not_to be_valid - expect { pull_access_check }.to raise_unauthorized('Your SSH key must be at least 4096 bits.') - expect { push_access_check }.to raise_unauthorized('Your SSH key must be at least 4096 bits.') + expect { pull_access_check }.to raise_unauthorized(_('Your SSH key must be at least 4096 bits.')) + expect { push_access_check }.to raise_unauthorized(_('Your SSH key must be at least 4096 bits.')) end end @@ -386,7 +386,7 @@ describe Gitlab::GitAccess do end context 'when calling git-upload-pack' do - it { expect { pull_access_check }.to raise_unauthorized('Pulling over HTTP is not allowed.') } + it { expect { pull_access_check }.to raise_unauthorized(_('Pulling over HTTP is not allowed.')) } end context 'when calling git-receive-pack' do @@ -400,7 +400,7 @@ describe Gitlab::GitAccess do end context 'when calling git-receive-pack' do - it { expect { push_access_check }.to raise_unauthorized('Pushing over HTTP is not allowed.') } + it { expect { push_access_check }.to raise_unauthorized(_('Pushing over HTTP is not allowed.')) } end context 'when calling git-upload-pack' do @@ -538,7 +538,7 @@ describe Gitlab::GitAccess do project.add_maintainer(user) user.block - expect { pull_access_check }.to raise_unauthorized('Your account has been blocked.') + expect { pull_access_check }.to raise_unauthorized(_('Your account has been blocked.')) end context 'when the project repository does not exist' do @@ -550,7 +550,7 @@ describe Gitlab::GitAccess do # Sanity check for rm_rf expect(repo.exists?).to eq(false) - expect { pull_access_check }.to raise_error(Gitlab::GitAccess::NotFoundError, 'A repository for this project does not exist yet.') + expect { pull_access_check }.to raise_error(Gitlab::GitAccess::NotFoundError, _('A repository for this project does not exist yet.')) end end @@ -1003,7 +1003,7 @@ describe Gitlab::GitAccess do it 'denies push access' do project.add_maintainer(user) - expect { push_access_check }.to raise_unauthorized('The repository is temporarily read-only. Please try again later.') + expect { push_access_check }.to raise_unauthorized(_('The repository is temporarily read-only. Please try again later.')) end end diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 6ba65b56618..a44426a95d5 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -31,7 +31,7 @@ describe Gitlab::GitAccessWiki do end it 'does not give access to upload wiki code' do - expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, "You can't push code to a read-only GitLab instance.") + expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _("You can't push code to a read-only GitLab instance.")) end end end @@ -59,7 +59,7 @@ describe Gitlab::GitAccessWiki do # Sanity check for rm_rf expect(wiki_repo.exists?).to eq(false) - expect { subject }.to raise_error(Gitlab::GitAccess::NotFoundError, 'A repository for this project does not exist yet.') + expect { subject }.to raise_error(Gitlab::GitAccess::NotFoundError, _('A repository for this project does not exist yet.')) end end end @@ -68,7 +68,7 @@ describe Gitlab::GitAccessWiki do it 'does not give access to download wiki code' do project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED) - expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to download code from this project.') + expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, _('You are not allowed to download code from this project.')) end end end diff --git a/spec/lib/gitlab/google_code_import/importer_spec.rb b/spec/lib/gitlab/google_code_import/importer_spec.rb index 031f57dbc65..6b287229e9f 100644 --- a/spec/lib/gitlab/google_code_import/importer_spec.rb +++ b/spec/lib/gitlab/google_code_import/importer_spec.rb @@ -59,7 +59,7 @@ describe Gitlab::GoogleCodeImport::Importer do expect(issue.description).to include("schattenpr\\.\\.\\.") expect(issue.description).to include("November 18, 2009 00:20") expect(issue.description).to include("Google Code") - expect(issue.description).to include('I like to scroll through the tasks with my scrollwheel (like in fluxbox).') + expect(issue.description).to include(_('I like to scroll through the tasks with my scrollwheel (like in fluxbox).')) expect(issue.description).to include('Patch is attached that adds two new mouse-actions (next_task+prev_task)') expect(issue.description).to include('that can be used for exactly that purpose.') expect(issue.description).to include('all the best!') diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb index fe0e9702f8a..16adc2a8c2b 100644 --- a/spec/lib/gitlab/highlight_spec.rb +++ b/spec/lib/gitlab/highlight_spec.rb @@ -57,7 +57,7 @@ describe Gitlab::Highlight do expect(lines.count).to eq(3) expect(lines[0].text).to eq('"""This is line 1 of a multi-line comment.') - expect(lines[1].text).to eq(' This is line 2.') + expect(lines[1].text).to eq(_(' This is line 2.')) expect(lines[2].text).to eq(' """') end diff --git a/spec/lib/gitlab/i18n/po_linter_spec.rb b/spec/lib/gitlab/i18n/po_linter_spec.rb index 3dbc23d2aaf..de56ae10f7e 100644 --- a/spec/lib/gitlab/i18n/po_linter_spec.rb +++ b/spec/lib/gitlab/i18n/po_linter_spec.rb @@ -49,14 +49,14 @@ describe Gitlab::I18n::PoLinter do let(:po_path) { 'spec/fixtures/newlines.po' } it 'has an error for a normal string' do - message_id = "You are going to remove %{group_name}.\\nRemoved groups CANNOT be restored!\\nAre you ABSOLUTELY sure?" + message_id = _("You are going to remove %{group_name}.\\nRemoved groups CANNOT be restored!\\nAre you ABSOLUTELY sure?") expected_message = "is defined over multiple lines, this breaks some tooling." expect(errors[message_id]).to include(expected_message) end it 'has an error when a translation is defined over multiple lines' do - message_id = "You are going to remove %{group_name}.\\nRemoved groups CANNOT be restored!\\nAre you ABSOLUTELY sure?" + message_id = _("You are going to remove %{group_name}.\\nRemoved groups CANNOT be restored!\\nAre you ABSOLUTELY sure?") expected_message = "has translations defined over multiple lines, this breaks some tooling." expect(errors[message_id]).to include(expected_message) @@ -137,7 +137,7 @@ describe Gitlab::I18n::PoLinter do let(:po_path) { 'spec/fixtures/unescaped_chars.po' } it 'contains an error' do - message_id = 'You are going to transfer %{project_name_with_namespace} to another owner. Are you ABSOLUTELY sure?' + message_id = _('You are going to transfer %{project_name_with_namespace} to another owner. Are you ABSOLUTELY sure?') expected_error = 'translation contains unescaped `%`, escape it using `%%`' expect(errors[message_id]).to include(expected_error) @@ -324,7 +324,7 @@ describe Gitlab::I18n::PoLinter do it 'adds an error message when translating fails' do errors = [] - expect(FastGettext::Translation).to receive(:_) { raise 'broken' } + expect(FastGettext::Translation).to receive(:_) { raise _('broken') } linter.validate_translation(errors, entry) @@ -335,7 +335,7 @@ describe Gitlab::I18n::PoLinter do entry = fake_translation(msgid: 'Tests|Hello', translation: 'broken') errors = [] - expect(FastGettext::Translation).to receive(:s_) { raise 'broken' } + expect(FastGettext::Translation).to receive(:s_) { raise _('broken') } linter.validate_translation(errors, entry) diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index 242c16c4bdc..3bacc145ddc 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -47,7 +47,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end it 'has the project description' do - expect(Project.find_by_path('project').description).to eq('Nisi et repellendus ut enim quo accusamus vel magnam.') + expect(Project.find_by_path('project').description).to eq(_('Nisi et repellendus ut enim quo accusamus vel magnam.')) end it 'has the same label associated to two issues' do @@ -71,7 +71,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end it 'preserves updated_at on issues' do - issue = Issue.where(description: 'Aliquam enim illo et possimus.').first + issue = Issue.where(description: _('Aliquam enim illo et possimus.')).first expect(issue.reload.updated_at.to_s).to eq('2016-06-14 15:02:47 UTC') end diff --git a/spec/lib/gitlab/legacy_github_import/importer_spec.rb b/spec/lib/gitlab/legacy_github_import/importer_spec.rb index 6bc3792eb22..8e8e5277d0b 100644 --- a/spec/lib/gitlab/legacy_github_import/importer_spec.rb +++ b/spec/lib/gitlab/legacy_github_import/importer_spec.rb @@ -160,7 +160,7 @@ describe Gitlab::LegacyGithubImport::Importer do it 'stores error messages' do error = { - message: 'The remote data could not be fully imported.', + message: _('The remote data could not be fully imported.'), errors: [ { type: :label, url: "#{api_root}/repos/octocat/Hello-World/labels/bug", errors: "Validation failed: Title can't be blank, Title is invalid" }, { type: :issue, url: "#{api_root}/repos/octocat/Hello-World/issues/1348", errors: "Validation failed: Title can't be blank" }, diff --git a/spec/lib/gitlab/manifest_import/manifest_spec.rb b/spec/lib/gitlab/manifest_import/manifest_spec.rb index ab305fb2316..b939f3bc133 100644 --- a/spec/lib/gitlab/manifest_import/manifest_spec.rb +++ b/spec/lib/gitlab/manifest_import/manifest_spec.rb @@ -31,8 +31,8 @@ describe Gitlab::ManifestImport::Manifest, :postgresql do manifest.valid? end - it { expect(manifest.errors).to include('Make sure a <remote> tag is present and is valid.') } - it { expect(manifest.errors).to include('Make sure every <project> tag has name and path attributes.') } + it { expect(manifest.errors).to include(_('Make sure a <remote> tag is present and is valid.')) } + it { expect(manifest.errors).to include(_('Make sure every <project> tag has name and path attributes.')) } end end end diff --git a/spec/lib/gitlab/quick_actions/dsl_spec.rb b/spec/lib/gitlab/quick_actions/dsl_spec.rb index fd4df8694ba..7a7ee08727f 100644 --- a/spec/lib/gitlab/quick_actions/dsl_spec.rb +++ b/spec/lib/gitlab/quick_actions/dsl_spec.rb @@ -7,12 +7,12 @@ describe Gitlab::QuickActions::Dsl do desc 'A command with no args' command :no_args, :none do - "Hello World!" + _("Hello World!") end params 'The first argument' explanation 'Static explanation' - warning 'Possible problem!' + warning _('Possible problem!') command :explanation_with_aliases, :once, :first do |arg| arg end @@ -75,7 +75,7 @@ describe Gitlab::QuickActions::Dsl do expect(explanation_with_aliases_def.condition_block).to be_nil expect(explanation_with_aliases_def.action_block).to be_a_kind_of(Proc) expect(explanation_with_aliases_def.parse_params_block).to be_nil - expect(explanation_with_aliases_def.warning).to eq('Possible problem!') + expect(explanation_with_aliases_def.warning).to eq(_('Possible problem!')) expect(dynamic_description_def.name).to eq(:dynamic_description) expect(dynamic_description_def.aliases).to eq([]) diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index 6ce9d515a0f..6de6e139146 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -492,7 +492,7 @@ describe Gitlab::Shell do it 'return false when the command fails' do expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:fork_repository) - .with(repository.raw_repository) { raise GRPC::BadStatus, 'bla' } + .with(repository.raw_repository) { raise GRPC::BadStatus, _('bla') } is_expected.to be_falsy end @@ -512,7 +512,7 @@ describe Gitlab::Shell do it 'raises an exception when the command fails' do expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:import_repository) - .with(import_url) { raise GRPC::BadStatus, 'bla' } + .with(import_url) { raise GRPC::BadStatus, _('bla') } expect_any_instance_of(Gitlab::Shell::GitalyGitlabProjects).to receive(:output) { 'error'} expect do diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb index a9d15f1d522..7c095213b30 100644 --- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb @@ -77,7 +77,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do expect do subject.call(job, 'test_queue') do - raise ArgumentError, 'some exception' + raise ArgumentError, _('some exception') end end.to raise_error(ArgumentError) end diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb index 7c194749dfb..d9e4f05b682 100644 --- a/spec/lib/mattermost/command_spec.rb +++ b/spec/lib/mattermost/command_spec.rb @@ -46,7 +46,7 @@ describe Mattermost::Command do headers: { 'Content-Type' => 'application/json' }, body: { id: 'api.command.duplicate_trigger.app_error', - message: 'This trigger word is already in use. Please choose another word.', + message: _('This trigger word is already in use. Please choose another word.'), detailed_error: '', request_id: 'obc374man7bx5r3dbc1q5qhf3r', status_code: 400 @@ -55,7 +55,7 @@ describe Mattermost::Command do end it 'raises an error with message' do - expect { subject }.to raise_error(Mattermost::Error, 'This trigger word is already in use. Please choose another word.') + expect { subject }.to raise_error(Mattermost::Error, _('This trigger word is already in use. Please choose another word.')) end end end diff --git a/spec/lib/mattermost/team_spec.rb b/spec/lib/mattermost/team_spec.rb index 030aa5d06a8..096b7df88a4 100644 --- a/spec/lib/mattermost/team_spec.rb +++ b/spec/lib/mattermost/team_spec.rb @@ -54,7 +54,7 @@ describe Mattermost::Team do headers: { 'Content-Type' => 'application/json' }, body: { id: 'api.team.list.app_error', - message: 'Cannot list teams.', + message: _('Cannot list teams.'), detailed_error: '', request_id: 'obc374man7bx5r3dbc1q5qhf3r', status_code: 500 @@ -63,7 +63,7 @@ describe Mattermost::Team do end it 'raises an error with message' do - expect { subject }.to raise_error(Mattermost::Error, 'Cannot list teams.') + expect { subject }.to raise_error(Mattermost::Error, _('Cannot list teams.')) end end end diff --git a/spec/lib/system_check/simple_executor_spec.rb b/spec/lib/system_check/simple_executor_spec.rb index e71e9da369d..403c6a4e0e4 100644 --- a/spec/lib/system_check/simple_executor_spec.rb +++ b/spec/lib/system_check/simple_executor_spec.rb @@ -31,7 +31,7 @@ describe SystemCheck::SimpleExecutor do end def check? - raise 'should not execute this' + raise _('should not execute this') end end @@ -45,7 +45,7 @@ describe SystemCheck::SimpleExecutor do end def check? - raise 'should not execute this' + raise _('should not execute this') end end @@ -57,7 +57,7 @@ describe SystemCheck::SimpleExecutor do end def check? - raise 'should not execute this' + raise _('should not execute this') end end @@ -69,7 +69,7 @@ describe SystemCheck::SimpleExecutor do end def multi_check - raise 'should not execute this' + raise _('should not execute this') end end @@ -94,7 +94,7 @@ describe SystemCheck::SimpleExecutor do set_name 'my bugous check' def check? - raise CustomError, 'omg' + raise CustomError, _('omg') end end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index f2d99872401..3480dc2bcf3 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -25,7 +25,7 @@ describe Notify do create(:issue, author: current_user, assignees: [assignee], project: project, - description: 'My awesome description!') + description: _('My awesome description!')) end context 'for a project' do diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index a2d2d77746d..02a5db46f6c 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -201,10 +201,10 @@ describe Commit do end it 'truncates a message without a newline at natural break to 80 characters' do - message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.' + message = _('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.') allow(commit).to receive(:safe_message).and_return(message) - expect(commit.title).to eq('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id...') + expect(commit.title).to eq(_('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id...')) end it "truncates a message with a newline before 80 characters at the newline" do @@ -232,7 +232,7 @@ eos end it "returns entire message if there is no newline" do - message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.' + message = _('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.') allow(commit).to receive(:safe_message).and_return(message) expect(commit.full_title).to eq(message) @@ -260,7 +260,7 @@ Vivamus egestas lacinia lacus, sed rutrum mauris. eos allow(commit).to receive(:safe_message).and_return(message) - expect(commit.description).to eq('Vivamus egestas lacinia lacus, sed rutrum mauris.') + expect(commit.description).to eq(_('Vivamus egestas lacinia lacus, sed rutrum mauris.')) end it 'returns full commit message if commit title more than 100 characters' do diff --git a/spec/models/concerns/prometheus_adapter_spec.rb b/spec/models/concerns/prometheus_adapter_spec.rb index f4b9c57e71a..a84bbc0ed39 100644 --- a/spec/models/concerns/prometheus_adapter_spec.rb +++ b/spec/models/concerns/prometheus_adapter_spec.rb @@ -111,7 +111,7 @@ describe PrometheusAdapter, :use_clean_rails_memory_store_caching do [404, 500].each do |status| context "when Prometheus responds with #{status}" do before do - stub_all_prometheus_requests(environment.slug, status: status, body: "QUERY FAILED!") + stub_all_prometheus_requests(environment.slug, status: status, body: _("QUERY FAILED!")) end it { is_expected.to eq(success: false, result: %(#{status} - "QUERY FAILED!")) } diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb index 97a4c212f1c..9b2736fd9a1 100644 --- a/spec/models/concerns/reactive_caching_spec.rb +++ b/spec/models/concerns/reactive_caching_spec.rb @@ -145,7 +145,7 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do stub_reactive_cache(instance, "preexisting") end - let(:calculation) { -> { raise "foo"} } + let(:calculation) { -> { raise _("foo")} } it 'leaves the cache untouched' do expect { go! }.to raise_error("foo") diff --git a/spec/models/concerns/spammable_spec.rb b/spec/models/concerns/spammable_spec.rb index e698207166c..c6d56413622 100644 --- a/spec/models/concerns/spammable_spec.rb +++ b/spec/models/concerns/spammable_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Spammable do - let(:issue) { create(:issue, description: 'Test Desc.') } + let(:issue) { create(:issue, description: _('Test Desc.')) } describe 'Associations' do subject { build(:issue) } diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 2e436f2cc8a..f42b27d1da3 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -396,7 +396,7 @@ describe Milestone do it 'raises an error when using iid format' do expect { milestone.to_reference(format: :iid) } - .to raise_error(ArgumentError, 'Cannot refer to a group milestone by an internal id!') + .to raise_error(ArgumentError, _('Cannot refer to a group milestone by an internal id!')) end end end diff --git a/spec/models/project_label_spec.rb b/spec/models/project_label_spec.rb index 689d4e505e5..4a93356701c 100644 --- a/spec/models/project_label_spec.rb +++ b/spec/models/project_label_spec.rb @@ -44,7 +44,7 @@ describe ProjectLabel do it 'does not returns error when title does not change' do project_label = create(:label, project: project, name: 'Security') create(:group_label, group: group, name: 'Security') - project_label.description = 'Security related stuff.' + project_label.description = _('Security related stuff.') project_label.valid? diff --git a/spec/models/project_services/bamboo_service_spec.rb b/spec/models/project_services/bamboo_service_spec.rb index ee84fa95f0e..44432a662a9 100644 --- a/spec/models/project_services/bamboo_service_spec.rb +++ b/spec/models/project_services/bamboo_service_spec.rb @@ -199,25 +199,25 @@ describe BambooService, :use_clean_rails_memory_store_caching do end it 'sets commit status to "success" when build state contains Success' do - stub_request(body: bamboo_response(build_state: 'YAY Success!')) + stub_request(body: bamboo_response(build_state: _('YAY Success!'))) is_expected.to eq('success') end it 'sets commit status to "failed" when build state contains Failed' do - stub_request(body: bamboo_response(build_state: 'NO Failed!')) + stub_request(body: bamboo_response(build_state: _('NO Failed!'))) is_expected.to eq('failed') end it 'sets commit status to "pending" when build state contains Pending' do - stub_request(body: bamboo_response(build_state: 'NO Pending!')) + stub_request(body: bamboo_response(build_state: _('NO Pending!'))) is_expected.to eq('pending') end it 'sets commit status to :error when build state is unknown' do - stub_request(body: bamboo_response(build_state: 'FOO BAR!')) + stub_request(body: bamboo_response(build_state: _('FOO BAR!'))) is_expected.to eq(:error) end diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 788b3179b01..81f08190e0f 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -327,9 +327,9 @@ describe JiraService do it 'returns result with the error' do test_url = 'http://jira.example.com/rest/api/2/serverInfo' WebMock.stub_request(:get, test_url).with(basic_auth: %w(jira_username jira_password)) - .to_raise(JIRA::HTTPError.new(double(message: 'Some specific failure.'))) + .to_raise(JIRA::HTTPError.new(double(message: _('Some specific failure.')))) - expect(jira_service.test(nil)).to eq( { success: false, result: 'Some specific failure.' }) + expect(jira_service.test(nil)).to eq( { success: false, result: _('Some specific failure.') }) end end end diff --git a/spec/models/project_services/mattermost_slash_commands_service_spec.rb b/spec/models/project_services/mattermost_slash_commands_service_spec.rb index 1983e0cc967..ef2eff0c3e3 100644 --- a/spec/models/project_services/mattermost_slash_commands_service_spec.rb +++ b/spec/models/project_services/mattermost_slash_commands_service_spec.rb @@ -65,7 +65,7 @@ describe MattermostSlashCommandsService do headers: { 'Content-Type' => 'application/json' }, body: { id: 'api.command.duplicate_trigger.app_error', - message: 'This trigger word is already in use. Please choose another word.', + message: _('This trigger word is already in use. Please choose another word.'), detailed_error: '', request_id: 'obc374man7bx5r3dbc1q5qhf3r', status_code: 500 @@ -77,7 +77,7 @@ describe MattermostSlashCommandsService do succeeded, message = subject expect(succeeded).to be(false) - expect(message).to eq('This trigger word is already in use. Please choose another word.') + expect(message).to eq(_('This trigger word is already in use. Please choose another word.')) end end end @@ -109,13 +109,13 @@ describe MattermostSlashCommandsService do status: 500, headers: { 'Content-Type' => 'application/json' }, body: { - message: 'Failed to get team list.' + message: _('Failed to get team list.') }.to_json ) end it 'shows error messages' do - expect(subject).to eq([[], "Failed to get team list."]) + expect(subject).to eq([[], _("Failed to get team list.")]) end end end diff --git a/spec/models/project_services/teamcity_service_spec.rb b/spec/models/project_services/teamcity_service_spec.rb index 64b4efca43a..c01608ab4f6 100644 --- a/spec/models/project_services/teamcity_service_spec.rb +++ b/spec/models/project_services/teamcity_service_spec.rb @@ -179,25 +179,25 @@ describe TeamcityService, :use_clean_rails_memory_store_caching do end it 'sets commit status to "success" when build status contains SUCCESS' do - stub_request(build_status: 'YAY SUCCESS!') + stub_request(build_status: _('YAY SUCCESS!')) is_expected.to eq('success') end it 'sets commit status to "failed" when build status contains FAILURE' do - stub_request(build_status: 'NO FAILURE!') + stub_request(build_status: _('NO FAILURE!')) is_expected.to eq('failed') end it 'sets commit status to "pending" when build status contains Pending' do - stub_request(build_status: 'NO Pending!') + stub_request(build_status: _('NO Pending!')) is_expected.to eq('pending') end it 'sets commit status to :error when build status is unknown' do - stub_request(build_status: 'FOO BAR!') + stub_request(build_status: _('FOO BAR!')) is_expected.to eq(:error) end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 7a8dc59039e..a4664a714ec 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -366,7 +366,7 @@ describe Project do end it 'contains errors related to the project being deleted' do - expect(new_project.errors.full_messages.first).to eq('The project is still being deleted. Please try again later.') + expect(new_project.errors.full_messages.first).to eq(_('The project is still being deleted. Please try again later.')) end end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index ac5874fd0f7..6af5082019f 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -650,7 +650,7 @@ describe Repository do context "when an author is specified" do it "uses the given email/name to set the commit's author" do expect do - repository.update_file(user, 'README', 'Updated README!', + repository.update_file(user, 'README', _('Updated README!'), branch_name: 'master', previous_path: 'README', message: 'Update README', @@ -926,7 +926,7 @@ describe Repository do end it 'returns nil when the content is not recognizable' do - repository.create_file(user, 'LICENSE', 'Gitlab B.V.', + repository.create_file(user, 'LICENSE', _('Gitlab B.V.'), message: 'Add LICENSE', branch_name: 'master') expect(repository.license_key).to be_nil @@ -970,7 +970,7 @@ describe Repository do end it 'returns nil when the content is not recognizable' do - repository.create_file(user, 'LICENSE', 'Gitlab B.V.', + repository.create_file(user, 'LICENSE', _('Gitlab B.V.'), message: 'Add LICENSE', branch_name: 'master') expect(repository.license).to be_nil diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 9b32dc78274..616c3d87028 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -472,7 +472,7 @@ describe API::Files do put api(route(file_path), user), params: params_with_stale_id expect(response).to have_gitlab_http_status(400) - expect(json_response['message']).to eq('You are attempting to update a file that has changed since you started editing it.') + expect(json_response['message']).to eq(_('You are attempting to update a file that has changed since you started editing it.')) end it "updates existing file in project repo with accepts correct last commit id" do diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index a0c64d295c0..0cf1e754d87 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -264,7 +264,7 @@ describe API::Helpers do # We need to stub at a lower level than #sentry_enabled? otherwise # Sentry is not enabled when the request below is made, and the test # would pass even without the fix - expect(ProjectsFinder).to receive(:new).and_raise('Runtime Error!') + expect(ProjectsFinder).to receive(:new).and_raise(_('Runtime Error!')) get api('/projects', personal_access_token: token) @@ -281,7 +281,7 @@ describe API::Helpers do let(:event_data) { Raven.client.transport.events.first[1] } it 'sends the params, excluding confidential values' do - expect(ProjectsFinder).to receive(:new).and_raise('Runtime Error!') + expect(ProjectsFinder).to receive(:new).and_raise(_('Runtime Error!')) get api('/projects', user), params: { password: 'dont_send_this', other_param: 'send_this' } diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index ba7930f6c9d..6b478451f7d 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -1588,7 +1588,7 @@ describe API::Issues do params: { to_project_id: project.id } expect(response).to have_gitlab_http_status(400) - expect(json_response['message']).to eq('Cannot move issue to project it originates from!') + expect(json_response['message']).to eq(_('Cannot move issue to project it originates from!')) end end @@ -1598,7 +1598,7 @@ describe API::Issues do params: { to_project_id: target_project2.id } expect(response).to have_gitlab_http_status(400) - expect(json_response['message']).to eq('Cannot move issue due to insufficient permissions!') + expect(json_response['message']).to eq(_('Cannot move issue due to insufficient permissions!')) end end diff --git a/spec/requests/api/markdown_spec.rb b/spec/requests/api/markdown_spec.rb index e82ef002d32..3f73f0054e8 100644 --- a/spec/requests/api/markdown_spec.rb +++ b/spec/requests/api/markdown_spec.rb @@ -41,7 +41,7 @@ describe API::Markdown do end context "when project is not found" do - let(:params) { { text: "Hello world!", gfm: true, project: "Dummy project" } } + let(:params) { { text: _("Hello world!"), gfm: true, project: "Dummy project" } } it_behaves_like "404 Project Not Found" end @@ -82,7 +82,7 @@ describe API::Markdown do expect(response).to have_http_status(201) expect(response.headers["Content-Type"]).to eq("application/json") expect(json_response).to be_a(Hash) - expect(json_response["html"]).to include("Hello world!") + expect(json_response["html"]).to include(_("Hello world!")) .and include('data-name="tada"') .and include('data-name="100"') .and include("#1") @@ -99,7 +99,7 @@ describe API::Markdown do expect(response).to have_http_status(201) expect(response.headers["Content-Type"]).to eq("application/json") expect(json_response).to be_a(Hash) - expect(json_response["html"]).to include("Hello world!") + expect(json_response["html"]).to include(_("Hello world!")) .and include('data-name="tada"') .and include('data-name="100"') .and include("<a href=\"#{IssuesHelper.url_for_issue(issue.iid, project)}\"") @@ -119,7 +119,7 @@ describe API::Markdown do expect(response).to have_http_status(201) expect(json_response["html"]).not_to include('Confidential title') expect(json_response["html"]).not_to include('<a href=') - expect(json_response["html"]).to include('Hello world!') + expect(json_response["html"]).to include(_('Hello world!')) .and include('data-name="tada"') .and include('data-name="100"') .and include('#1</p>') @@ -144,7 +144,7 @@ describe API::Markdown do it 'renders the title or link' do expect(response).to have_http_status(201) expect(json_response["html"]).to include('Confidential title') - expect(json_response["html"]).to include('Hello world!') + expect(json_response["html"]).to include(_('Hello world!')) .and include('data-name="tada"') .and include('data-name="100"') .and include("<a href=\"#{IssuesHelper.url_for_issue(confidential_issue.iid, public_project)}\"") diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index 811e23fb854..1b8d59feecf 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -437,7 +437,7 @@ describe API::Releases do end describe 'PUT /projects/:id/releases/:tag_name' do - let(:params) { { description: 'Best release ever!' } } + let(:params) { { description: _('Best release ever!') } } let!(:release) do create(:release, @@ -456,7 +456,7 @@ describe API::Releases do it 'updates the description' do put api("/projects/#{project.id}/releases/v0.1", maintainer), params: params - expect(project.releases.last.description).to eq('Best release ever!') + expect(project.releases.last.description).to eq(_('Best release ever!')) end it 'does not change other attributes' do diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index 45fb1562e84..9a7249ac136 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -60,7 +60,7 @@ describe API::Settings, 'Settings' do ecdsa_key_restriction: 384, ed25519_key_restriction: 256, enforce_terms: true, - terms: 'Hello world!', + terms: _('Hello world!'), performance_bar_allowed_group_path: group.full_path, instance_statistics_visibility_private: true, diff_max_patch_bytes: 150_000, @@ -85,7 +85,7 @@ describe API::Settings, 'Settings' do expect(json_response['ecdsa_key_restriction']).to eq(384) expect(json_response['ed25519_key_restriction']).to eq(256) expect(json_response['enforce_terms']).to be(true) - expect(json_response['terms']).to eq('Hello world!') + expect(json_response['terms']).to eq(_('Hello world!')) expect(json_response['performance_bar_allowed_group_id']).to eq(group.id) expect(json_response['instance_statistics_visibility_private']).to be(true) expect(json_response['diff_max_patch_bytes']).to eq(150_000) diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb index fffe878ddbd..63431d78fc9 100644 --- a/spec/requests/api/tags_spec.rb +++ b/spec/requests/api/tags_spec.rb @@ -117,7 +117,7 @@ describe API::Tags do end context 'with releases' do - let(:description) { 'Awesome release!' } + let(:description) { _('Awesome release!') } let!(:release) do create(:release, @@ -371,7 +371,7 @@ describe API::Tags do describe 'POST /projects/:id/repository/tags/:tag_name/release' do let(:route) { "/projects/#{project_id}/repository/tags/#{tag_name}/release" } - let(:description) { 'Awesome release!' } + let(:description) { _('Awesome release!') } shared_examples_for 'repository new release' do it 'creates description for existing git tag' do @@ -427,8 +427,8 @@ describe API::Tags do describe 'PUT id/repository/tags/:tag_name/release' do let(:route) { "/projects/#{project_id}/repository/tags/#{tag_name}/release" } - let(:description) { 'Awesome release!' } - let(:new_description) { 'The best release!' } + let(:description) { _('Awesome release!') } + let(:new_description) { _('The best release!') } shared_examples_for 'repository update release' do context 'on tag with existing release' do diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 5b625fd47be..6588b142787 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -302,7 +302,7 @@ describe 'Git HTTP requests' do it 'rejects pushes with 403 Forbidden' do upload(path, env) do |response| expect(response).to have_gitlab_http_status(:forbidden) - expect(response.body).to eq('You are not allowed to push code to this project.') + expect(response.body).to eq(_('You are not allowed to push code to this project.')) end end diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index f1514e90eb2..1727da0eeb7 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -42,7 +42,7 @@ describe 'Git LFS API and storage' do it 'responds with 501' do expect(response).to have_gitlab_http_status(501) - expect(json_response).to include('message' => 'Git LFS is not enabled on this GitLab server, contact your admin.') + expect(json_response).to include('message' => _('Git LFS is not enabled on this GitLab server, contact your admin.')) end end @@ -119,14 +119,14 @@ describe 'Git LFS API and storage' do post_lfs_json "#{project.http_url_to_repo}/info/lfs/objects/batch", body, headers expect(response).to have_gitlab_http_status(403) - expect(json_response).to include('message' => 'Access forbidden. Check your access level.') + expect(json_response).to include('message' => _('Access forbidden. Check your access level.')) end it 'responds with a 403 message on download' do get "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}", params: {}, headers: headers expect(response).to have_gitlab_http_status(403) - expect(json_response).to include('message' => 'Access forbidden. Check your access level.') + expect(json_response).to include('message' => _('Access forbidden. Check your access level.')) end end @@ -164,7 +164,7 @@ describe 'Git LFS API and storage' do end it 'returns deprecated message' do - expect(json_response).to include('message' => 'Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.') + expect(json_response).to include('message' => _('Server supports batch API only, please update your Git LFS client to version 1.0.1 and up.')) end end @@ -922,7 +922,7 @@ describe 'Git LFS API and storage' do post_lfs_json path, body.merge('operation' => 'upload'), headers expect(response).to have_gitlab_http_status(403) - expect(json_response).to include('message' => 'You cannot write to this read-only GitLab instance.') + expect(json_response).to include('message' => _('You cannot write to this read-only GitLab instance.')) end end diff --git a/spec/serializers/analytics_issue_entity_spec.rb b/spec/serializers/analytics_issue_entity_spec.rb index 89588b4df2b..740a936b96d 100644 --- a/spec/serializers/analytics_issue_entity_spec.rb +++ b/spec/serializers/analytics_issue_entity_spec.rb @@ -5,7 +5,7 @@ describe AnalyticsIssueEntity do let(:entity_hash) do { total_time: "172802.724419", - title: "Eos voluptatem inventore in sed.", + title: _("Eos voluptatem inventore in sed."), iid: "1", id: "1", created_at: "2016-11-12 15:04:02.948604", diff --git a/spec/serializers/analytics_issue_serializer_spec.rb b/spec/serializers/analytics_issue_serializer_spec.rb index 5befc28f4fa..7ee1e32740a 100644 --- a/spec/serializers/analytics_issue_serializer_spec.rb +++ b/spec/serializers/analytics_issue_serializer_spec.rb @@ -12,7 +12,7 @@ describe AnalyticsIssueSerializer do let(:resource) do { total_time: "172802.724419", - title: "Eos voluptatem inventore in sed.", + title: _("Eos voluptatem inventore in sed."), iid: "1", id: "1", created_at: "2016-11-12 15:04:02.948604", diff --git a/spec/serializers/analytics_merge_request_serializer_spec.rb b/spec/serializers/analytics_merge_request_serializer_spec.rb index 62067cc0ef2..4c47ef3fd40 100644 --- a/spec/serializers/analytics_merge_request_serializer_spec.rb +++ b/spec/serializers/analytics_merge_request_serializer_spec.rb @@ -12,7 +12,7 @@ describe AnalyticsMergeRequestSerializer do let(:resource) do { total_time: "172802.724419", - title: "Eos voluptatem inventore in sed.", + title: _("Eos voluptatem inventore in sed."), iid: "1", id: "1", state: 'open', diff --git a/spec/services/application_settings/update_service_spec.rb b/spec/services/application_settings/update_service_spec.rb index daf5dfba6b1..b4d1872f324 100644 --- a/spec/services/application_settings/update_service_spec.rb +++ b/spec/services/application_settings/update_service_spec.rb @@ -32,7 +32,7 @@ describe ApplicationSettings::UpdateService do end it 'does not create terms if they are the same as the existing ones' do - create(:term, terms: 'Be nice!') + create(:term, terms: _('Be nice!')) expect { subject.execute }.not_to change { ApplicationSetting::Term.count } end @@ -42,7 +42,7 @@ describe ApplicationSettings::UpdateService do subject.execute - expect(application_settings.terms).to eq('Be nice!') + expect(application_settings.terms).to eq(_('Be nice!')) end it 'Only queries once when the terms are changed' do @@ -51,7 +51,7 @@ describe ApplicationSettings::UpdateService do subject.execute - expect(application_settings.terms).to eq('Be nice!') + expect(application_settings.terms).to eq(_('Be nice!')) expect { 2.times { application_settings.terms } } .not_to exceed_query_limit(0) end diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 8497e90bd8b..304d7dc4d7c 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -768,7 +768,7 @@ describe Ci::CreatePipelineService do it 'does not create a merge request pipeline' do expect(pipeline).not_to be_persisted - expect(pipeline.errors[:base]).to eq(["No stages / jobs for this pipeline."]) + expect(pipeline.errors[:base]).to eq([_("No stages / jobs for this pipeline.")]) end end end @@ -814,7 +814,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.errors[:base]) - .to eq(['No stages / jobs for this pipeline.']) + .to eq([_('No stages / jobs for this pipeline.')]) end end @@ -825,7 +825,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.errors[:base]) - .to eq(['No stages / jobs for this pipeline.']) + .to eq([_('No stages / jobs for this pipeline.')]) end end end @@ -854,7 +854,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.errors[:base]) - .to eq(['No stages / jobs for this pipeline.']) + .to eq([_('No stages / jobs for this pipeline.')]) end end end @@ -885,7 +885,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.errors[:base]) - .to eq(['No stages / jobs for this pipeline.']) + .to eq([_('No stages / jobs for this pipeline.')]) end end end @@ -914,7 +914,7 @@ describe Ci::CreatePipelineService do expect(pipeline).not_to be_persisted expect(pipeline.errors[:base]) - .to eq(['No stages / jobs for this pipeline.']) + .to eq([_('No stages / jobs for this pipeline.')]) end end end diff --git a/spec/services/clusters/applications/check_installation_progress_service_spec.rb b/spec/services/clusters/applications/check_installation_progress_service_spec.rb index 45b8ce94815..1b0a32a1751 100644 --- a/spec/services/clusters/applications/check_installation_progress_service_spec.rb +++ b/spec/services/clusters/applications/check_installation_progress_service_spec.rb @@ -37,7 +37,7 @@ describe Clusters::Applications::CheckInstallationProgressService do service.execute expect(application).to be_errored - expect(application.status_reason).to eq("Installation timed out. Check pod logs for install-helm for more details.") + expect(application.status_reason).to eq(_("Installation timed out. Check pod logs for install-helm for more details.")) end end end @@ -84,7 +84,7 @@ describe Clusters::Applications::CheckInstallationProgressService do service.execute expect(application).to be_errored - expect(application.status_reason).to eq("Installation failed. Check pod logs for install-helm for more details.") + expect(application.status_reason).to eq(_("Installation failed. Check pod logs for install-helm for more details.")) end end diff --git a/spec/services/files/delete_service_spec.rb b/spec/services/files/delete_service_spec.rb index 309802ce733..974f803f31e 100644 --- a/spec/services/files/delete_service_spec.rb +++ b/spec/services/files/delete_service_spec.rb @@ -56,7 +56,7 @@ describe Files::DeleteService do it "returns a hash with the correct error message and a :error status " do expect { subject.execute } .to raise_error(Files::UpdateService::FileChangedError, - "You are attempting to delete a file that has been previously updated.") + _("You are attempting to delete a file that has been previously updated.")) end end diff --git a/spec/services/files/update_service_spec.rb b/spec/services/files/update_service_spec.rb index 23db35c2418..be30ea142a9 100644 --- a/spec/services/files/update_service_spec.rb +++ b/spec/services/files/update_service_spec.rb @@ -35,7 +35,7 @@ describe Files::UpdateService do it "returns a hash with the correct error message and a :error status " do expect { subject.execute } .to raise_error(Files::UpdateService::FileChangedError, - "You are attempting to update a file that has changed since you started editing it.") + _("You are attempting to update a file that has changed since you started editing it.")) end end diff --git a/spec/services/groups/create_service_spec.rb b/spec/services/groups/create_service_spec.rb index fe6a8691ae0..74250bb60da 100644 --- a/spec/services/groups/create_service_spec.rb +++ b/spec/services/groups/create_service_spec.rb @@ -58,7 +58,7 @@ describe Groups::CreateService, '#execute' do allow(Group).to receive(:supports_nested_objects?).and_return(false) is_expected.not_to be_persisted - expect(subject.errors[:parent_id]).to include('You don’t have permission to create a subgroup in this group.') + expect(subject.errors[:parent_id]).to include(_('You don’t have permission to create a subgroup in this group.')) expect(subject.parent_id).to be_nil end end @@ -73,7 +73,7 @@ describe Groups::CreateService, '#execute' do it 'does not save group and returns an error' do is_expected.not_to be_persisted - expect(subject.errors[:parent_id].first).to eq('You don’t have permission to create a subgroup in this group.') + expect(subject.errors[:parent_id].first).to eq(_('You don’t have permission to create a subgroup in this group.')) expect(subject.parent_id).to be_nil end end diff --git a/spec/services/groups/transfer_service_spec.rb b/spec/services/groups/transfer_service_spec.rb index 6b48c993c57..5567277d27e 100644 --- a/spec/services/groups/transfer_service_spec.rb +++ b/spec/services/groups/transfer_service_spec.rb @@ -18,7 +18,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq('Transfer failed: Database is not supported.') + expect(transfer_service.error).to eq(_('Transfer failed: Database is not supported.')) end end @@ -52,7 +52,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(nil) - expect(transfer_service.error).to eq('Transfer failed: Group is already a root group.') + expect(transfer_service.error).to eq(_('Transfer failed: Group is already a root group.')) end end @@ -65,7 +65,7 @@ describe Groups::TransferService, :postgresql do it "should add an error on group" do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq("Transfer failed: You don't have enough permissions.") + expect(transfer_service.error).to eq(_("Transfer failed: You don't have enough permissions.")) end end @@ -82,7 +82,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(nil) - expect(transfer_service.error).to eq('Transfer failed: The parent group already has a subgroup with the same path.') + expect(transfer_service.error).to eq(_('Transfer failed: The parent group already has a subgroup with the same path.')) end end @@ -128,7 +128,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq('Transfer failed: Group is already associated to the parent group.') + expect(transfer_service.error).to eq(_('Transfer failed: Group is already associated to the parent group.')) end end @@ -141,7 +141,7 @@ describe Groups::TransferService, :postgresql do it "should add an error on group" do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq("Transfer failed: You don't have enough permissions.") + expect(transfer_service.error).to eq(_("Transfer failed: You don't have enough permissions.")) end end @@ -158,7 +158,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq('Transfer failed: The parent group already has a subgroup with the same path.') + expect(transfer_service.error).to eq(_('Transfer failed: The parent group already has a subgroup with the same path.')) end end diff --git a/spec/services/labels/find_or_create_service_spec.rb b/spec/services/labels/find_or_create_service_spec.rb index 97ba2742392..f6ad1c74649 100644 --- a/spec/services/labels/find_or_create_service_spec.rb +++ b/spec/services/labels/find_or_create_service_spec.rb @@ -8,7 +8,7 @@ describe Labels::FindOrCreateService do let(:params) do { title: 'Security', - description: 'Security related stuff.', + description: _('Security related stuff.'), color: '#FF0000' } end diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index 536d0d345a4..39a97a51962 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -19,7 +19,7 @@ describe MergeRequests::BuildService do let(:merge_request) { service.execute } let(:compare) { double(:compare, commits: commits) } let(:commit_1) { double(:commit_1, sha: 'f00ba7', safe_message: "Initial commit\n\nCreate the app") } - let(:commit_2) { double(:commit_2, sha: 'f00ba7', safe_message: 'This is a bad commit message!') } + let(:commit_2) { double(:commit_2, sha: 'f00ba7', safe_message: _('This is a bad commit message!')) } let(:commits) { nil } let(:params) do diff --git a/spec/services/merge_requests/conflicts/resolve_service_spec.rb b/spec/services/merge_requests/conflicts/resolve_service_spec.rb index 7edf8a96c94..afac3b36f44 100644 --- a/spec/services/merge_requests/conflicts/resolve_service_spec.rb +++ b/spec/services/merge_requests/conflicts/resolve_service_spec.rb @@ -48,7 +48,7 @@ describe MergeRequests::Conflicts::ResolveService do } } ], - commit_message: 'This is a commit message!' + commit_message: _('This is a commit message!') } end @@ -146,7 +146,7 @@ describe MergeRequests::Conflicts::ResolveService do } } ], - commit_message: 'This is a commit message!' + commit_message: _('This is a commit message!') } end @@ -189,7 +189,7 @@ describe MergeRequests::Conflicts::ResolveService do sections: { '6eb14e00385d2fb284765eb1cd8d420d33d63fc9_9_9' => 'head' } } ], - commit_message: 'This is a commit message!' + commit_message: _('This is a commit message!') } end @@ -220,7 +220,7 @@ describe MergeRequests::Conflicts::ResolveService do content: regex_conflict.content } ], - commit_message: 'This is a commit message!' + commit_message: _('This is a commit message!') } end @@ -240,7 +240,7 @@ describe MergeRequests::Conflicts::ResolveService do content: '' } ], - commit_message: 'This is a commit message!' + commit_message: _('This is a commit message!') } end diff --git a/spec/services/preview_markdown_service_spec.rb b/spec/services/preview_markdown_service_spec.rb index 458cb8f1f31..a98c1b23cb3 100644 --- a/spec/services/preview_markdown_service_spec.rb +++ b/spec/services/preview_markdown_service_spec.rb @@ -86,7 +86,7 @@ describe PreviewMarkdownService do it 'explains quick actions effect' do result = service.execute - expect(result[:commands]).to eq 'Sets time estimate to 2y.' + expect(result[:commands]).to eq _('Sets time estimate to 2y.') end end @@ -111,7 +111,7 @@ describe PreviewMarkdownService do it 'explains quick actions effect' do result = service.execute - expect(result[:commands]).to eq 'Tags this commit to v1.2.3 with "Stable release".' + expect(result[:commands]).to eq _('Tags this commit to v1.2.3 with "Stable release".') end end diff --git a/spec/services/projects/lfs_pointers/lfs_download_link_list_service_spec.rb b/spec/services/projects/lfs_pointers/lfs_download_link_list_service_spec.rb index d7a2829d5f8..e347a0a405f 100644 --- a/spec/services/projects/lfs_pointers/lfs_download_link_list_service_spec.rb +++ b/spec/services/projects/lfs_pointers/lfs_download_link_list_service_spec.rb @@ -92,7 +92,7 @@ describe Projects::LfsPointers::LfsDownloadLinkListService do describe '#parse_response_links' do it 'does not add oid entry if href not found' do - expect(Rails.logger).to receive(:error).with("Link for Lfs Object with oid whatever not found or invalid.") + expect(Rails.logger).to receive(:error).with(_("Link for Lfs Object with oid whatever not found or invalid.")) result = subject.send(:parse_response_links, invalid_object_response) diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 766276fdba3..fec6d1bc75f 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -168,7 +168,7 @@ describe Projects::TransferService do it { expect(@result).to eq false } it { expect(project.namespace).to eq(user.namespace) } - it { expect(project.errors.messages[:new_namespace].first).to eq 'Please select a new namespace for your project.' } + it { expect(project.errors.messages[:new_namespace].first).to eq _('Please select a new namespace for your project.') } end context 'disallow transferring of project with tags' do @@ -202,7 +202,7 @@ describe Projects::TransferService do group.add_owner(user) unless gitlab_shell.create_repository(repository_storage, "#{group.full_path}/#{project.path}") - raise 'failed to add repository' + raise _('failed to add repository') end @result = transfer_project(project, user, group) diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 8adfc63222e..8aed8fd17cb 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -68,7 +68,7 @@ describe Projects::UpdateService do it 'does not update the project to public' do result = update_project(project, user, visibility_level: Gitlab::VisibilityLevel::PUBLIC) - expect(result).to eq({ status: :error, message: 'New visibility level not allowed!' }) + expect(result).to eq({ status: :error, message: _('New visibility level not allowed!') }) expect(project).to be_private end @@ -93,7 +93,7 @@ describe Projects::UpdateService do it 'does not update project visibility level' do result = update_project(project, admin, visibility_level: Gitlab::VisibilityLevel::PUBLIC) - expect(result).to eq({ status: :error, message: 'Visibility level public is not allowed in a internal group.' }) + expect(result).to eq({ status: :error, message: _('Visibility level public is not allowed in a internal group.') }) expect(project.reload).to be_internal end end @@ -315,7 +315,7 @@ describe Projects::UpdateService do expect(result).to eq({ status: :error, - message: "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'." + message: _("Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'.") }) end end diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 938764f40b0..fe823056fd6 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -1265,7 +1265,7 @@ describe QuickActions::InterpretService do it 'includes issuable name' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Closes this issue.']) + expect(explanations).to eq([_('Closes this issue.')]) end end @@ -1276,7 +1276,7 @@ describe QuickActions::InterpretService do it 'includes issuable name' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Reopens this merge request.']) + expect(explanations).to eq([_('Reopens this merge request.')]) end end @@ -1286,7 +1286,7 @@ describe QuickActions::InterpretService do it 'includes new title' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Changes the title to "This is new title".']) + expect(explanations).to eq([_('Changes the title to "This is new title".')]) end end @@ -1329,7 +1329,7 @@ describe QuickActions::InterpretService do it 'includes current milestone name' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Removes %"9.10" milestone.']) + expect(explanations).to eq([_('Removes %"9.10" milestone.')]) end end @@ -1351,7 +1351,7 @@ describe QuickActions::InterpretService do merge_request.update!(label_ids: [bug.id]) _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Removes all labels.']) + expect(explanations).to eq([_('Removes all labels.')]) end end @@ -1374,7 +1374,7 @@ describe QuickActions::InterpretService do it 'includes issuable name' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Subscribes to this issue.']) + expect(explanations).to eq([_('Subscribes to this issue.')]) end end @@ -1385,7 +1385,7 @@ describe QuickActions::InterpretService do merge_request.subscribe(developer, project) _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Unsubscribes from this merge request.']) + expect(explanations).to eq([_('Unsubscribes from this merge request.')]) end end @@ -1395,7 +1395,7 @@ describe QuickActions::InterpretService do it 'includes the date' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Sets the due date to Apr 1, 2016.']) + expect(explanations).to eq([_('Sets the due date to Apr 1, 2016.')]) end end @@ -1405,7 +1405,7 @@ describe QuickActions::InterpretService do it 'includes the new status' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Marks this merge request as Work In Progress.']) + expect(explanations).to eq([_('Marks this merge request as Work In Progress.')]) end end @@ -1415,7 +1415,7 @@ describe QuickActions::InterpretService do it 'includes the emoji' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Toggles :confetti_ball: emoji award.']) + expect(explanations).to eq([_('Toggles :confetti_ball: emoji award.')]) end end @@ -1425,7 +1425,7 @@ describe QuickActions::InterpretService do it 'includes the formatted duration' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Sets time estimate to 3mo 3w 4d.']) + expect(explanations).to eq([_('Sets time estimate to 3mo 3w 4d.')]) end end @@ -1435,7 +1435,7 @@ describe QuickActions::InterpretService do it 'includes the formatted duration and proper verb' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(['Subtracts 2h spent time.']) + expect(explanations).to eq([_('Subtracts 2h spent time.')]) end end @@ -1445,7 +1445,7 @@ describe QuickActions::InterpretService do it 'includes the branch name' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Sets target branch to my-feature.']) + expect(explanations).to eq([_('Sets target branch to my-feature.')]) end end @@ -1467,7 +1467,7 @@ describe QuickActions::InterpretService do it 'includes the project name' do _, explanations = service.explain(content, issue) - expect(explanations).to eq(["Moves this issue to test/project."]) + expect(explanations).to eq([_("Moves this issue to test/project.")]) end end @@ -1479,7 +1479,7 @@ describe QuickActions::InterpretService do it 'includes the tag name only' do _, explanations = service.explain(content, commit) - expect(explanations).to eq(["Tags this commit to v1.2.3."]) + expect(explanations).to eq([_("Tags this commit to v1.2.3.")]) end end @@ -1489,7 +1489,7 @@ describe QuickActions::InterpretService do it 'includes the tag name only' do _, explanations = service.explain(content, commit) - expect(explanations).to eq(["Tags this commit to v1.2.3."]) + expect(explanations).to eq([_("Tags this commit to v1.2.3.")]) end end end @@ -1500,7 +1500,7 @@ describe QuickActions::InterpretService do it 'includes the tag name and message' do _, explanations = service.explain(content, commit) - expect(explanations).to eq(["Tags this commit to v1.2.3 with \"Stable release\"."]) + expect(explanations).to eq([_("Tags this commit to v1.2.3 with \"Stable release\".")]) end end end diff --git a/spec/services/releases/create_service_spec.rb b/spec/services/releases/create_service_spec.rb index 612e9f152e7..e3116ba7f09 100644 --- a/spec/services/releases/create_service_spec.rb +++ b/spec/services/releases/create_service_spec.rb @@ -6,7 +6,7 @@ describe Releases::CreateService do let(:tag_name) { project.repository.tag_names.first } let(:tag_sha) { project.repository.find_tag(tag_name).dereferenced_target.sha } let(:name) { 'Bionic Beaver' } - let(:description) { 'Awesome release!' } + let(:description) { _('Awesome release!') } let(:params) { { tag: tag_name, name: name, description: description, ref: ref } } let(:ref) { nil } let(:service) { described_class.new(project, user, params) } diff --git a/spec/services/releases/update_service_spec.rb b/spec/services/releases/update_service_spec.rb index 6c68f364739..07ff2a03dce 100644 --- a/spec/services/releases/update_service_spec.rb +++ b/spec/services/releases/update_service_spec.rb @@ -4,7 +4,7 @@ describe Releases::UpdateService do let(:project) { create(:project, :repository) } let(:user) { create(:user) } let(:new_name) { 'A new name' } - let(:new_description) { 'The best release!' } + let(:new_description) { _('The best release!') } let(:params) { { name: new_name, description: new_description, tag: tag_name } } let(:service) { described_class.new(project, user, params) } let!(:release) { create(:release, project: project, author: user, tag: tag_name) } diff --git a/spec/services/test_hooks/project_service_spec.rb b/spec/services/test_hooks/project_service_spec.rb index 19e1c5ff3b2..003ba59150c 100644 --- a/spec/services/test_hooks/project_service_spec.rb +++ b/spec/services/test_hooks/project_service_spec.rb @@ -33,7 +33,7 @@ describe TestHooks::ProjectService do allow(project).to receive(:empty_repo?).and_return(true) expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has at least one commit.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has at least one commit.') }) end it 'executes hook' do @@ -53,7 +53,7 @@ describe TestHooks::ProjectService do allow(project).to receive(:empty_repo?).and_return(true) expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has at least one commit.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has at least one commit.') }) end it 'executes hook' do @@ -71,7 +71,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has notes.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has notes.') }) end it 'executes hook' do @@ -90,7 +90,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has issues.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has issues.') }) end it 'executes hook' do @@ -109,7 +109,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has issues.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has issues.') }) end it 'executes hook' do @@ -127,7 +127,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has merge requests.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has merge requests.') }) end it 'executes hook' do @@ -145,7 +145,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has CI jobs.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has CI jobs.') }) end it 'executes hook' do @@ -163,7 +163,7 @@ describe TestHooks::ProjectService do it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the project has CI pipelines.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the project has CI pipelines.') }) end it 'executes hook' do @@ -184,12 +184,12 @@ describe TestHooks::ProjectService do allow(project).to receive(:wiki_enabled?).and_return(false) expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the wiki is enabled and has pages.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the wiki is enabled and has pages.') }) end it 'returns error message if not enough data' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure the wiki is enabled and has pages.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure the wiki is enabled and has pages.') }) end it 'executes hook' do diff --git a/spec/services/test_hooks/system_service_spec.rb b/spec/services/test_hooks/system_service_spec.rb index 74d7715e50f..ce19f78ffdc 100644 --- a/spec/services/test_hooks/system_service_spec.rb +++ b/spec/services/test_hooks/system_service_spec.rb @@ -66,7 +66,7 @@ describe TestHooks::SystemService do it 'returns error message if the user does not have any repository with a merge request' do expect(hook).not_to receive(:execute) - expect(service.execute).to include({ status: :error, message: 'Ensure one of your projects has merge requests.' }) + expect(service.execute).to include({ status: :error, message: _('Ensure one of your projects has merge requests.') }) end it 'executes hook' do diff --git a/spec/support/features/issuable_quick_actions_shared_examples.rb b/spec/support/features/issuable_quick_actions_shared_examples.rb index 2a883ce1074..577d55fe039 100644 --- a/spec/support/features/issuable_quick_actions_shared_examples.rb +++ b/spec/support/features/issuable_quick_actions_shared_examples.rb @@ -382,7 +382,7 @@ shared_examples 'issuable record that supports quick actions in its description expect(page).to have_content 'Awesome!' expect(page).not_to have_content '/assign @bob' - expect(page).to have_content 'Assigns @bob.' + expect(page).to have_content _('Assigns @bob.') end end end diff --git a/spec/support/helpers/filtered_search_helpers.rb b/spec/support/helpers/filtered_search_helpers.rb index 6569feec39b..466f3ca9f6c 100644 --- a/spec/support/helpers/filtered_search_helpers.rb +++ b/spec/support/helpers/filtered_search_helpers.rb @@ -129,7 +129,7 @@ module FilteredSearchHelpers end def default_placeholder - 'Search or filter results...' + _('Search or filter results...') end def get_filtered_search_placeholder diff --git a/spec/support/helpers/live_debugger.rb b/spec/support/helpers/live_debugger.rb index 911eb48a8ca..dc01a08afe5 100644 --- a/spec/support/helpers/live_debugger.rb +++ b/spec/support/helpers/live_debugger.rb @@ -3,15 +3,15 @@ require 'io/console' module LiveDebugger def live_debug puts - puts "Current example is paused for live debugging." + puts _("Current example is paused for live debugging.") puts "Opening #{current_url} in your default browser..." puts "The current user credentials are: #{@current_user.username} / #{@current_user.password}" if @current_user - puts "Press any key to resume the execution of the example!!" + puts _("Press any key to resume the execution of the example!!") `open #{current_url}` loop until $stdin.getch - puts "Back to the example!" + puts _("Back to the example!") end end diff --git a/spec/support/helpers/select2_helper.rb b/spec/support/helpers/select2_helper.rb index 90618ba5b19..f54b06daafa 100644 --- a/spec/support/helpers/select2_helper.rb +++ b/spec/support/helpers/select2_helper.rb @@ -12,7 +12,7 @@ module Select2Helper def select2(value, options = {}) - raise ArgumentError, 'options must be a Hash' unless options.is_a?(Hash) + raise ArgumentError, _('options must be a Hash') unless options.is_a?(Hash) selector = options.fetch(:from) diff --git a/spec/support/helpers/terms_helper.rb b/spec/support/helpers/terms_helper.rb index a00ec14138b..84a18fb57ad 100644 --- a/spec/support/helpers/terms_helper.rb +++ b/spec/support/helpers/terms_helper.rb @@ -14,6 +14,6 @@ module TermsHelper def expect_to_be_on_terms_page expect(current_path).to eq terms_path - expect(page).to have_content('Please accept the Terms of Service before continuing.') + expect(page).to have_content(_('Please accept the Terms of Service before continuing.')) end end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index d352a7cdf1a..1919b0e19c3 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -181,7 +181,7 @@ module TestEnv spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s Bundler.with_original_env do - raise "gitaly spawn failed" unless system(spawn_script) + raise _("gitaly spawn failed") unless system(spawn_script) end @gitaly_pid = Integer(File.read('tmp/tests/gitaly.pid')) @@ -282,7 +282,7 @@ module TestEnv def eager_load_driver_server return unless defined?(Capybara) - puts "Starting the Capybara driver server..." + puts _("Starting the Capybara driver server...") Capybara.current_session.visit '/' end @@ -338,7 +338,7 @@ module TestEnv # Try to reset without fetching to avoid using the network. unless reset.call - raise 'Could not fetch test seed repository.' unless system(*%W(#{Gitlab.config.git.bin_path} -C #{repo_path} fetch origin)) + raise _('Could not fetch test seed repository.') unless system(*%W(#{Gitlab.config.git.bin_path} -C #{repo_path} fetch origin)) # Before we used Git clone's --mirror option, bare repos could end up # with missing refs, clearing them and retrying should fix the issue. diff --git a/spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb b/spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb index 1190863d88e..3b27990a901 100644 --- a/spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb +++ b/spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb @@ -4,7 +4,7 @@ shared_examples "matches the method pattern" do |method| let(:pattern) { patterns[method] } it do - skip "No pattern provided, skipping." unless pattern + skip _("No pattern provided, skipping.") unless pattern expect(target.method(method).call(*args)).to match(pattern) end @@ -35,7 +35,7 @@ shared_examples "builds correct paths" do |**patterns| describe "#relative_path" do it 'is relative' do - skip 'Path not set, skipping.' unless subject.path + skip _('Path not set, skipping.') unless subject.path expect(Pathname.new(subject.relative_path)).to be_relative end diff --git a/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb b/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb index 1bd176280c5..4df7e6b7f57 100644 --- a/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb +++ b/spec/support/shared_examples/uploaders/object_storage_shared_examples.rb @@ -29,7 +29,7 @@ shared_examples "migrates" do |to_store:, from_store: nil| elsif from == described_class::Store::LOCAL expect(subject.file).to be_a(CarrierWave::SanitizedFile) else - raise 'Unexpected file type' + raise _('Unexpected file type') end end @@ -117,18 +117,18 @@ shared_examples "migrates" do |to_store:, from_store: nil| context 'upon a fog failure' do before do storage_class = subject.send(:storage_for, to).class - expect_any_instance_of(storage_class).to receive(:store!).and_raise("Store failure.") + expect_any_instance_of(storage_class).to receive(:store!).and_raise(_("Store failure.")) end - include_examples "handles gracefully", error: "Store failure." + include_examples "handles gracefully", error: _("Store failure.") end context 'upon a database failure' do before do - expect(uploader).to receive(:persist_object_store!).and_raise("ActiveRecord failure.") + expect(uploader).to receive(:persist_object_store!).and_raise(_("ActiveRecord failure.")) end - include_examples "handles gracefully", error: "ActiveRecord failure." + include_examples "handles gracefully", error: _("ActiveRecord failure.") end end end diff --git a/spec/tasks/gitlab/cleanup_rake_spec.rb b/spec/tasks/gitlab/cleanup_rake_spec.rb index 19794227d9f..08b8420ef61 100644 --- a/spec/tasks/gitlab/cleanup_rake_spec.rb +++ b/spec/tasks/gitlab/cleanup_rake_spec.rb @@ -111,7 +111,7 @@ describe 'gitlab:cleanup rake tasks' do end it 'logs action as done' do - expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up...") + expect(logger).to receive(:info).with(_("Looking for orphaned project uploads to clean up...")) expect(logger).to receive(:info).with("Did fix #{path} -> #{new_path}") run_rake_task('gitlab:cleanup:project_uploads') @@ -127,7 +127,7 @@ describe 'gitlab:cleanup rake tasks' do end it 'logs action as able to be done' do - expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up. Dry run...") + expect(logger).to receive(:info).with(_("Looking for orphaned project uploads to clean up. Dry run...")) expect(logger).to receive(:info).with("Can fix #{path} -> #{new_path}") expect(logger).to receive(:info).with(/To clean up these files run this command with DRY_RUN=false/) diff --git a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb index 9588e8be5dc..4e8c173199f 100644 --- a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb @@ -23,7 +23,7 @@ describe 'gitlab:uploads:migrate rake tasks' do it do expect(ObjectStorage::MigrateUploadsWorker) .to receive(:perform_async).exactly(batch).times - .and_return("A fake job.") + .and_return(_("A fake job.")) run end diff --git a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb index da490cb02af..b734167887f 100644 --- a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb +++ b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb @@ -106,7 +106,7 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do context 'migration is unsuccessful' do before do allow_any_instance_of(ObjectStorage::Concern) - .to receive(:migrate!).and_raise(CarrierWave::UploadError, "I am a teapot.") + .to receive(:migrate!).and_raise(CarrierWave::UploadError, _("I am a teapot.")) end it_behaves_like 'outputs correctly', failures: 10 diff --git a/spec/validators/namespace_path_validator_spec.rb b/spec/validators/namespace_path_validator_spec.rb index 61e2845f35f..db1b4def82f 100644 --- a/spec/validators/namespace_path_validator_spec.rb +++ b/spec/validators/namespace_path_validator_spec.rb @@ -13,7 +13,7 @@ describe NamespacePathValidator do it 'adds a message when the path is not in the correct format' do group = build(:group) - validator.validate_each(group, :path, "Path with spaces, and comma's!") + validator.validate_each(group, :path, _("Path with spaces, and comma's!")) expect(group.errors[:path]).to include(Gitlab::PathRegex.namespace_format_message) end diff --git a/spec/validators/project_path_validator_spec.rb b/spec/validators/project_path_validator_spec.rb index 8bb5e72dc22..1f9a6a57f92 100644 --- a/spec/validators/project_path_validator_spec.rb +++ b/spec/validators/project_path_validator_spec.rb @@ -13,7 +13,7 @@ describe ProjectPathValidator do it 'adds a message when the path is not in the correct format' do project = build(:project) - validator.validate_each(project, :path, "Path with spaces, and comma's!") + validator.validate_each(project, :path, _("Path with spaces, and comma's!")) expect(project.errors[:path]).to include(Gitlab::PathRegex.project_path_format_message) end diff --git a/spec/views/projects/services/_form.haml_spec.rb b/spec/views/projects/services/_form.haml_spec.rb index 85167bca115..bc52784923c 100644 --- a/spec/views/projects/services/_form.haml_spec.rb +++ b/spec/views/projects/services/_form.haml_spec.rb @@ -38,8 +38,8 @@ describe 'projects/services/_form' do it 'display merge_request_events and commit_events descriptions' do render - expect(rendered).to have_content('JIRA comments will be created when an issue gets referenced in a commit.') - expect(rendered).to have_content('JIRA comments will be created when an issue gets referenced in a merge request.') + expect(rendered).to have_content(_('JIRA comments will be created when an issue gets referenced in a commit.')) + expect(rendered).to have_content(_('JIRA comments will be created when an issue gets referenced in a merge request.')) end end end diff --git a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb index cb1b9e6f5fb..83a34cda9fb 100644 --- a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb +++ b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb @@ -43,7 +43,7 @@ describe 'projects/settings/ci_cd/_autodevops_form' do render expect(rendered).to have_css('.auto-devops-warning-message') - expect(rendered).to have_text('Auto Review Apps and Auto Deploy need a domain name to work correctly.') + expect(rendered).to have_text(_('Auto Review Apps and Auto Deploy need a domain name to work correctly.')) end end diff --git a/spec/workers/repository_remove_remote_worker_spec.rb b/spec/workers/repository_remove_remote_worker_spec.rb index 6ddb653d142..a1e206a0548 100644 --- a/spec/workers/repository_remove_remote_worker_spec.rb +++ b/spec/workers/repository_remove_remote_worker_spec.rb @@ -30,7 +30,7 @@ describe RepositoryRemoveRemoteWorker do expect(subject) .to receive(:log_error) - .with('Cannot obtain an exclusive lease. There must be another instance already in execution.') + .with(_('Cannot obtain an exclusive lease. There must be another instance already in execution.')) subject.perform(project.id, remote_name) end |