Skip to content

Commit cdc521a

Browse files
authored
Adopt l10n for merge-conflict (microsoft#165531)
For microsoft#164438
1 parent 3ca015c commit cdc521a

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

extensions/merge-conflict/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@
165165
}
166166
}
167167
},
168-
"dependencies": {
169-
"vscode-nls": "^5.2.0"
170-
},
168+
"dependencies": {},
171169
"devDependencies": {
172170
"@types/node": "16.x"
173171
},

extensions/merge-conflict/src/codelensProvider.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import * as vscode from 'vscode';
77
import * as interfaces from './interfaces';
8-
import { loadMessageBundle } from 'vscode-nls';
9-
const localize = loadMessageBundle();
108

119
export default class MergeConflictCodeLensProvider implements vscode.CodeLensProvider, vscode.Disposable {
1210
private codeLensRegistrationHandle?: vscode.Disposable | null;
@@ -65,25 +63,25 @@ export default class MergeConflictCodeLensProvider implements vscode.CodeLensPro
6563
conflicts.forEach(conflict => {
6664
const acceptCurrentCommand: vscode.Command = {
6765
command: 'merge-conflict.accept.current',
68-
title: localize('acceptCurrentChange', 'Accept Current Change'),
66+
title: vscode.l10n.t("Accept Current Change"),
6967
arguments: ['known-conflict', conflict]
7068
};
7169

7270
const acceptIncomingCommand: vscode.Command = {
7371
command: 'merge-conflict.accept.incoming',
74-
title: localize('acceptIncomingChange', 'Accept Incoming Change'),
72+
title: vscode.l10n.t("Accept Incoming Change"),
7573
arguments: ['known-conflict', conflict]
7674
};
7775

7876
const acceptBothCommand: vscode.Command = {
7977
command: 'merge-conflict.accept.both',
80-
title: localize('acceptBothChanges', 'Accept Both Changes'),
78+
title: vscode.l10n.t("Accept Both Changes"),
8179
arguments: ['known-conflict', conflict]
8280
};
8381

8482
const diffCommand: vscode.Command = {
8583
command: 'merge-conflict.compare',
86-
title: localize('compareChanges', 'Compare Changes'),
84+
title: vscode.l10n.t("Compare Changes"),
8785
arguments: [conflict]
8886
};
8987

extensions/merge-conflict/src/commandHandler.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import * as vscode from 'vscode';
66
import * as interfaces from './interfaces';
77
import ContentProvider from './contentProvider';
8-
import { loadMessageBundle } from 'vscode-nls';
9-
const localize = loadMessageBundle();
108

119
interface IDocumentMergeConflictNavigationResults {
1210
canNavigate: boolean;
@@ -92,7 +90,7 @@ export default class CommandHandler implements vscode.Disposable {
9290

9391
// Still failed to find conflict, warn the user and exit
9492
if (!conflict) {
95-
vscode.window.showWarningMessage(localize('cursorNotInConflict', 'Editor cursor is not within a merge conflict'));
93+
vscode.window.showWarningMessage(vscode.l10n.t("Editor cursor is not within a merge conflict"));
9694
return;
9795
}
9896
}
@@ -101,7 +99,7 @@ export default class CommandHandler implements vscode.Disposable {
10199

102100
// Still failed to find conflict, warn the user and exit
103101
if (!conflicts) {
104-
vscode.window.showWarningMessage(localize('cursorNotInConflict', 'Editor cursor is not within a merge conflict'));
102+
vscode.window.showWarningMessage(vscode.l10n.t("Editor cursor is not within a merge conflict"));
105103
return;
106104
}
107105

@@ -134,7 +132,7 @@ export default class CommandHandler implements vscode.Disposable {
134132

135133
const docPath = editor.document.uri.path;
136134
const fileName = docPath.substring(docPath.lastIndexOf('/') + 1); // avoid NodeJS path to keep browser webpack small
137-
const title = localize('compareChangesTitle', '{0}: Current Changes ↔ Incoming Changes', fileName);
135+
const title = vscode.l10n.t("{0}: Current Changes ↔ Incoming Changes", fileName);
138136
const mergeConflictConfig = vscode.workspace.getConfiguration('merge-conflict');
139137
const openToTheSide = mergeConflictConfig.get<string>('diffViewPosition');
140138
const opts: vscode.TextDocumentShowOptions = {
@@ -161,7 +159,7 @@ export default class CommandHandler implements vscode.Disposable {
161159
const conflict = await this.findConflictContainingSelection(editor);
162160

163161
if (!conflict) {
164-
vscode.window.showWarningMessage(localize('cursorNotInConflict', 'Editor cursor is not within a merge conflict'));
162+
vscode.window.showWarningMessage(vscode.l10n.t("Editor cursor is not within a merge conflict"));
165163
return;
166164
}
167165

@@ -184,11 +182,11 @@ export default class CommandHandler implements vscode.Disposable {
184182
typeToAccept = interfaces.CommitType.Incoming;
185183
}
186184
else if (editor.selection.active.isBefore(conflict.splitter.start)) {
187-
vscode.window.showWarningMessage(localize('cursorOnCommonAncestorsRange', 'Editor cursor is within the common ancestors block, please move it to either the "current" or "incoming" block'));
185+
vscode.window.showWarningMessage(vscode.l10n.t('Editor cursor is within the common ancestors block, please move it to either the "current" or "incoming" block'));
188186
return;
189187
}
190188
else {
191-
vscode.window.showWarningMessage(localize('cursorOnSplitterRange', 'Editor cursor is within the merge conflict splitter, please move it to either the "current" or "incoming" block'));
189+
vscode.window.showWarningMessage(vscode.l10n.t('Editor cursor is within the merge conflict splitter, please move it to either the "current" or "incoming" block'));
192190
return;
193191
}
194192

@@ -210,11 +208,11 @@ export default class CommandHandler implements vscode.Disposable {
210208
if (mergeConflictConfig.get<boolean>('autoNavigateNextConflict.enabled')) {
211209
return;
212210
}
213-
vscode.window.showWarningMessage(localize('noConflicts', 'No merge conflicts found in this file'));
211+
vscode.window.showWarningMessage(vscode.l10n.t("No merge conflicts found in this file"));
214212
return;
215213
}
216214
else if (!navigationResult.canNavigate) {
217-
vscode.window.showWarningMessage(localize('noOtherConflictsInThisFile', 'No other merge conflicts within this file'));
215+
vscode.window.showWarningMessage(vscode.l10n.t("No other merge conflicts within this file"));
218216
return;
219217
}
220218
else if (!navigationResult.conflict) {
@@ -241,7 +239,7 @@ export default class CommandHandler implements vscode.Disposable {
241239
}
242240

243241
if (!conflict) {
244-
vscode.window.showWarningMessage(localize('cursorNotInConflict', 'Editor cursor is not within a merge conflict'));
242+
vscode.window.showWarningMessage(vscode.l10n.t("Editor cursor is not within a merge conflict"));
245243
return;
246244
}
247245

@@ -261,7 +259,7 @@ export default class CommandHandler implements vscode.Disposable {
261259
const conflicts = await this.tracker.getConflicts(editor.document);
262260

263261
if (!conflicts || conflicts.length === 0) {
264-
vscode.window.showWarningMessage(localize('noConflicts', 'No merge conflicts found in this file'));
262+
vscode.window.showWarningMessage(vscode.l10n.t("No merge conflicts found in this file"));
265263
return;
266264
}
267265

extensions/merge-conflict/src/mergeDecorator.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55
import * as vscode from 'vscode';
66
import * as interfaces from './interfaces';
7-
import { loadMessageBundle } from 'vscode-nls';
8-
const localize = loadMessageBundle();
7+
98

109
export default class MergeDecorator implements vscode.Disposable {
1110

@@ -88,7 +87,7 @@ export default class MergeDecorator implements vscode.Disposable {
8887
outlineWidth: '1pt',
8988
outlineColor: new vscode.ThemeColor('merge.border'),
9089
after: {
91-
contentText: ' ' + localize('currentChange', '(Current Change)'),
90+
contentText: ' ' + vscode.l10n.t("(Current Change)"),
9291
color: new vscode.ThemeColor('descriptionForeground')
9392
}
9493
});
@@ -118,7 +117,7 @@ export default class MergeDecorator implements vscode.Disposable {
118117
outlineColor: new vscode.ThemeColor('merge.border'),
119118
isWholeLine: this.decorationUsesWholeLine,
120119
after: {
121-
contentText: ' ' + localize('incomingChange', '(Incoming Change)'),
120+
contentText: ' ' + vscode.l10n.t("(Incoming Change)"),
122121
color: new vscode.ThemeColor('descriptionForeground')
123122
}
124123
});

extensions/merge-conflict/yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,3 @@
66
version "16.11.6"
77
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
88
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
9-
10-
vscode-nls@^5.2.0:
11-
version "5.2.0"
12-
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f"
13-
integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==

0 commit comments

Comments
 (0)