提交 32cb4411 编写于 作者: R Rachel Macfarlane

Localize strings in commentThreadWidget

上级 61cb8d0e
......@@ -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 = <HTMLButtonElement>$('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,
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册