diff options
Diffstat (limited to 'lib')
165 files changed, 408 insertions, 408 deletions
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 |