提交 7669524f 编写于 作者: S Sandeep Somavarapu

clean up messages

上级 05be92db
......@@ -116,7 +116,7 @@ export class MarkersPanel extends Panel {
private createFilterInputBox(parent: HTMLElement): void {
this.filterInputBoxContainer= dom.append(parent, dom.emmet('.filter-box-container'));
this.filterInputBox= new InputBox(this.filterInputBoxContainer, this.contextViewService, {
placeholder: Messages.getString('markers.panel.filter.placeholder')
placeholder: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER
});
this.toDispose.push(this.filterInputBox.onDidChange((filter:string) => {
this.markersModel.filter= filter;
......
......@@ -44,12 +44,12 @@ export function registerContributions(): void {
'vs/workbench/parts/markers/browser/MarkersPanel',
'MarkersPanel',
Constants.MARKERS_PANEL_ID,
Messages.getString('markers.panel.no.problems'),
Messages.MARKERS_PANEL_NO_PROBLEMS,
'markersPanel'
));
let actionRegistry = <IWorkbenchActionRegistry>platform.Registry.as(ActionExtensions.WorkbenchActions);
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleMarkersPanelAction, ToggleMarkersPanelAction.ID, Messages.getString('markers.panel.toggle.label'), {
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleMarkersPanelAction, ToggleMarkersPanelAction.ID, Messages.MARKERS_PANEL_TOGGLE_LABEL, {
primary: null,
win: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_M },
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_M },
......
......@@ -116,7 +116,7 @@ export class MarkersModel {
public getTitle(markerStatistics: MarkerStatistics):string {
let title= MarkersModel.getStatisticsLabel(markerStatistics);
return title ? title : Messages.getString('markers.panel.no.problems');
return title ? title : Messages.MARKERS_PANEL_NO_PROBLEMS;
}
public getMessage():string {
......@@ -125,31 +125,31 @@ export class MarkersModel {
}
if (this.hasResources()) {
if (this.filter) {
return Messages.getString('markers.panel.no.problems.filters');
return Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS;
}
if (this.showOnlyErrors) {
return Messages.getString('markers.panel.no.errors');
return Messages.MARKERS_PANEL_NO_ERRORS;
}
}
return Messages.getString('markers.panel.no.problems.build');
return Messages.MARKERS_PANEL_NO_PROBLEMS_BUILT;
}
public static getStatisticsLabel(markerStatistics: MarkerStatistics, onlyErrors:boolean=false):string {
let label= this.getLabel('', markerStatistics.errors, 'markers.panel.single.error.label', 'markers.panel.multiple.errors.label');
let label= this.getLabel('', markerStatistics.errors, Messages.MARKERS_PANEL_SINGLE_ERROR_LABEL, Messages.MARKERS_PANEL_MULTIPLE_ERRORS_LABEL);
if (!onlyErrors) {
label= this.getLabel(label, markerStatistics.warnings, 'markers.panel.single.warning.label', 'markers.panel.multiple.warnings.label');
label= this.getLabel(label, markerStatistics.infos, 'markers.panel.single.info.label', 'markers.panel.multiple.infos.label');
label= this.getLabel(label, markerStatistics.unknwons, 'markers.panel.single.unknown.label', 'markers.panel.multiple.unknowns.label');
label= this.getLabel(label, markerStatistics.warnings, Messages.MARKERS_PANEL_SINGLE_WARNING_LABEL, Messages.MARKERS_PANEL_MULTIPLE_WARNINGS_LABEL);
label= this.getLabel(label, markerStatistics.infos, Messages.MARKERS_PANEL_SINGLE_INFO_LABEL, Messages.MARKERS_PANEL_MULTIPLE_INFOS_LABEL);
label= this.getLabel(label, markerStatistics.unknwons, Messages.MARKERS_PANEL_SINGLE_UNKNOWN_LABEL, Messages.MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL);
}
return label;
}
private static getLabel(title: string, markersCount: number, singleMarkerKey: string, multipleMarkerKey: string): string {
private static getLabel(title: string, markersCount: number, singleMarkerString: string, multipleMarkersFunction: (markersCount:number)=>string): string {
if (markersCount <= 0) {
return title;
}
title= title ? title + ', ' : '';
title += Messages.getString(markersCount === 1 ? singleMarkerKey : multipleMarkerKey, ''+markersCount);
title += markersCount === 1 ? singleMarkerString : multipleMarkersFunction(markersCount);
return title;
}
}
\ No newline at end of file
......@@ -6,25 +6,21 @@
import nls = require('vs/nls');
var Messages = {
'markers.panel.toggle.label': 'Toggle Problems',
'markers.panel.no.problems': 'No problems',
'markers.panel.no.problems.build': 'This workspace is clear or not yet built',
'markers.panel.no.problems.filters': 'No problems found with given filter criteria',
'markers.panel.no.errors': 'This workspace has no errors',
'markers.panel.single.error.label': '{0} Error',
'markers.panel.multiple.errors.label': '{0} Errors',
'markers.panel.single.warning.label': '{0} Warning',
'markers.panel.multiple.warnings.label': '{0} Warnings',
'markers.panel.single.info.label': '{0} Info',
'markers.panel.multiple.infos.label': '{0} Infos',
'markers.panel.single.unknown.label': '{0} Unknown',
'markers.panel.multiple.unknowns.label': '{0} Unknowns',
'markers.panel.filter.placeholder': 'Type to Filter',
export default class Messages {
getString: function(key:string, ...args: string[]): string {
return nls.localize(key, Messages[key], args);
}
};
public static MARKERS_PANEL_TOGGLE_LABEL:string= nls.localize('markers.panel.toggle.label', "Toggle Problems");
public static MARKERS_PANEL_NO_PROBLEMS:string= nls.localize('markers.panel.no.problems', "No problems");
public static MARKERS_PANEL_NO_PROBLEMS_BUILT:string= nls.localize('markers.panel.no.problems.build', "This workspace is clear or not yet built");
public static MARKERS_PANEL_NO_PROBLEMS_FILTERS:string= nls.localize('markers.panel.no.problems.filters', "No results found with provided filter criteria");
public static MARKERS_PANEL_NO_ERRORS:string= nls.localize('markers.panel.no.errors', "This workspace has no errors");
public static MARKERS_PANEL_FILTER_PLACEHOLDER:string= nls.localize('markers.panel.filter.placeholder', "Type to Filter");
export default Messages;
\ No newline at end of file
public static MARKERS_PANEL_SINGLE_ERROR_LABEL:string= nls.localize('markers.panel.single.error.label', "1 Error");
public static MARKERS_PANEL_MULTIPLE_ERRORS_LABEL=(noOfErrors: number):string=>{return nls.localize('markers.panel.multiple.errors.label', "{0} Errors", ''+noOfErrors);};
public static MARKERS_PANEL_SINGLE_WARNING_LABEL:string= nls.localize('markers.panel.single.warning.label', "1 Warning");
public static MARKERS_PANEL_MULTIPLE_WARNINGS_LABEL=(noOfWarnings: number):string=>{return nls.localize('markers.panel.multiple.warnings.label', "{0} Warnings", ''+noOfWarnings);};
public static MARKERS_PANEL_SINGLE_INFO_LABEL:string= nls.localize('markers.panel.single.info.label', "1 Info");
public static MARKERS_PANEL_MULTIPLE_INFOS_LABEL=(noOfInfos: number):string=>{return nls.localize('markers.panel.multiple.infos.label', "{0} Infos", ''+noOfInfos);};
public static MARKERS_PANEL_SINGLE_UNKNOWN_LABEL:string= nls.localize('markers.panel.single.unknown.label', "1 Unknown");
public static MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=(noOfUnknowns: number):string=>{return nls.localize('markers.panel.multiple.unknowns.label', "{0} Unknowns", ''+noOfUnknowns);};
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册