diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-03 12:10:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-03 12:10:57 +0300 |
commit | cc8ea69201e2e4d020018c43efeb993c44cd8a71 (patch) | |
tree | 6f8ae78a9b68bfcab2fa670a46c659f198fb1c53 /app | |
parent | b29d7709c1c992d4e5aa481155ef60003cd43d55 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
17 files changed, 74 insertions, 52 deletions
diff --git a/app/assets/javascripts/issuable/components/issuable_by_email.vue b/app/assets/javascripts/issuable/components/issuable_by_email.vue index 799d2bdc9e2..512fa6f8c68 100644 --- a/app/assets/javascripts/issuable/components/issuable_by_email.vue +++ b/app/assets/javascripts/issuable/components/issuable_by_email.vue @@ -54,8 +54,7 @@ export default { data() { return { email: this.initialEmail, - // eslint-disable-next-line @gitlab/require-i18n-strings - issuableName: this.issuableType === 'issue' ? 'issue' : 'merge request', + issuableName: this.issuableType === 'issue' ? __('issue') : __('merge request'), }; }, computed: { diff --git a/app/assets/javascripts/issue_show/components/header_actions.vue b/app/assets/javascripts/issue_show/components/header_actions.vue index 2c314ce1c3f..e8cc105d230 100644 --- a/app/assets/javascripts/issue_show/components/header_actions.vue +++ b/app/assets/javascripts/issue_show/components/header_actions.vue @@ -7,7 +7,7 @@ import { IssuableType } from '~/issuable_show/constants'; import { IssuableStatus, IssueStateEvent } from '~/issue_show/constants'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import { visitUrl } from '~/lib/utils/url_utility'; -import { __, sprintf } from '~/locale'; +import { s__, __, sprintf } from '~/locale'; import eventHub from '~/notes/event_hub'; import promoteToEpicMutation from '../queries/promote_to_epic.mutation.graphql'; import updateIssueMutation from '../queries/update_issue.mutation.graphql'; @@ -78,10 +78,18 @@ export default { isClosed() { return this.openState === IssuableStatus.Closed; }, + issueTypeText() { + const issueTypeTexts = { + [IssuableType.Issue]: s__('HeaderAction|issue'), + [IssuableType.Incident]: s__('HeaderAction|incident'), + }; + + return issueTypeTexts[this.issueType] ?? this.issueType; + }, buttonText() { return this.isClosed - ? sprintf(__('Reopen %{issueType}'), { issueType: this.issueType }) - : sprintf(__('Close %{issueType}'), { issueType: this.issueType }); + ? sprintf(__('Reopen %{issueType}'), { issueType: this.issueTypeText }) + : sprintf(__('Close %{issueType}'), { issueType: this.issueTypeText }); }, qaSelector() { return this.isClosed ? 'reopen_issue_button' : 'close_issue_button'; diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index 4e31fdcd4f0..996c008b881 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -11,7 +11,6 @@ import httpStatusCodes from '~/lib/utils/http_status'; import { capitalizeFirstCharacter, convertToCamelCase, - splitCamelCase, slugifyWithUnderscore, } from '~/lib/utils/text_utility'; import { sprintf } from '~/locale'; @@ -77,7 +76,15 @@ export default { ]), ...mapState(['isToggleStateButtonLoading']), noteableDisplayName() { - return splitCamelCase(this.noteableType).toLowerCase(); + const displayNameMap = { + [constants.ISSUE_NOTEABLE_TYPE]: this.$options.i18n.issue, + [constants.EPIC_NOTEABLE_TYPE]: this.$options.i18n.epic, + [constants.MERGE_REQUEST_NOTEABLE_TYPE]: this.$options.i18n.mergeRequest, + }; + + const noteableTypeKey = + constants.NOTEABLE_TYPE_MAPPING[this.noteableType] || constants.ISSUE_NOTEABLE_TYPE; + return displayNameMap[noteableTypeKey]; }, isLoggedIn() { return this.getUserData.id; @@ -103,15 +110,13 @@ export default { const openOrClose = this.isOpen ? 'close' : 'reopen'; if (this.note.length) { - return sprintf(this.$options.i18n.actionButtonWithNote, { + return sprintf(this.$options.i18n.actionButton.withNote[openOrClose], { actionText: this.commentButtonTitle, - openOrClose, noteable: this.noteableDisplayName, }); } - return sprintf(this.$options.i18n.actionButton, { - openOrClose: capitalizeFirstCharacter(openOrClose), + return sprintf(this.$options.i18n.actionButton.withoutNote[openOrClose], { noteable: this.noteableDisplayName, }); }, @@ -151,13 +156,8 @@ export default { draftEndpoint() { return this.getNotesData.draftsPath; }, - issuableTypeTitle() { - return this.noteableType === constants.MERGE_REQUEST_NOTEABLE_TYPE - ? this.$options.i18n.mergeRequest - : this.$options.i18n.issue; - }, isIssue() { - return this.noteableDisplayName === constants.ISSUE_NOTEABLE_TYPE; + return constants.NOTEABLE_TYPE_MAPPING[this.noteableType] === constants.ISSUE_NOTEABLE_TYPE; }, trackingLabel() { return slugifyWithUnderscore(`${this.commentButtonTitle} button`); @@ -329,7 +329,7 @@ export default { <template> <div> <note-signed-out-widget v-if="!isLoggedIn" /> - <discussion-locked-widget v-else-if="!canCreateNote" :issuable-type="issuableTypeTitle" /> + <discussion-locked-widget v-else-if="!canCreateNote" :issuable-type="noteableDisplayName" /> <ul v-else-if="canCreateNote" class="notes notes-form timeline"> <timeline-entry-item class="note-form"> <gl-alert diff --git a/app/assets/javascripts/notes/i18n.js b/app/assets/javascripts/notes/i18n.js index 1ffb94d11ad..cd47985d8d0 100644 --- a/app/assets/javascripts/notes/i18n.js +++ b/app/assets/javascripts/notes/i18n.js @@ -9,6 +9,7 @@ export const COMMENT_FORM = { issue: __('issue'), startThread: __('Start thread'), mergeRequest: __('merge request'), + epic: __('epic'), bodyPlaceholder: __('Write a comment or drag your files hereā¦'), confidential: s__('Notes|Make this comment confidential'), confidentialVisibility: s__('Notes|Confidential comments are only visible to project members'), @@ -17,7 +18,16 @@ export const COMMENT_FORM = { ), discussion: __('Discuss a specific suggestion or question.'), actionButtonWithNote: __('%{actionText} & %{openOrClose} %{noteable}'), - actionButton: __('%{openOrClose} %{noteable}'), + actionButton: { + withNote: { + reopen: __('%{actionText} & reopen %{noteable}'), + close: __('%{actionText} & close %{noteable}'), + }, + withoutNote: { + reopen: __('Reopen %{noteable}'), + close: __('Close %{noteable}'), + }, + }, submitButton: { startThread: __('Start thread'), comment: __('Comment'), diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 9b4d0c0b9b3..3a5dcb4e664 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -35,7 +35,7 @@ module FormHelper def assignees_dropdown_options(issuable_type) dropdown_data = { toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data', - title: 'Select assignee', + title: _('Select assignee'), filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee', placeholder: _('Search users'), @@ -45,9 +45,9 @@ module FormHelper current_user: true, project_id: (@target_project || @project)&.id, field_name: "#{issuable_type}[assignee_ids][]", - default_label: 'Unassigned', + default_label: _('Unassigned'), 'max-select': 1, - 'dropdown-header': 'Assignee', + 'dropdown-header': _('Assignee'), multi_select: true, 'input-meta': 'name', 'always-show-selectbox': true, @@ -123,7 +123,7 @@ module FormHelper def multiple_assignees_dropdown_options(options) new_options = options.dup - new_options[:title] = 'Select assignee(s)' + new_options[:title] = _('Select assignee(s)') new_options[:data][:'dropdown-header'] = 'Assignee(s)' new_options[:data].delete(:'max-select') diff --git a/app/helpers/issuables_description_templates_helper.rb b/app/helpers/issuables_description_templates_helper.rb index 6b546d5c6fc..6c23f888823 100644 --- a/app/helpers/issuables_description_templates_helper.rb +++ b/app/helpers/issuables_description_templates_helper.rb @@ -6,7 +6,7 @@ module IssuablesDescriptionTemplatesHelper def template_dropdown_tag(issuable, &block) selected_template = selected_template(issuable) - title = selected_template || "Choose a template" + title = selected_template || _('Choose a template') options = { toggle_class: 'js-issuable-selector', title: title, diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 07f5adae272..53a7487741e 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -80,7 +80,7 @@ module IssuablesHelper def users_dropdown_label(selected_users) case selected_users.length when 0 - "Unassigned" + _('Unassigned') when 1 selected_users[0].name else @@ -133,7 +133,7 @@ module IssuablesHelper end # rubocop: enable CodeReuse/ActiveRecord - def milestone_dropdown_label(milestone_title, default_label = "Milestone") + def milestone_dropdown_label(milestone_title, default_label = _('Milestone')) title = case milestone_title when Milestone::Upcoming.name then Milestone::Upcoming.title @@ -188,7 +188,12 @@ module IssuablesHelper end def issuables_state_counter_text(issuable_type, state, display_count) - titles = { opened: "Open" } + titles = { + opened: _("Open"), + closed: _("Closed"), + merged: _("Merged"), + all: _("All") + } state_title = titles[state] || state.to_s.humanize html = content_tag(:span, state_title) diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 2de2c2cba6c..6d848a1fbbe 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -25,10 +25,10 @@ #{issuable_reference(issue)} %span.issuable-authored.d-none.d-sm-inline-block · - created #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by - if issue.service_desk_reply_to - #{issue.service_desk_reply_to} via - #{link_to_member(@project, issue.author, avatar: false)} + #{_('created %{timeAgoString} by %{email} via %{user}').html_safe % { timeAgoString: time_ago_with_tooltip(issue.created_at, placement: 'bottom'), email: issue.service_desk_reply_to, user: link_to_member(@project, issue.author, avatar: false) }} + - else + #{s_('IssueList|created %{timeAgoString} by %{user}').html_safe % { timeAgoString: time_ago_with_tooltip(issue.created_at, placement: 'bottom'), user: link_to_member(@project, issue.author, avatar: false) }} = render_if_exists 'shared/issuable/gitlab_team_member_badge', author: issue.author - if issue.milestone %span.issuable-milestone.d-none.d-sm-inline-block diff --git a/app/views/projects/issues/_new_branch.html.haml b/app/views/projects/issues/_new_branch.html.haml index 07fec195899..1cf0551535b 100644 --- a/app/views/projects/issues/_new_branch.html.haml +++ b/app/views/projects/issues/_new_branch.html.haml @@ -1,7 +1,7 @@ - if can?(current_user, :push_code, @project) - can_create_merge_request = can?(current_user, :create_merge_request_in, @project) - data_action = can_create_merge_request ? 'create-mr' : 'create-branch' - - value = can_create_merge_request ? 'Create merge request' : 'Create branch' + - value = can_create_merge_request ? _('Create merge request') : _('Create branch') - value = can_create_confidential_merge_request? ? _('Create confidential merge request') : value - create_mr_text = can_create_confidential_merge_request? ? _('Create confidential merge request') : _('Create merge request') diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 3e2c5f088f7..909615ede1e 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -20,8 +20,7 @@ #{issuable_reference(merge_request)} %span.issuable-authored.d-none.d-sm-inline-block · - created #{time_ago_with_tooltip(merge_request.created_at, placement: 'bottom')} - by #{link_to_member(@project, merge_request.author, avatar: false)} + #{s_('IssueList|created %{timeAgoString} by %{user}').html_safe % { timeAgoString: time_ago_with_tooltip(merge_request.created_at, placement: 'bottom'), user: link_to_member(@project, merge_request.author, avatar: false) }} = render_if_exists 'shared/issuable/gitlab_team_member_badge', author: merge_request.author - if merge_request.milestone %span.issuable-milestone.d-none.d-sm-inline-block diff --git a/app/views/shared/form_elements/_description.html.haml b/app/views/shared/form_elements/_description.html.haml index f8942dddfb4..94818c13f76 100644 --- a/app/views/shared/form_elements/_description.html.haml +++ b/app/views/shared/form_elements/_description.html.haml @@ -7,7 +7,7 @@ - preview_url = preview_markdown_path(project, target_type: model.class.name) .form-group.row.detail-page-description - = form.label :description, 'Description', class: 'col-form-label col-sm-2' + = form.label :description, _('Description'), class: 'col-form-label col-sm-2' .col-sm-10 - if model.is_a?(MergeRequest) = hidden_field_tag :merge_request_diff_head_sha, model.diff_head_sha diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index cb03bd4c473..4024c5b77f6 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -64,7 +64,7 @@ for this project. - if issuable.new_record? - = form.submit "Create #{issuable.class.model_name.human.downcase}", class: 'gl-button btn btn-confirm gl-mr-2', data: { qa_selector: 'issuable_create_button' } + = form.submit "#{_('Create')} #{issuable.class.model_name.human.downcase}", class: 'gl-button btn btn-confirm gl-mr-2', data: { qa_selector: 'issuable_create_button' } - else = form.submit _('Save changes'), class: 'gl-button btn btn-confirm gl-mr-2' diff --git a/app/views/shared/issuable/_milestone_dropdown.html.haml b/app/views/shared/issuable/_milestone_dropdown.html.haml index f58156b7c08..dc713337747 100644 --- a/app/views/shared/issuable/_milestone_dropdown.html.haml +++ b/app/views/shared/issuable/_milestone_dropdown.html.haml @@ -4,20 +4,20 @@ - selected = local_assigns.fetch(:selected, nil) - selected_text = selected.try(:title) || params[:milestone_title] -- dropdown_title = local_assigns.fetch(:dropdown_title, "Filter by milestone") +- dropdown_title = local_assigns.fetch(:dropdown_title, _('Filter by milestone')) - if selected.present? || params[:milestone_title].present? = hidden_field_tag(name, name == :milestone_title ? selected_text : selected.id) = dropdown_tag(milestone_dropdown_label(selected_text), options: { title: dropdown_title, toggle_class: "qa-issuable-milestone-dropdown js-milestone-select js-filter-submit #{extra_class}", filter: true, dropdown_class: "qa-issuable-dropdown-menu-milestone dropdown-menu-selectable dropdown-menu-milestone", - placeholder: "Search milestones", footer_content: project.present?, data: { show_no: true, show_menu_above: show_menu_above, show_any: show_any, show_upcoming: show_upcoming, show_started: show_started, field_name: name, selected: selected_text, project_id: project.try(:id), default_label: "Milestone" } }) do + placeholder: _('Search milestones'), footer_content: project.present?, data: { show_no: true, show_menu_above: show_menu_above, show_any: show_any, show_upcoming: show_upcoming, show_started: show_started, field_name: name, selected: selected_text, project_id: project.try(:id), default_label: _('Milestone') } }) do - if project %ul.dropdown-footer-list - if can? current_user, :admin_milestone, project %li - = link_to new_project_milestone_path(project), title: "New Milestone" do - Create new + = link_to new_project_milestone_path(project), title: _('New Milestone') do + = _('Create new') %li = link_to project_milestones_path(project) do - if can? current_user, :admin_milestone, project - Manage milestones + = _('Manage milestones') - else - View milestones + = _('View milestones') diff --git a/app/views/shared/issuable/form/_default_templates.html.haml b/app/views/shared/issuable/form/_default_templates.html.haml index 3dc244677e2..50f30e58b35 100644 --- a/app/views/shared/issuable/form/_default_templates.html.haml +++ b/app/views/shared/issuable/form/_default_templates.html.haml @@ -1,4 +1,5 @@ %p.form-text.text-muted - Add - = link_to 'description templates', help_page_path('user/project/description_templates') - to help your contributors communicate effectively! + - template_link_url = help_page_path('user/project/description_templates') + - template_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: template_link_url } + = s_('Promotions|Add %{link_start} description templates %{link_end} to help your contributors to communicate effectively!').html_safe % { link_start: template_link_start, link_end: '</a>'.html_safe } + diff --git a/app/views/shared/issuable/form/_metadata.html.haml b/app/views/shared/issuable/form/_metadata.html.haml index 2f05d272ca3..9e42c528a11 100644 --- a/app/views/shared/issuable/form/_metadata.html.haml +++ b/app/views/shared/issuable/form/_metadata.html.haml @@ -10,7 +10,7 @@ .form-check = form.check_box :confidential, class: 'form-check-input' = form.label :confidential, class: 'form-check-label' do - This issue is confidential and should only be visible to team members with at least Reporter access. + #{_('This issue is confidential and should only be visible to team members with at least Reporter access.')} - if can?(current_user, :"set_#{issuable.to_ability_name}_metadata", issuable) %hr @@ -27,13 +27,13 @@ - if issuable.supports_milestone? .form-group.row.issue-milestone - = form.label :milestone_id, "Milestone", class: "col-form-label #{has_due_date ? "col-md-2 col-lg-4" : "col-sm-2"}" + = form.label :milestone_id, _('Milestone'), class: "col-form-label #{has_due_date ? "col-md-2 col-lg-4" : "col-sm-2"}" .col-sm-10{ class: ("col-md-8" if has_due_date) } .issuable-form-select-holder - = render "shared/issuable/milestone_dropdown", selected: issuable.milestone, name: "#{issuable.class.model_name.param_key}[milestone_id]", show_any: false, show_upcoming: false, show_started: false, extra_class: "qa-issuable-milestone-dropdown js-issuable-form-dropdown js-dropdown-keep-input", dropdown_title: "Select milestone" + = render "shared/issuable/milestone_dropdown", selected: issuable.milestone, name: "#{issuable.class.model_name.param_key}[milestone_id]", show_any: false, show_upcoming: false, show_started: false, extra_class: "qa-issuable-milestone-dropdown js-issuable-form-dropdown js-dropdown-keep-input", dropdown_title: _('Select milestone') .form-group.row - = form.label :label_ids, "Labels", class: "col-form-label #{has_due_date ? "col-md-2 col-lg-4" : "col-sm-2"}" + = form.label :label_ids, _('Labels'), class: "col-form-label #{has_due_date ? "col-md-2 col-lg-4" : "col-sm-2"}" = form.hidden_field :label_ids, multiple: true, value: '' .col-sm-10{ class: "#{"col-md-8" if has_due_date}" } .issuable-form-select-holder @@ -45,7 +45,7 @@ .col-lg-6 = render_if_exists "shared/issuable/form/weight", issuable: issuable, form: form .form-group.row - = form.label :due_date, "Due date", class: "col-form-label col-md-2 col-lg-4" + = form.label :due_date, _('Due date'), class: "col-form-label col-md-2 col-lg-4" .col-8 .issuable-form-select-holder - = form.text_field :due_date, id: "issuable-due-date", class: "datepicker form-control", placeholder: "Select due date", autocomplete: 'off' + = form.text_field :due_date, id: "issuable-due-date", class: "datepicker form-control", placeholder: _('Select due date'), autocomplete: 'off' diff --git a/app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml b/app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml index b437ee1ec5f..781ee8b5f80 100644 --- a/app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml +++ b/app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml @@ -8,4 +8,4 @@ = hidden_field_tag "#{issuable.to_ability_name}[assignee_ids][]", 0, id: nil, data: { meta: '' } = dropdown_tag(users_dropdown_label(issuable.assignees), options: assignees_dropdown_options(issuable.to_ability_name)) - = link_to 'Assign to me', '#', class: "assign-to-me-link qa-assign-to-me-link #{'hide' if issuable.assignees.include?(current_user)}" + = link_to _('Assign to me'), '#', class: "assign-to-me-link qa-assign-to-me-link #{'hide' if issuable.assignees.include?(current_user)}" diff --git a/app/views/shared/issuable/form/_type_selector.html.haml b/app/views/shared/issuable/form/_type_selector.html.haml index ae0fe54de4f..0d86aa8c8e7 100644 --- a/app/views/shared/issuable/form/_type_selector.html.haml +++ b/app/views/shared/issuable/form/_type_selector.html.haml @@ -1,7 +1,7 @@ - return unless issuable.supports_issue_type? && can?(current_user, :create_issue, @project) .form-group.row.gl-mb-0 - = form.label :type, 'Type', class: 'col-form-label col-sm-2' + = form.label :type, _('Type'), class: 'col-form-label col-sm-2' .col-sm-10 .gl-display-flex.gl-align-items-center .issuable-form-select-holder.selectbox.form-group.gl-mb-0 |