From ff80dce23949b1a44d6cfa6bb084cea6c4e12b88 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Mon, 15 Apr 2019 21:24:28 +0200 Subject: Externalize strings in lib/gitlab/quick_actions - Externalize strings for desc and explanation - Update PO file --- lib/gitlab/quick_actions/commit_actions.rb | 9 +- lib/gitlab/quick_actions/issuable_actions.rb | 32 ++--- lib/gitlab/quick_actions/issue_actions.rb | 33 +++-- .../issue_and_merge_request_actions.rb | 46 +++--- locale/gitlab.pot | 159 +++++++++++++++++++++ 5 files changed, 222 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 ' 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 '' 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 '' types Issuable substitution :shrug do |comment| "#{comment} #{SHRUG}" end - desc "Append the comment with #{TABLEFLIP}" + desc _("Append the comment with %{TABLEFLIP}") % { tableflip: TABLEFLIP } params '' 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 '' 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 "" 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 ' ' @@ -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? && diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 674a1d924f2..c2e1f3dcce3 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -209,6 +209,9 @@ msgstr "" msgid "%{user_name} profile page" msgstr "" +msgid "%{verb} %{time_spent_value} spent time." +msgstr "" + msgid "'%{level}' is not a valid visibility level" msgstr "" @@ -486,6 +489,9 @@ msgstr "" msgid "Add a task list" msgstr "" +msgid "Add a todo" +msgstr "" + msgid "Add bold text" msgstr "" @@ -498,6 +504,9 @@ msgstr "" msgid "Add italic text" msgstr "" +msgid "Add label(s)" +msgstr "" + msgid "Add license" msgstr "" @@ -510,6 +519,9 @@ msgstr "" msgid "Add new directory" msgstr "" +msgid "Add or subtract spent time" +msgstr "" + msgid "Add reaction" msgstr "" @@ -537,6 +549,12 @@ msgstr "" msgid "Adding new applications is disabled in your GitLab instance. Please contact your GitLab administrator to get the permission" msgstr "" +msgid "Adds" +msgstr "" + +msgid "Adds a todo." +msgstr "" + msgid "Admin Area" msgstr "" @@ -897,6 +915,12 @@ msgstr "" msgid "Appearance was successfully updated." msgstr "" +msgid "Append the comment with %{TABLEFLIP}" +msgstr "" + +msgid "Append the comment with %{shrug}" +msgstr "" + msgid "Application" msgstr "" @@ -1014,6 +1038,9 @@ msgstr "" msgid "Assets" msgstr "" +msgid "Assign" +msgstr "" + msgid "Assign custom color like #FF0000" msgstr "" @@ -1590,6 +1617,9 @@ msgstr "" msgid "Change this value to influence how frequently the GitLab UI polls for updates." msgstr "" +msgid "Change title" +msgstr "" + msgid "ChangeTypeActionLabel|Pick into branch" msgstr "" @@ -1614,6 +1644,9 @@ msgstr "" msgid "Changes suppressed. Click to show." msgstr "" +msgid "Changes the title to \"%{title_param}\"." +msgstr "" + msgid "Charts" msgstr "" @@ -2633,6 +2666,12 @@ msgstr "" msgid "Copy file path to clipboard" msgstr "" +msgid "Copy labels and milestone from %{source_issuable_reference}." +msgstr "" + +msgid "Copy labels and milestone from other issue or merge request" +msgstr "" + msgid "Copy link" msgstr "" @@ -2690,6 +2729,9 @@ msgstr "" msgid "Create a GitLab account first, and then connect it to your %{label} account." msgstr "" +msgid "Create a merge request." +msgstr "" + msgid "Create a new branch" msgstr "" @@ -2786,6 +2828,9 @@ msgstr "" msgid "Created on:" msgstr "" +msgid "Creates branch '%{branch_name}' and a merge request to resolve this issue" +msgstr "" + msgid "Cron Timezone" msgstr "" @@ -5271,6 +5316,9 @@ msgstr "" msgid "Lock not found" msgstr "" +msgid "Lock the discussion" +msgstr "" + msgid "Lock this %{issuableDisplayName}? Only project members will be able to comment." msgstr "" @@ -5283,6 +5331,9 @@ msgstr "" msgid "Locked to current projects" msgstr "" +msgid "Locks the discussion" +msgstr "" + msgid "Logo was successfully removed." msgstr "" @@ -5295,9 +5346,15 @@ msgstr "" msgid "MRDiff|Show full file" msgstr "" +msgid "Make issue confidential." +msgstr "" + msgid "Make sure you're logged into the account that owns the projects you'd like to import." msgstr "" +msgid "Makes this issue confidential" +msgstr "" + msgid "Manage Git repositories with fine-grained access controls that keep your code secure. Perform code reviews and enhance collaboration with merge requests. Each project can also have an issue tracker and a wiki." msgstr "" @@ -5355,6 +5412,9 @@ msgstr "" msgid "March" msgstr "" +msgid "Mark this issue as a duplicate of another issue" +msgstr "" + msgid "Mark todo as done" msgstr "" @@ -5367,6 +5427,12 @@ msgstr "" msgid "Markdown enabled" msgstr "" +msgid "Marks this issue as a duplicate of %{duplicate_reference}." +msgstr "" + +msgid "Marks todo as done." +msgstr "" + msgid "Max access level" msgstr "" @@ -5670,12 +5736,24 @@ msgstr "" msgid "Move issue" msgstr "" +msgid "Move issue from one column of the board to another" +msgstr "" + +msgid "Move this issue to another project." +msgstr "" + msgid "MoveIssue|Cannot move issue due to insufficient permissions!" msgstr "" msgid "MoveIssue|Cannot move issue to project it originates from!" msgstr "" +msgid "Moves issue to %{label} column in the board." +msgstr "" + +msgid "Moves this issue to %{path_to_project}." +msgstr "" + msgid "Multiple model types found: %{model_types}" msgstr "" @@ -7293,33 +7371,69 @@ msgstr "" msgid "Remove Runner" msgstr "" +msgid "Remove all or specific assignee(s)" +msgstr "" + +msgid "Remove all or specific label(s)" +msgstr "" + +msgid "Remove assignee" +msgstr "" + msgid "Remove avatar" msgstr "" +msgid "Remove due date" +msgstr "" + msgid "Remove fork relationship" msgstr "" msgid "Remove group" msgstr "" +msgid "Remove milestone" +msgstr "" + msgid "Remove priority" msgstr "" msgid "Remove project" msgstr "" +msgid "Remove spent time" +msgstr "" + msgid "Remove this label? Are you sure?" msgstr "" msgid "Remove this label? This will affect all projects within the group. Are you sure?" msgstr "" +msgid "Remove time estimate" +msgstr "" + msgid "Removed group can not be restored!" msgstr "" msgid "Removed projects cannot be restored!" msgstr "" +msgid "Removes %{milestone_reference} milestone." +msgstr "" + +msgid "Removes all labels." +msgstr "" + +msgid "Removes spent time." +msgstr "" + +msgid "Removes the due date." +msgstr "" + +msgid "Removes time estimate." +msgstr "" + msgid "Removing group will cause all child projects and resources to be removed." msgstr "" @@ -7341,6 +7455,9 @@ msgstr "" msgid "Replace" msgstr "" +msgid "Replace all label(s)" +msgstr "" + msgid "Reply to comment" msgstr "" @@ -7880,9 +7997,15 @@ msgstr "" msgid "Set default and restrict visibility levels. Configure import sources and git access protocol." msgstr "" +msgid "Set due date" +msgstr "" + msgid "Set max session time for web terminal." msgstr "" +msgid "Set milestone" +msgstr "" + msgid "Set new password" msgstr "" @@ -7901,6 +8024,9 @@ msgstr "" msgid "Set the maximum file size for each job's artifacts" msgstr "" +msgid "Set time estimate" +msgstr "" + msgid "Set up CI/CD" msgstr "" @@ -7946,6 +8072,15 @@ msgstr "" msgid "SetStatusModal|What's your status?" msgstr "" +msgid "Sets the due date to %{due_date}." +msgstr "" + +msgid "Sets the milestone to %{milestone_reference}." +msgstr "" + +msgid "Sets time estimate to %{time_estimate}." +msgstr "" + msgid "Settings" msgstr "" @@ -8419,6 +8554,9 @@ msgstr "" msgid "Subscribed" msgstr "" +msgid "Subtracts" +msgstr "" + msgid "Successfully blocked" msgstr "" @@ -8485,12 +8623,21 @@ msgstr "" msgid "Tag list:" msgstr "" +msgid "Tag this commit." +msgstr "" + msgid "Tags" msgstr "" msgid "Tags feed" msgstr "" +msgid "Tags this commit to %{tag_name} with \"%{message}\"." +msgstr "" + +msgid "Tags this commit to %{tag_name}." +msgstr "" + msgid "Tags:" msgstr "" @@ -9397,6 +9544,9 @@ msgstr "" msgid "Toggle discussion" msgstr "" +msgid "Toggle emoji award" +msgstr "" + msgid "Toggle navigation" msgstr "" @@ -9406,6 +9556,9 @@ msgstr "" msgid "ToggleButton|Toggle Status: ON" msgstr "" +msgid "Toggles :%{name}: emoji award." +msgstr "" + msgid "Token" msgstr "" @@ -9550,12 +9703,18 @@ msgstr "" msgid "Unlock" msgstr "" +msgid "Unlock the discussion" +msgstr "" + msgid "Unlock this %{issuableDisplayName}? Everyone will be able to comment." msgstr "" msgid "Unlocked" msgstr "" +msgid "Unlocks the discussion" +msgstr "" + msgid "Unresolve discussion" msgstr "" -- cgit v1.2.1