summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/access.rb8
-rw-r--r--lib/gitlab/auth.rb2
-rw-r--r--lib/gitlab/auth/ldap/adapter.rb2
-rw-r--r--lib/gitlab/auth/ldap/dn.rb6
-rw-r--r--lib/gitlab/auth/user_access_denied_reason.rb2
-rw-r--r--lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb6
-rw-r--r--lib/gitlab/background_migration/prepare_untracked_uploads.rb2
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb2
-rw-r--r--lib/gitlab/bitbucket_server_import/importer.rb2
-rw-r--r--lib/gitlab/checks/branch_check.rb20
-rw-r--r--lib/gitlab/checks/diff_check.rb4
-rw-r--r--lib/gitlab/checks/lfs_check.rb4
-rw-r--r--lib/gitlab/checks/push_check.rb2
-rw-r--r--lib/gitlab/checks/tag_check.rb12
-rw-r--r--lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb2
-rw-r--r--lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb2
-rw-r--r--lib/gitlab/ci/build/artifacts/metadata.rb10
-rw-r--r--lib/gitlab/ci/build/artifacts/path.rb4
-rw-r--r--lib/gitlab/ci/config/entry/cache.rb6
-rw-r--r--lib/gitlab/ci/config/entry/global.rb14
-rw-r--r--lib/gitlab/ci/config/entry/job.rb28
-rw-r--r--lib/gitlab/ci/config/extendable/entry.rb2
-rw-r--r--lib/gitlab/ci/config/external/file/base.rb2
-rw-r--r--lib/gitlab/ci/parsers/test/junit.rb4
-rw-r--r--lib/gitlab/ci/pipeline/chain/populate.rb4
-rw-r--r--lib/gitlab/ci/pipeline/chain/validate/abilities.rb2
-rw-r--r--lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb4
-rw-r--r--lib/gitlab/ci/pipeline/expression/lexer.rb4
-rw-r--r--lib/gitlab/ci/pipeline/expression/statement.rb2
-rw-r--r--lib/gitlab/ci/trace.rb8
-rw-r--r--lib/gitlab/ci/trace/chunked_io.rb4
-rw-r--r--lib/gitlab/cleanup/project_upload_file_finder.rb2
-rw-r--r--lib/gitlab/config/entry/attributable.rb2
-rw-r--r--lib/gitlab/config/entry/simplifiable.rb2
-rw-r--r--lib/gitlab/config/loader/yaml.rb2
-rw-r--r--lib/gitlab/database/median.rb2
-rw-r--r--lib/gitlab/database/migration_helpers.rb6
-rw-r--r--lib/gitlab/database/read_only_relation.rb2
-rw-r--r--lib/gitlab/database/rename_reserved_paths_migration/v1/migration_classes.rb2
-rw-r--r--lib/gitlab/ee_compat_check.rb2
-rw-r--r--lib/gitlab/email/message/repository_push.rb2
-rw-r--r--lib/gitlab/etag_caching/store.rb2
-rw-r--r--lib/gitlab/exclusive_lease_helpers.rb4
-rw-r--r--lib/gitlab/git/bundle_file.rb2
-rw-r--r--lib/gitlab/git/commit.rb4
-rw-r--r--lib/gitlab/git/diff.rb2
-rw-r--r--lib/gitlab/git/hook_env.rb2
-rw-r--r--lib/gitlab/git/push.rb2
-rw-r--r--lib/gitlab/git/repository.rb6
-rw-r--r--lib/gitlab/git_access.rb26
-rw-r--r--lib/gitlab/git_access_wiki.rb4
-rw-r--r--lib/gitlab/graphql/authorize/authorize_resource.rb2
-rw-r--r--lib/gitlab/http_io.rb2
-rw-r--r--lib/gitlab/i18n/po_linter.rb2
-rw-r--r--lib/gitlab/issuable_metadata.rb2
-rw-r--r--lib/gitlab/kubernetes/helm/base_command.rb6
-rw-r--r--lib/gitlab/legacy_github_import/client.rb2
-rw-r--r--lib/gitlab/legacy_github_import/importer.rb2
-rw-r--r--lib/gitlab/lfs_token.rb2
-rw-r--r--lib/gitlab/manifest_import/manifest.rb6
-rw-r--r--lib/gitlab/metrics/influx_db.rb2
-rw-r--r--lib/gitlab/metrics/methods.rb2
-rw-r--r--lib/gitlab/omniauth_initializer.rb2
-rw-r--r--lib/gitlab/popen.rb2
-rw-r--r--lib/gitlab/project_template.rb6
-rw-r--r--lib/gitlab/prometheus_client.rb8
-rw-r--r--lib/gitlab/query_limiting.rb2
-rw-r--r--lib/gitlab/route_map.rb10
-rw-r--r--lib/gitlab/setup_helper.rb6
-rw-r--r--lib/gitlab/sherlock/line_profiler.rb2
-rw-r--r--lib/gitlab/task_helpers.rb2
-rw-r--r--lib/gitlab/tracing/factory.rb2
-rw-r--r--lib/gitlab/untrusted_regexp.rb2
-rw-r--r--lib/gitlab/url_blocker.rb16
-rw-r--r--lib/gitlab/utils.rb4
-rw-r--r--lib/gitlab/workhorse.rb2
76 files changed, 175 insertions, 175 deletions
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)