This instance will be upgraded to Heptapod 0.27.1 on 2021-12-02 at 15:00 UTC+1 (a few minutes of down time)

Commit 24cd699f authored by Martin Wortschack's avatar Martin Wortschack Committed by Nick Thomas
Browse files

Externalize strings in app/models

- Update PO file
parent 9990e4aa96f0
...@@ -198,7 +198,7 @@ class ApplicationSetting < ApplicationRecord ...@@ -198,7 +198,7 @@ class ApplicationSetting < ApplicationRecord
validates_each :restricted_visibility_levels do |record, attr, value| validates_each :restricted_visibility_levels do |record, attr, value|
value&.each do |level| value&.each do |level|
unless Gitlab::VisibilityLevel.options.value?(level) unless Gitlab::VisibilityLevel.options.value?(level)
record.errors.add(attr, "'#{level}' is not a valid visibility level") record.errors.add(attr, _("'%{level}' is not a valid visibility level") % { level: level })
end end
end end
end end
...@@ -206,7 +206,7 @@ class ApplicationSetting < ApplicationRecord ...@@ -206,7 +206,7 @@ class ApplicationSetting < ApplicationRecord
validates_each :import_sources do |record, attr, value| validates_each :import_sources do |record, attr, value|
value&.each do |source| value&.each do |source|
unless Gitlab::ImportSources.options.value?(source) unless Gitlab::ImportSources.options.value?(source)
record.errors.add(attr, "'#{source}' is not a import source") record.errors.add(attr, _("'%{source}' is not a import source") % { source: source })
end end
end end
end end
......
...@@ -22,7 +22,7 @@ def self.build_hierarchy(descendants, hierarchy_top = nil) ...@@ -22,7 +22,7 @@ def self.build_hierarchy(descendants, hierarchy_top = nil)
return [] if descendants.empty? return [] if descendants.empty?
unless descendants.all? { |hierarchy| hierarchy.is_a?(GroupDescendant) } unless descendants.all? { |hierarchy| hierarchy.is_a?(GroupDescendant) }
raise ArgumentError.new('element is not a hierarchy') raise ArgumentError.new(_('element is not a hierarchy'))
end end
all_hierarchies = descendants.map do |descendant| all_hierarchies = descendants.map do |descendant|
...@@ -56,7 +56,7 @@ def expand_hierarchy_for_child(child, hierarchy, hierarchy_top, preloaded) ...@@ -56,7 +56,7 @@ def expand_hierarchy_for_child(child, hierarchy, hierarchy_top, preloaded)
end end
if parent.nil? && hierarchy_top.present? if parent.nil? && hierarchy_top.present?
raise ArgumentError.new('specified top is not part of the tree') raise ArgumentError.new(_('specified top is not part of the tree'))
end end
if parent && parent != hierarchy_top if parent && parent != hierarchy_top
......
...@@ -41,7 +41,7 @@ def reset_token!(instance) ...@@ -41,7 +41,7 @@ def reset_token!(instance)
def self.fabricate(model, field, options) def self.fabricate(model, field, options)
if options[:digest] && options[:encrypted] if options[:digest] && options[:encrypted]
raise ArgumentError, 'Incompatible options set!' raise ArgumentError, _('Incompatible options set!')
end end
if options[:digest] if options[:digest]
......
...@@ -13,7 +13,7 @@ def find_token_authenticatable(token, unscoped = false) ...@@ -13,7 +13,7 @@ def find_token_authenticatable(token, unscoped = false)
elsif migrating? elsif migrating?
find_by_plaintext_token(token, unscoped) find_by_plaintext_token(token, unscoped)
else else
raise ArgumentError, "Unknown encryption strategy: #{encrypted_strategy}!" raise ArgumentError, _("Unknown encryption strategy: %{encrypted_strategy}!") % { encrypted_strategy: encrypted_strategy }
end end
end end
...@@ -32,7 +32,7 @@ def ensure_token(instance) ...@@ -32,7 +32,7 @@ def ensure_token(instance)
return super if instance.has_attribute?(encrypted_field) return super if instance.has_attribute?(encrypted_field)
if required? if required?
raise ArgumentError, 'Using required encryption strategy when encrypted field is missing!' raise ArgumentError, _('Using required encryption strategy when encrypted field is missing!')
else else
insecure_strategy.ensure_token(instance) insecure_strategy.ensure_token(instance)
end end
...@@ -74,7 +74,7 @@ def encrypted_strategy ...@@ -74,7 +74,7 @@ def encrypted_strategy
value = value.call if value.is_a?(Proc) value = value.call if value.is_a?(Proc)
unless value.in?([:required, :optional, :migrating]) unless value.in?([:required, :optional, :migrating])
raise ArgumentError, 'encrypted: needs to be a :required, :optional or :migrating!' raise ArgumentError, _('encrypted: needs to be a :required, :optional or :migrating!')
end end
value value
......
...@@ -291,22 +291,22 @@ def uniqueness_of_title ...@@ -291,22 +291,22 @@ def uniqueness_of_title
end end
title_exists = relation.find_by_title(title) title_exists = relation.find_by_title(title)
errors.add(:title, "already being used for another group or project milestone.") if title_exists errors.add(:title, _("already being used for another group or project milestone.")) if title_exists
end end
# Milestone should be either a project milestone or a group milestone # Milestone should be either a project milestone or a group milestone
def milestone_type_check def milestone_type_check
if group_id && project_id if group_id && project_id
field = project_id_changed? ? :project_id : :group_id field = project_id_changed? ? :project_id : :group_id
errors.add(field, "milestone should belong either to a project or a group.") errors.add(field, _("milestone should belong either to a project or a group."))
end end
end end
def milestone_format_reference(format = :iid) def milestone_format_reference(format = :iid)
raise ArgumentError, 'Unknown format' unless [:iid, :name].include?(format) raise ArgumentError, _('Unknown format') unless [:iid, :name].include?(format)
if group_milestone? && format == :iid if group_milestone? && format == :iid
raise ArgumentError, 'Cannot refer to a group milestone by an internal id!' raise ArgumentError, _('Cannot refer to a group milestone by an internal id!')
end end
if format == :name && !name.include?('"') if format == :name && !name.include?('"')
...@@ -322,7 +322,7 @@ def sanitize_title(value) ...@@ -322,7 +322,7 @@ def sanitize_title(value)
def start_date_should_be_less_than_due_date def start_date_should_be_less_than_due_date
if due_date <= start_date if due_date <= start_date
errors.add(:due_date, "must be greater than start date") errors.add(:due_date, _("must be greater than start date"))
end end
end end
......
...@@ -313,7 +313,7 @@ class Project < ApplicationRecord ...@@ -313,7 +313,7 @@ class Project < ApplicationRecord
validates :description, length: { maximum: 2000 }, allow_blank: true validates :description, length: { maximum: 2000 }, allow_blank: true
validates :ci_config_path, validates :ci_config_path,
format: { without: %r{(\.{2}|\A/)}, format: { without: %r{(\.{2}|\A/)},
message: 'cannot include leading slash or directory traversal.' }, message: _('cannot include leading slash or directory traversal.') },
length: { maximum: 255 }, length: { maximum: 255 },
allow_blank: true allow_blank: true
validates :name, validates :name,
...@@ -420,13 +420,13 @@ class Project < ApplicationRecord ...@@ -420,13 +420,13 @@ class Project < ApplicationRecord
enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 } enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 }
chronic_duration_attr :build_timeout_human_readable, :build_timeout, chronic_duration_attr :build_timeout_human_readable, :build_timeout,
default: 3600, error_message: 'Maximum job timeout has a value which could not be accepted' default: 3600, error_message: _('Maximum job timeout has a value which could not be accepted')
validates :build_timeout, allow_nil: true, validates :build_timeout, allow_nil: true,
numericality: { greater_than_or_equal_to: 10.minutes, numericality: { greater_than_or_equal_to: 10.minutes,
less_than: 1.month, less_than: 1.month,
only_integer: true, only_integer: true,
message: 'needs to be beetween 10 minutes and 1 month' } message: _('needs to be beetween 10 minutes and 1 month') }
# Used by Projects::CleanupService to hold a map of rewritten object IDs # Used by Projects::CleanupService to hold a map of rewritten object IDs
mount_uploader :bfg_object_map, AttachmentUploader mount_uploader :bfg_object_map, AttachmentUploader
...@@ -850,7 +850,7 @@ def update_remote_mirrors ...@@ -850,7 +850,7 @@ def update_remote_mirrors
def mark_stuck_remote_mirrors_as_failed! def mark_stuck_remote_mirrors_as_failed!
remote_mirrors.stuck.update_all( remote_mirrors.stuck.update_all(
update_status: :failed, update_status: :failed,
last_error: 'The remote mirror took to long to complete.', last_error: _('The remote mirror took to long to complete.'),
last_update_at: Time.now last_update_at: Time.now
) )
end end
...@@ -887,14 +887,14 @@ def visibility_level_allowed_by_group ...@@ -887,14 +887,14 @@ def visibility_level_allowed_by_group
level_name = Gitlab::VisibilityLevel.level_name(self.visibility_level).downcase level_name = Gitlab::VisibilityLevel.level_name(self.visibility_level).downcase
group_level_name = Gitlab::VisibilityLevel.level_name(self.group.visibility_level).downcase group_level_name = Gitlab::VisibilityLevel.level_name(self.group.visibility_level).downcase
self.errors.add(:visibility_level, "#{level_name} is not allowed in a #{group_level_name} group.") self.errors.add(:visibility_level, _("%{level_name} is not allowed in a %{group_level_name} group.") % { level_name: level_name, group_level_name: group_level_name })
end end
def visibility_level_allowed_as_fork def visibility_level_allowed_as_fork
return if visibility_level_allowed_as_fork? return if visibility_level_allowed_as_fork?
level_name = Gitlab::VisibilityLevel.level_name(self.visibility_level).downcase level_name = Gitlab::VisibilityLevel.level_name(self.visibility_level).downcase
self.errors.add(:visibility_level, "#{level_name} is not allowed since the fork source project has lower visibility.") self.errors.add(:visibility_level, _("%{level_name} is not allowed since the fork source project has lower visibility.") % { level_name: level_name })
end end
def check_wiki_path_conflict def check_wiki_path_conflict
...@@ -903,7 +903,7 @@ def check_wiki_path_conflict ...@@ -903,7 +903,7 @@ def check_wiki_path_conflict
path_to_check = path.ends_with?('.wiki') ? path.chomp('.wiki') : "#{path}.wiki" path_to_check = path.ends_with?('.wiki') ? path.chomp('.wiki') : "#{path}.wiki"
if Project.where(namespace_id: namespace_id, path: path_to_check).exists? if Project.where(namespace_id: namespace_id, path: path_to_check).exists?
errors.add(:name, 'has already been taken') errors.add(:name, _('has already been taken'))
end end
end end
...@@ -923,7 +923,7 @@ def validate_pages_https_only ...@@ -923,7 +923,7 @@ def validate_pages_https_only
return unless pages_https_only? return unless pages_https_only?
unless pages_domains.all?(&:https?) unless pages_domains.all?(&:https?)
errors.add(:pages_https_only, "cannot be enabled unless all domains have TLS certificates") errors.add(:pages_https_only, _("cannot be enabled unless all domains have TLS certificates"))
end end
end end
...@@ -1203,7 +1203,7 @@ def execute_services(data, hooks_scope = :push_hooks) ...@@ -1203,7 +1203,7 @@ def execute_services(data, hooks_scope = :push_hooks)
def valid_repo? def valid_repo?
repository.exists? repository.exists?
rescue rescue
errors.add(:path, 'Invalid repository path') errors.add(:path, _('Invalid repository path'))
false false
end end
...@@ -1294,7 +1294,7 @@ def check_repository_path_availability ...@@ -1294,7 +1294,7 @@ def check_repository_path_availability
# Check if repository with same path already exists on disk we can # Check if repository with same path already exists on disk we can
# skip this for the hashed storage because the path does not change # skip this for the hashed storage because the path does not change
if legacy_storage? && repository_with_same_path_already_exists? if legacy_storage? && repository_with_same_path_already_exists?
errors.add(:base, 'There is already a repository with that name on disk') errors.add(:base, _('There is already a repository with that name on disk'))
return false return false
end end
...@@ -1316,7 +1316,7 @@ def create_repository(force: false) ...@@ -1316,7 +1316,7 @@ def create_repository(force: false)
repository.after_create repository.after_create
true true
else else
errors.add(:base, 'Failed to create repository via gitlab-shell') errors.add(:base, _('Failed to create repository via gitlab-shell'))
false false
end end
end end
...@@ -1392,7 +1392,7 @@ def change_head(branch) ...@@ -1392,7 +1392,7 @@ def change_head(branch)
ProjectCacheWorker.perform_async(self.id, [], [:commit_count]) ProjectCacheWorker.perform_async(self.id, [], [:commit_count])
reload_default_branch reload_default_branch
else else
errors.add(:base, "Could not change HEAD: branch '#{branch}' does not exist") errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch })
false false
end end
end end
...@@ -1444,7 +1444,7 @@ def create_wiki ...@@ -1444,7 +1444,7 @@ def create_wiki
ProjectWiki.new(self, self.owner).wiki ProjectWiki.new(self, self.owner).wiki
true true
rescue ProjectWiki::CouldNotCreateWikiError rescue ProjectWiki::CouldNotCreateWikiError
errors.add(:base, 'Failed create wiki') errors.add(:base, _('Failed create wiki'))
false false
end end
...@@ -1933,7 +1933,7 @@ def legacy_storage? ...@@ -1933,7 +1933,7 @@ def legacy_storage?
# #
# @param [Symbol] feature that needs to be rolled out for the project (:repository, :attachments) # @param [Symbol] feature that needs to be rolled out for the project (:repository, :attachments)
def hashed_storage?(feature) def hashed_storage?(feature)
raise ArgumentError, "Invalid feature" unless HASHED_STORAGE_FEATURES.include?(feature) raise ArgumentError, _("Invalid feature") unless HASHED_STORAGE_FEATURES.include?(feature)
self.storage_version && self.storage_version >= HASHED_STORAGE_FEATURES[feature] self.storage_version && self.storage_version >= HASHED_STORAGE_FEATURES[feature]
end end
...@@ -2165,7 +2165,7 @@ def check_repository_absence! ...@@ -2165,7 +2165,7 @@ def check_repository_absence!
return if skip_disk_validation return if skip_disk_validation
if repository_storage.blank? || repository_with_same_path_already_exists? if repository_storage.blank? || repository_with_same_path_already_exists?
errors.add(:base, 'There is already a repository with that name on disk') errors.add(:base, _('There is already a repository with that name on disk'))
throw :abort throw :abort
end end
end end
...@@ -2211,7 +2211,7 @@ def check_pending_delete ...@@ -2211,7 +2211,7 @@ def check_pending_delete
errors.delete(error) errors.delete(error)
end end
errors.add(:base, "The project is still being deleted. Please try again later.") errors.add(:base, _("The project is still being deleted. Please try again later."))
end end
def pending_delete_twin def pending_delete_twin
......
...@@ -14,7 +14,7 @@ class ProjectGroupLink < ApplicationRecord ...@@ -14,7 +14,7 @@ class ProjectGroupLink < ApplicationRecord
validates :project_id, presence: true validates :project_id, presence: true
validates :group, presence: true validates :group, presence: true
validates :group_id, uniqueness: { scope: [:project_id], message: "already shared with this group" } validates :group_id, uniqueness: { scope: [:project_id], message: _("already shared with this group") }
validates :group_access, presence: true validates :group_access, presence: true
validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true
validate :different_group validate :different_group
...@@ -44,7 +44,7 @@ def different_group ...@@ -44,7 +44,7 @@ def different_group
group_ids = project_group.ancestors.map(&:id).push(project_group.id) group_ids = project_group.ancestors.map(&:id).push(project_group.id)
if group_ids.include?(self.group.id) if group_ids.include?(self.group.id)
errors.add(:base, "Project cannot be shared with the group it is in or one of its ancestors.") errors.add(:base, _("Project cannot be shared with the group it is in or one of its ancestors."))
end end
end end
......
...@@ -11,7 +11,7 @@ def title ...@@ -11,7 +11,7 @@ def title
end end
def description def description
'Asana - Teamwork without email' s_('AsanaService|Asana - Teamwork without email')
end end
def help def help
...@@ -36,13 +36,13 @@ def fields ...@@ -36,13 +36,13 @@ def fields
{ {
type: 'text', type: 'text',
name: 'api_key', name: 'api_key',
placeholder: 'User Personal Access Token. User must have access to task, all comments will be attributed to this user.', placeholder: s_('AsanaService|User Personal Access Token. User must have access to task, all comments will be attributed to this user.'),
required: true required: true
}, },
{ {
type: 'text', type: 'text',
name: 'restrict_to_branch', name: 'restrict_to_branch',
placeholder: 'Comma-separated list of branches which will be automatically inspected. Leave blank to include all branches.' placeholder: s_('AsanaService|Comma-separated list of branches which will be automatically inspected. Leave blank to include all branches.')
} }
] ]
end end
...@@ -73,7 +73,7 @@ def execute(data) ...@@ -73,7 +73,7 @@ def execute(data)
project_name = project.full_name project_name = project.full_name
data[:commits].each do |commit| data[:commits].each do |commit|
push_msg = "#{user} pushed to branch #{branch} of #{project_name} ( #{commit[:url]} ):" push_msg = s_("AsanaService|%{user} pushed to branch %{branch} of %{project_name} ( %{commit_url} ):") % { user: user, branch: branch, project_name: project_name, commit_url: commit[:url] }
check_commit(commit[:message], push_msg) check_commit(commit[:message], push_msg)
end end
end end
......
...@@ -31,15 +31,15 @@ def reset_password ...@@ -31,15 +31,15 @@ def reset_password
end end
def title def title
'Atlassian Bamboo CI' s_('BambooService|Atlassian Bamboo CI')
end end
def description def description
'A continuous integration and build server' s_('BambooService|A continuous integration and build server')
end end
def help def help
'You must set up automatic revision labeling and a repository trigger in Bamboo.' s_('BambooService|You must set up automatic revision labeling and a repository trigger in Bamboo.')
end end
def self.to_param def self.to_param
...@@ -49,11 +49,11 @@ def self.to_param ...@@ -49,11 +49,11 @@ def self.to_param
def fields def fields
[ [
{ type: 'text', name: 'bamboo_url', { type: 'text', name: 'bamboo_url',
placeholder: 'Bamboo root URL like https://bamboo.example.com', required: true }, placeholder: s_('BambooService|Bamboo root URL like https://bamboo.example.com'), required: true },
{ type: 'text', name: 'build_key', { type: 'text', name: 'build_key',
placeholder: 'Bamboo build plan key like KEY', required: true }, placeholder: s_('BambooService|Bamboo build plan key like KEY'), required: true },
{ type: 'text', name: 'username', { type: 'text', name: 'username',
placeholder: 'A user with API access, if applicable' }, placeholder: s_('BambooService|A user with API access, if applicable') },
{ type: 'password', name: 'password' } { type: 'password', name: 'password' }
] ]
end end
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
class DiscordService < ChatNotificationService class DiscordService < ChatNotificationService
def title def title
"Discord Notifications" s_("DiscordService|Discord Notifications")
end end
def description def description
"Receive event notifications in Discord" s_("DiscordService|Receive event notifications in Discord")
end end
def self.to_param def self.to_param
......
...@@ -7,11 +7,11 @@ class EmailsOnPushService < Service ...@@ -7,11 +7,11 @@ class EmailsOnPushService < Service
validates :recipients, presence: true, if: :valid_recipients? validates :recipients, presence: true, if: :valid_recipients?
def title def title
'Emails on push' s_('EmailsOnPushService|Emails on push')
end end
def description def description
'Email the commits and diff of each push to a list of recipients.' s_('EmailsOnPushService|Email the commits and diff of each push to a list of recipients.')
end end
def self.to_param def self.to_param
...@@ -45,11 +45,11 @@ def disable_diffs? ...@@ -45,11 +45,11 @@ def disable_diffs?
def fields def fields
domains = Notify.allowed_email_domains.map { |domain| "user@#{domain}" }.join(", ") domains = Notify.allowed_email_domains.map { |domain| "user@#{domain}" }.join(", ")
[ [
{ type: 'checkbox', name: 'send_from_committer_email', title: "Send from committer", { type: 'checkbox', name: 'send_from_committer_email', title: s_("EmailsOnPushService|Send from committer"),
help: "Send notifications from the committer's email address if the domain is part of the domain GitLab is running on (e.g. #{domains})." }, help: s_("EmailsOnPushService|Send notifications from the committer's email address if the domain is part of the domain GitLab is running on (e.g. %{domains}).") % { domains: domains } },
{ type: 'checkbox', name: 'disable_diffs', title: "Disable code diffs", { type: 'checkbox', name: 'disable_diffs', title: s_("EmailsOnPushService|Disable code diffs"),
help: "Don't include possibly sensitive code diffs in notification body." }, help: s_("EmailsOnPushService|Don't include possibly sensitive code diffs in notification body.") },
{ type: 'textarea', name: 'recipients', placeholder: 'Emails separated by whitespace' } { type: 'textarea', name: 'recipients', placeholder: s_('EmailsOnPushService|Emails separated by whitespace') }
] ]
end end
end end
...@@ -6,11 +6,11 @@ class ExternalWikiService < Service ...@@ -6,11 +6,11 @@ class ExternalWikiService < Service
validates :external_wiki_url, presence: true, public_url: true, if: :activated? validates :external_wiki_url, presence: true, public_url: true, if: :activated?
def title def title
'External Wiki' s_('ExternalWikiService|External Wiki')
end end
def description def description
'Replaces the link to the internal wiki with a link to an external wiki.' s_('ExternalWikiService|Replaces the link to the internal wiki with a link to an external wiki.')
end end
def self.to_param def self.to_param
...@@ -19,7 +19,7 @@ def self.to_param ...@@ -19,7 +19,7 @@ def self.to_param
def fields def fields
[ [
{ type: 'text', name: 'external_wiki_url', placeholder: 'The URL of the external Wiki', required: true } { type: 'text', name: 'external_wiki_url', placeholder: s_('ExternalWikiService|The URL of the external Wiki'), required: true }
] ]
end end