Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Wortschack <mwortschack@gitlab.com>2019-04-15 22:24:28 +0300
committerMartin Wortschack <mwortschack@gitlab.com>2019-04-15 22:24:47 +0300
commitff80dce23949b1a44d6cfa6bb084cea6c4e12b88 (patch)
tree945409d1ceafe528624b7c29a11b4c481f0805dc /lib/gitlab/quick_actions
parent1a50801cd0801d3134b41e96ff2a6b27a96a1047 (diff)
Externalize strings in lib/gitlab/quick_actions
- Externalize strings for desc and explanation - Update PO file
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r--lib/gitlab/quick_actions/commit_actions.rb9
-rw-r--r--lib/gitlab/quick_actions/issuable_actions.rb32
-rw-r--r--lib/gitlab/quick_actions/issue_actions.rb33
-rw-r--r--lib/gitlab/quick_actions/issue_and_merge_request_actions.rb46
4 files changed, 63 insertions, 57 deletions
diff --git a/lib/gitlab/quick_actions/commit_actions.rb b/lib/gitlab/quick_actions/commit_actions.rb
index 62c0fbb5afd..1018910e8e9 100644
--- a/lib/gitlab/quick_actions/commit_actions.rb
+++ b/lib/gitlab/quick_actions/commit_actions.rb
@@ -8,10 +8,13 @@ module Gitlab
included do
# Commit only quick actions definitions
- desc 'Tag this commit.'
+ desc _('Tag this commit.')
explanation do |tag_name, message|
- with_message = %{ with "#{message}"} if message.present?
- "Tags this commit to #{tag_name}#{with_message}."
+ if message.present?
+ _("Tags this commit to %{tag_name} with \"%{message}\".") % { tag_name: tag_name, message: message }
+ else
+ _("Tags this commit to %{tag_name}.") % { tag_name: tag_name }
+ end
end
params 'v1.2.3 <message>'
parse_params do |tag_name_and_message|
diff --git a/lib/gitlab/quick_actions/issuable_actions.rb b/lib/gitlab/quick_actions/issuable_actions.rb
index ad2e15d19fa..572c55efcc2 100644
--- a/lib/gitlab/quick_actions/issuable_actions.rb
+++ b/lib/gitlab/quick_actions/issuable_actions.rb
@@ -43,9 +43,9 @@ module Gitlab
@updates[:state_event] = 'reopen'
end
- desc 'Change title'
+ desc _('Change title')
explanation do |title_param|
- "Changes the title to \"#{title_param}\"."
+ _("Changes the title to \"%{title_param}\".") % { title_param: title_param }
end
params '<New title>'
types Issuable
@@ -57,7 +57,7 @@ module Gitlab
@updates[:title] = title_param
end
- desc 'Add label(s)'
+ desc _('Add label(s)')
explanation do |labels_param|
labels = find_label_references(labels_param)
@@ -81,13 +81,13 @@ module Gitlab
end
end
- desc 'Remove all or specific label(s)'
+ desc _('Remove all or specific label(s)')
explanation do |labels_param = nil|
if labels_param.present?
labels = find_label_references(labels_param)
"Removes #{labels.join(' ')} #{'label'.pluralize(labels.count)}." if labels.any?
else
- 'Removes all labels.'
+ _('Removes all labels.')
end
end
params '~label1 ~"label 2"'
@@ -112,7 +112,7 @@ module Gitlab
end
end
- desc 'Replace all label(s)'
+ desc _('Replace all label(s)')
explanation do |labels_param|
labels = find_label_references(labels_param)
"Replaces all labels with #{labels.join(' ')} #{'label'.pluralize(labels.count)}." if labels.any?
@@ -135,8 +135,8 @@ module Gitlab
end
end
- desc 'Add a todo'
- explanation 'Adds a todo.'
+ desc _('Add a todo')
+ explanation _('Adds a todo.')
types Issuable
condition do
quick_action_target.persisted? &&
@@ -146,8 +146,8 @@ module Gitlab
@updates[:todo_event] = 'add'
end
- desc 'Mark todo as done'
- explanation 'Marks todo as done.'
+ desc _('Mark todo as done')
+ explanation _('Marks todo as done.')
types Issuable
condition do
quick_action_target.persisted? &&
@@ -157,7 +157,7 @@ module Gitlab
@updates[:todo_event] = 'done'
end
- desc 'Subscribe'
+ desc _('Subscribe')
explanation do
"Subscribes to this #{quick_action_target.to_ability_name.humanize(capitalize: false)}."
end
@@ -170,7 +170,7 @@ module Gitlab
@updates[:subscription_event] = 'subscribe'
end
- desc 'Unsubscribe'
+ desc _('Unsubscribe')
explanation do
"Unsubscribes from this #{quick_action_target.to_ability_name.humanize(capitalize: false)}."
end
@@ -183,9 +183,9 @@ module Gitlab
@updates[:subscription_event] = 'unsubscribe'
end
- desc 'Toggle emoji award'
+ desc _('Toggle emoji award')
explanation do |name|
- "Toggles :#{name}: emoji award." if name
+ _("Toggles :%{name}: emoji award.") % { name: name } if name
end
params ':emoji:'
types Issuable
@@ -202,14 +202,14 @@ module Gitlab
end
end
- desc "Append the comment with #{SHRUG}"
+ desc _("Append the comment with %{shrug}") % { shrug: SHRUG }
params '<Comment>'
types Issuable
substitution :shrug do |comment|
"#{comment} #{SHRUG}"
end
- desc "Append the comment with #{TABLEFLIP}"
+ desc _("Append the comment with %{TABLEFLIP}") % { tableflip: TABLEFLIP }
params '<Comment>'
types Issuable
substitution :tableflip do |comment|
diff --git a/lib/gitlab/quick_actions/issue_actions.rb b/lib/gitlab/quick_actions/issue_actions.rb
index 1f08e8740a2..85e62f950c8 100644
--- a/lib/gitlab/quick_actions/issue_actions.rb
+++ b/lib/gitlab/quick_actions/issue_actions.rb
@@ -8,9 +8,9 @@ module Gitlab
included do
# Issue only quick actions definition
- desc 'Set due date'
+ desc _('Set due date')
explanation do |due_date|
- "Sets the due date to #{due_date.to_s(:medium)}." if due_date
+ _("Sets the due date to %{due_date}.") % { due_date: due_date.strftime('%b %-d, %Y') } if due_date
end
params '<in 2 days | this Friday | December 31st>'
types Issue
@@ -25,8 +25,8 @@ module Gitlab
@updates[:due_date] = due_date if due_date
end
- desc 'Remove due date'
- explanation 'Removes the due date.'
+ desc _('Remove due date')
+ explanation _('Removes the due date.')
types Issue
condition do
quick_action_target.persisted? &&
@@ -38,10 +38,10 @@ module Gitlab
@updates[:due_date] = nil
end
- desc 'Move issue from one column of the board to another'
+ desc _('Move issue from one column of the board to another')
explanation do |target_list_name|
label = find_label_references(target_list_name).first
- "Moves issue to #{label} column in the board." if label
+ _("Moves issue to %{label} column in the board.") % { label: label } if label
end
params '~"Target column"'
types Issue
@@ -66,9 +66,9 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
- desc 'Mark this issue as a duplicate of another issue'
+ desc _('Mark this issue as a duplicate of another issue')
explanation do |duplicate_reference|
- "Marks this issue as a duplicate of #{duplicate_reference}."
+ _("Marks this issue as a duplicate of %{duplicate_reference}.") % { duplicate_reference: duplicate_reference }
end
params '#issue'
types Issue
@@ -84,9 +84,9 @@ module Gitlab
end
end
- desc 'Move this issue to another project.'
+ desc _('Move this issue to another project.')
explanation do |path_to_project|
- "Moves this issue to #{path_to_project}."
+ _("Moves this issue to %{path_to_project}.") % { path_to_project: path_to_project }
end
params 'path/to/project'
types Issue
@@ -102,9 +102,9 @@ module Gitlab
end
end
- desc 'Make issue confidential.'
+ desc _('Make issue confidential.')
explanation do
- 'Makes this issue confidential'
+ _('Makes this issue confidential')
end
types Issue
condition do
@@ -114,10 +114,13 @@ module Gitlab
@updates[:confidential] = true
end
- desc 'Create a merge request.'
+ desc _('Create a merge request.')
explanation do |branch_name = nil|
- branch_text = branch_name ? "branch '#{branch_name}'" : 'a branch'
- "Creates #{branch_text} and a merge request to resolve this issue"
+ if branch_name
+ _("Creates branch '%{branch_name}' and a merge request to resolve this issue") % { branch_name: branch_name }
+ else
+ "Creates a branch and a merge request to resolve this issue"
+ end
end
params "<branch name>"
types Issue
diff --git a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
index 08872eda410..1cd158db2b0 100644
--- a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
+++ b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
@@ -8,7 +8,7 @@ module Gitlab
included do
# Issue, MergeRequest: quick actions definitions
- desc 'Assign'
+ desc _('Assign')
# rubocop: disable CodeReuse/ActiveRecord
explanation do |users|
users = quick_action_target.allows_multiple_assignees? ? users : users.take(1)
@@ -38,9 +38,9 @@ module Gitlab
desc do
if quick_action_target.allows_multiple_assignees?
- 'Remove all or specific assignee(s)'
+ _('Remove all or specific assignee(s)')
else
- 'Remove assignee'
+ _('Remove assignee')
end
end
explanation do |users = nil|
@@ -70,9 +70,9 @@ module Gitlab
end
end
- desc 'Set milestone'
+ desc _('Set milestone')
explanation do |milestone|
- "Sets the milestone to #{milestone.to_reference}." if milestone
+ _("Sets the milestone to %{milestone_reference}.") % { milestone_reference: milestone.to_reference } if milestone
end
params '%"milestone"'
types Issue, MergeRequest
@@ -88,9 +88,9 @@ module Gitlab
@updates[:milestone_id] = milestone.id if milestone
end
- desc 'Remove milestone'
+ desc _('Remove milestone')
explanation do
- "Removes #{quick_action_target.milestone.to_reference(format: :name)} milestone."
+ _("Removes %{milestone_reference} milestone.") % { milestone_reference: quick_action_target.milestone.to_reference(format: :name) }
end
types Issue, MergeRequest
condition do
@@ -102,9 +102,9 @@ module Gitlab
@updates[:milestone_id] = nil
end
- desc 'Copy labels and milestone from other issue or merge request'
+ desc _('Copy labels and milestone from other issue or merge request')
explanation do |source_issuable|
- "Copy labels and milestone from #{source_issuable.to_reference}."
+ _("Copy labels and milestone from %{source_issuable_reference}.") % { source_issuable_reference: source_issuable.to_reference }
end
params '#issue | !merge_request'
types Issue, MergeRequest
@@ -122,11 +122,11 @@ module Gitlab
end
end
- desc 'Set time estimate'
+ desc _('Set time estimate')
explanation do |time_estimate|
time_estimate = Gitlab::TimeTrackingFormatter.output(time_estimate)
- "Sets time estimate to #{time_estimate}." if time_estimate
+ _("Sets time estimate to %{time_estimate}.") % { time_estimate: time_estimate } if time_estimate
end
params '<1w 3d 2h 14m>'
types Issue, MergeRequest
@@ -142,18 +142,18 @@ module Gitlab
end
end
- desc 'Add or subtract spent time'
+ desc _('Add or subtract spent time')
explanation do |time_spent, time_spent_date|
if time_spent
if time_spent > 0
- verb = 'Adds'
+ verb = _('Adds')
value = time_spent
else
- verb = 'Subtracts'
+ verb = _('Subtracts')
value = -time_spent
end
- "#{verb} #{Gitlab::TimeTrackingFormatter.output(value)} spent time."
+ _("%{verb} %{time_spent_value} spent time.") % { verb: verb, time_spent_value: Gitlab::TimeTrackingFormatter.output(value) }
end
end
params '<time(1h30m | -1h30m)> <date(YYYY-MM-DD)>'
@@ -174,8 +174,8 @@ module Gitlab
end
end
- desc 'Remove time estimate'
- explanation 'Removes time estimate.'
+ desc _('Remove time estimate')
+ explanation _('Removes time estimate.')
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&
@@ -185,8 +185,8 @@ module Gitlab
@updates[:time_estimate] = 0
end
- desc 'Remove spent time'
- explanation 'Removes spent time.'
+ desc _('Remove spent time')
+ explanation _('Removes spent time.')
condition do
quick_action_target.persisted? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project)
@@ -196,8 +196,8 @@ module Gitlab
@updates[:spend_time] = { duration: :reset, user_id: current_user.id }
end
- desc "Lock the discussion"
- explanation "Locks the discussion"
+ desc _("Lock the discussion")
+ explanation _("Locks the discussion")
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&
@@ -208,8 +208,8 @@ module Gitlab
@updates[:discussion_locked] = true
end
- desc "Unlock the discussion"
- explanation "Unlocks the discussion"
+ desc _("Unlock the discussion")
+ explanation _("Unlocks the discussion")
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&