diff --git a/app/assets/javascripts/issuable/components/issuable_by_email.vue b/app/assets/javascripts/issuable/components/issuable_by_email.vue index 799d2bdc9e286b7d6e691814a58df863a22b1f4e..512fa6f8c68d311b06bab9e9315163f3a2edc902 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 2c314ce1c3fcb273fccbdf75cd3697dc70b3417e..e8cc105d23080d4b0fa7a0f8eceb86c5214fcf84 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 4e31fdcd4f0691b72a5d7009adcad00f4fff7dd7..996c008b881573bc373e3f5d2cbdc1c1b955ae1c 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 {