diff options
author | Constance Okoghenun <constanceokoghenun@gmail.com> | 2019-01-23 09:14:21 +0300 |
---|---|---|
committer | Constance Okoghenun <constanceokoghenun@gmail.com> | 2019-01-23 09:14:21 +0300 |
commit | 8322495027182c5119771f0733b4a0dffb4b2fde (patch) | |
tree | a27ac2157e148f253be3854df0d7431b23d088c2 /app | |
parent | 993616a6c47c4e3066072c27f87625ce9eb0cb06 (diff) |
Updated i18n for discussion note commit SHA
Ensured that sentence order is preserved when translating
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_note.vue | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 30d8f2c091e..0fd5d561387 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -80,12 +80,27 @@ export default { isTarget() { return this.targetNoteHash === this.noteAnchorId; }, - truncatedHash() { + actionText() { if (!this.commit) { return ''; } - return sprintf(s__('MergeRequests|%{commitSha}'), { commitSha: truncateSha(this.commit.id) }); + // We need to do this to ensure we have the currect sentence order + // when translating this as the sentence order may change from one + // language to the next. See: + // https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24427#note_133713771 + const { id, url } = this.commit; + const linkStart = `<a class="commit-sha monospace" href="${escape(url)}">`; + const linkEnd = '</a>'; + return sprintf( + s__('MergeRequests|commented on commit %{linkStart}%{commitId}%{linkEnd}'), + { + commitId: truncateSha(id), + linkStart, + linkEnd, + }, + false, + ); }, }, @@ -215,10 +230,7 @@ export default { <div class="timeline-content"> <div class="note-header"> <note-header v-once :author="author" :created-at="note.created_at" :note-id="note.id"> - <span v-if="commit"> - {{ s__('MergeRequests|commented on commit ') - }}<a class="commit-sha monospace" :href="commit.url">{{ truncatedHash }}</a> - </span> + <span v-if="commit" v-html="actionText"></span> <span v-else class="d-none d-sm-inline">·</span> </note-header> <note-actions |