diff --git a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts index 992b6092d6104941e4b4d85d713f4c2ac9a74995..d5a2d3db43b15c1541fdd12b9d7858ccb9e86177 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts @@ -99,9 +99,7 @@ export class CommentNode { let INMEM_MODEL_ID = 0; export class ReviewZoneWidget extends ZoneWidget { private _headElement: HTMLElement; - protected _primaryHeading: HTMLElement; - protected _secondaryHeading: HTMLElement; - protected _metaHeading: HTMLElement; + protected _headingLabel: HTMLElement; protected _actionbarWidget: ActionBar; private _bodyElement: HTMLElement; private _commentEditor: ICodeEditor; @@ -205,13 +203,8 @@ export class ReviewZoneWidget extends ZoneWidget { appendTo(this._headElement). getHTMLElement(); - this._primaryHeading = $('span.filename').appendTo(titleElement).getHTMLElement(); - this._secondaryHeading = $('span.dirname').appendTo(titleElement).getHTMLElement(); - this._metaHeading = $('span.meta').appendTo(titleElement).getHTMLElement(); - - if (this._commentThread.comments.length) { - this.createParticipantsLabel(); - } + this._headingLabel = $('span.filename').appendTo(titleElement).getHTMLElement(); + this.createThreadLabel(); const actionsContainer = $('.review-actions').appendTo(this._headElement); this._actionbarWidget = new ActionBar(actionsContainer.getHTMLElement(), {}); @@ -288,8 +281,7 @@ export class ReviewZoneWidget extends ZoneWidget { this._commentThread = commentThread; this._commentElements = newCommentNodeList; - let secondaryHeading = this._commentThread.comments.filter(arrays.uniqueFilter(comment => comment.userName)).map(comment => `@${comment.userName}`).join(', '); - $(this._secondaryHeading).safeInnerHtml(secondaryHeading); + this.createThreadLabel(); } protected _doLayout(heightInPixel: number, widthInPixel: number): void { @@ -423,7 +415,6 @@ export class ReviewZoneWidget extends ZoneWidget { if (newCommentThread) { this.createReplyButton(); - this.createParticipantsLabel(); } } @@ -446,20 +437,23 @@ export class ReviewZoneWidget extends ZoneWidget { } } - createParticipantsLabel() { - const primaryHeading = 'Participants:'; - $(this._primaryHeading).safeInnerHtml(primaryHeading); - this._primaryHeading.setAttribute('aria-label', primaryHeading); + private createThreadLabel() { + let label: string; + if (this._commentThread.comments.length) { + const participantsList = this._commentThread.comments.filter(arrays.uniqueFilter(comment => comment.userName)).map(comment => `@${comment.userName}`).join(', '); + label = nls.localize('commentThreadParticipants', "Participants: {0}", participantsList); + } else { + label = nls.localize('startThread', "Start discussion"); + } - const secondaryHeading = this._commentThread.comments.filter(arrays.uniqueFilter(comment => comment.userName)).map(comment => `@${comment.userName}`).join(', '); - $(this._secondaryHeading).safeInnerHtml(secondaryHeading); - this._secondaryHeading.setAttribute('aria-label', secondaryHeading); + $(this._headingLabel).safeInnerHtml(label); + this._headingLabel.setAttribute('aria-label', label); } - createReplyButton() { + private createReplyButton() { this._reviewThreadReplyButton = $('button.review-thread-reply-button').appendTo(this._commentForm).getHTMLElement(); - this._reviewThreadReplyButton.title = 'Reply...'; - this._reviewThreadReplyButton.textContent = 'Reply...'; + this._reviewThreadReplyButton.title = nls.localize('reply', "Reply..."); + this._reviewThreadReplyButton.textContent = nls.localize('reply', "Reply..."); // bind click/escape actions for reviewThreadReplyButton and textArea this._reviewThreadReplyButton.onclick = () => { if (!dom.hasClass(this._commentForm, 'expand')) { @@ -493,7 +487,11 @@ export class ReviewZoneWidget extends ZoneWidget { if (model) { let valueLength = model.getValueLength(); const hasExistingComments = this._commentThread.comments.length > 0; - let placeholder = valueLength > 0 ? '' : (hasExistingComments ? 'Reply... (press Ctrl+Enter to submit)' : 'Type a new comment (press Ctrl+Enter to submit)'); + let placeholder = valueLength > 0 + ? '' + : (hasExistingComments + ? nls.localize('replytoCommentThread', "Reply... (press Ctrl+Enter to submit)") + : nls.localize('createCommentThread', "Type a new comment (press Ctrl+Enter to submit)")); const decorations = [{ range: { startLineNumber: 0, diff --git a/src/vs/workbench/parts/comments/electron-browser/media/review.css b/src/vs/workbench/parts/comments/electron-browser/media/review.css index 6a3d41dd41d6010180d586ce4d0a7e7ec461d4d9..fec5528683706c4e550114b36265d51721b3f0b9 100644 --- a/src/vs/workbench/parts/comments/electron-browser/media/review.css +++ b/src/vs/workbench/parts/comments/electron-browser/media/review.css @@ -223,10 +223,6 @@ cursor: pointer; } -.monaco-editor .review-widget .head .review-title .filename:empty::after { - content: "Start discussion"; -} - .monaco-editor .review-widget .head .review-title .dirname:not(:empty) { font-size: 0.9em; margin-left: 0.5em;