Skip to content

Commit 43dd9b7

Browse files
committed
git: nls
related to microsoft#18615
1 parent fab6f88 commit 43dd9b7

7 files changed

Lines changed: 87 additions & 48 deletions

File tree

extensions/git/package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"commands": [
2424
{
2525
"command": "git.refresh",
26-
"title": "Refresh",
26+
"title": "%command.refresh%",
2727
"category": "Git",
2828
"icon": {
2929
"light": "resources/icons/light/refresh.svg",
@@ -32,17 +32,17 @@
3232
},
3333
{
3434
"command": "git.openChange",
35-
"title": "Open Change",
35+
"title": "%command.openChange%",
3636
"category": "Git"
3737
},
3838
{
3939
"command": "git.openFile",
40-
"title": "Open File",
40+
"title": "%command.openFile%",
4141
"category": "Git"
4242
},
4343
{
4444
"command": "git.stage",
45-
"title": "Stage",
45+
"title": "%command.stage%",
4646
"category": "Git",
4747
"icon": {
4848
"light": "resources/icons/light/stage.svg",
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"command": "git.stageAll",
54-
"title": "Stage All",
54+
"title": "%command.stageAll%",
5555
"category": "Git",
5656
"icon": {
5757
"light": "resources/icons/light/stage.svg",
@@ -60,7 +60,7 @@
6060
},
6161
{
6262
"command": "git.unstage",
63-
"title": "Unstage",
63+
"title": "%command.unstage%",
6464
"category": "Git",
6565
"icon": {
6666
"light": "resources/icons/light/unstage.svg",
@@ -69,7 +69,7 @@
6969
},
7070
{
7171
"command": "git.unstageAll",
72-
"title": "Unstage All",
72+
"title": "%command.unstageAll%",
7373
"category": "Git",
7474
"icon": {
7575
"light": "resources/icons/light/unstage.svg",
@@ -78,7 +78,7 @@
7878
},
7979
{
8080
"command": "git.clean",
81-
"title": "Clean",
81+
"title": "%command.clean%",
8282
"category": "Git",
8383
"icon": {
8484
"light": "resources/icons/light/clean.svg",
@@ -87,7 +87,7 @@
8787
},
8888
{
8989
"command": "git.cleanAll",
90-
"title": "Clean All",
90+
"title": "%command.cleanAll%",
9191
"category": "Git",
9292
"icon": {
9393
"light": "resources/icons/light/clean.svg",
@@ -96,72 +96,72 @@
9696
},
9797
{
9898
"command": "git.commitStaged",
99-
"title": "Commit Staged",
99+
"title": "%command.commitStaged%",
100100
"category": "Git"
101101
},
102102
{
103103
"command": "git.commitStagedSigned",
104-
"title": "Commit Staged (Signed Off)",
104+
"title": "%command.commitStagedSigned%",
105105
"category": "Git"
106106
},
107107
{
108108
"command": "git.commitAll",
109-
"title": "Commit All",
109+
"title": "%command.commitAll%",
110110
"category": "Git"
111111
},
112112
{
113113
"command": "git.commitAllSigned",
114-
"title": "Commit All (Signed Off)",
114+
"title": "%command.commitAllSigned%",
115115
"category": "Git"
116116
},
117117
{
118118
"command": "git.undoCommit",
119-
"title": "Undo Last Commit",
119+
"title": "%command.undoCommit%",
120120
"category": "Git"
121121
},
122122
{
123123
"command": "git.checkout",
124-
"title": "Checkout to...",
124+
"title": "%command.checkout%",
125125
"category": "Git"
126126
},
127127
{
128128
"command": "git.branch",
129-
"title": "Create Branch...",
129+
"title": "%command.branch%",
130130
"category": "Git"
131131
},
132132
{
133133
"command": "git.pull",
134-
"title": "Pull",
134+
"title": "%command.pull%",
135135
"category": "Git"
136136
},
137137
{
138138
"command": "git.pullRebase",
139-
"title": "Pull (Rebase)",
139+
"title": "%command.pullRebase%",
140140
"category": "Git"
141141
},
142142
{
143143
"command": "git.push",
144-
"title": "Push",
144+
"title": "%command.push%",
145145
"category": "Git"
146146
},
147147
{
148148
"command": "git.pushTo",
149-
"title": "Push to...",
149+
"title": "%command.pushTo%",
150150
"category": "Git"
151151
},
152152
{
153153
"command": "git.sync",
154-
"title": "Sync",
154+
"title": "%command.sync%",
155155
"category": "Git"
156156
},
157157
{
158158
"command": "git.publish",
159-
"title": "Publish",
159+
"title": "%command.publish%",
160160
"category": "Git"
161161
},
162162
{
163163
"command": "git.showOutput",
164-
"title": "Show Git Output",
164+
"title": "%command.showOutput%",
165165
"category": "Git"
166166
}
167167
],
@@ -352,7 +352,7 @@
352352
{
353353
"id": "git-commit",
354354
"aliases": [
355-
"Git Commit Message",
355+
"%language-alias.git-commit%",
356356
"git-commit"
357357
],
358358
"filenames": [
@@ -364,7 +364,7 @@
364364
{
365365
"id": "git-rebase",
366366
"aliases": [
367-
"Git Rebase Message",
367+
"%language-alias.git-rebase%",
368368
"git-rebase"
369369
],
370370
"filenames": [

extensions/git/package.nls.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"command.refresh": "Refresh",
3+
"command.openChange": "Open Change",
4+
"command.openFile": "Open File",
5+
"command.stage": "Stage",
6+
"command.stageAll": "Stage All",
7+
"command.unstage": "Unstage",
8+
"command.unstageAll": "Unstage All",
9+
"command.clean": "Clean",
10+
"command.cleanAll": "Clean All",
11+
"command.commitStaged": "Commit Staged",
12+
"command.commitStagedSigned": "Commit Staged (Signed Off)",
13+
"command.commitAll": "Commit All",
14+
"command.commitAllSigned": "Commit All (Signed Off)",
15+
"command.undoCommit": "Undo Last Commit",
16+
"command.checkout": "Checkout to...",
17+
"command.branch": "Create Branch...",
18+
"command.pull": "Pull",
19+
"command.pullRebase": "Pull (Rebase)",
20+
"command.push": "Push",
21+
"command.pushTo": "Push to...",
22+
"command.sync": "Sync",
23+
"command.publish": "Publish",
24+
"command.showOutput": "Show Git Output",
25+
"language-alias.git-commit": "Git Commit Message",
26+
"language-alias.git-rebase": "Git Rebase Message"
27+
}

extensions/git/src/commands.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { Uri, commands, scm, Disposable, SCMResourceGroup, SCMResource, window,
99
import { IRef, RefType } from './git';
1010
import { Model, Resource, Status } from './model';
1111
import * as path from 'path';
12+
import * as nls from 'vscode-nls';
13+
14+
const localize = nls.loadMessageBundle();
1215

1316
function resolveGitURI(uri: Uri): SCMResource | SCMResourceGroup | undefined {
1417
if (uri.authority !== 'git') {
@@ -50,12 +53,16 @@ class CheckoutItem implements QuickPickItem {
5053

5154
class CheckoutTagItem extends CheckoutItem {
5255

53-
get description(): string { return `Tag at ${this.shortCommit}`; }
56+
get description(): string {
57+
return localize('tag at', "Tag at {0}", this.shortCommit);
58+
}
5459
}
5560

5661
class CheckoutRemoteHeadItem extends CheckoutItem {
5762

58-
get description(): string { return `Remote branch at ${this.shortCommit}`; }
63+
get description(): string {
64+
return localize('remote branch at', "Remote branch at {0}", this.shortCommit);
65+
}
5966

6067
protected get treeish(): string | undefined {
6168
if (!this.ref.name) {
@@ -93,7 +100,7 @@ export class CommandCenter {
93100

94101
switch (err.gitErrorCode) {
95102
case 'DirtyWorkTree':
96-
message = 'Please clean your repository working tree before checkout.';
103+
message = localize('clean repo', "Please clean your repository working tree before checkout.");
97104
break;
98105
default:
99106
message = (err.stderr || err.message).replace(/^error: /, '');
@@ -106,7 +113,7 @@ export class CommandCenter {
106113
}
107114

108115
const outputChannel = this.outputChannel as OutputChannel;
109-
const openOutputChannelChoice = 'Open Git Log';
116+
const openOutputChannelChoice = localize('open git log', "Open Git Log");
110117
const choice = await window.showErrorMessage(message, openOutputChannelChoice);
111118

112119
if (choice === openOutputChannelChoice) {
@@ -270,9 +277,9 @@ export class CommandCenter {
270277
}
271278

272279
const basename = path.basename(resource.uri.fsPath);
273-
const message = `Are you sure you want to clean changes in ${basename}?`;
274-
const yes = 'Yes';
275-
const no = 'No, keep them';
280+
const message = localize('confirm clean', "Are you sure you want to clean changes in {0}?", basename);
281+
const yes = localize('yes', "Yes");
282+
const no = localize('no, keep them', "No, keep them");
276283
const pick = await window.showQuickPick([yes, no], { placeHolder: message });
277284

278285
if (pick !== yes) {
@@ -285,9 +292,9 @@ export class CommandCenter {
285292
@CommandCenter.Command('git.cleanAll')
286293
@CommandCenter.CatchErrors
287294
async cleanAll(): Promise<void> {
288-
const message = `Are you sure you want to clean all changes?`;
289-
const yes = 'Yes';
290-
const no = 'No, keep them';
295+
const message = localize('confirm clean all', "Are you sure you want to clean all changes?");
296+
const yes = localize('yes', "Yes");
297+
const no = localize('no, keep them', "No, keep them");
291298
const pick = await window.showQuickPick([yes, no], { placeHolder: message });
292299

293300
if (pick !== yes) {
@@ -359,8 +366,8 @@ export class CommandCenter {
359366
@CommandCenter.CatchErrors
360367
async branch(): Promise<void> {
361368
const result = await window.showInputBox({
362-
placeHolder: 'Branch name',
363-
prompt: 'Please provide a branch name'
369+
placeHolder: localize('branch name', "Branch name"),
370+
prompt: localize('provide branch name', "Please provide a branch name")
364371
});
365372

366373
if (!result) {
@@ -406,7 +413,7 @@ export class CommandCenter {
406413
async publish(): Promise<void> {
407414
const branchName = this.model.HEAD && this.model.HEAD.name || '';
408415
const picks = this.model.remotes.map(r => r.name);
409-
const placeHolder = `Pick a remote to publish the branch '${branchName}' to:`;
416+
const placeHolder = localize('pick remote', "Pick a remote to publish the branch '{0}' to:", branchName);
410417
const choice = await window.showQuickPick(picks, { placeHolder });
411418

412419
if (!choice) {

extensions/git/src/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import * as _ from 'lodash';
1515
import { EventEmitter, Event } from 'vscode';
1616
import * as nls from 'vscode-nls';
1717

18-
const localize = nls.loadMessageBundle(__filename);
18+
const localize = nls.loadMessageBundle();
1919
const readdir = denodeify(fs.readdir);
2020
const readfile = denodeify<string, string, string>(fs.readFile);
2121

extensions/git/src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { GitContentProvider } from './contentProvider';
1616
import { AutoFetcher } from './autofetch';
1717
import * as nls from 'vscode-nls';
1818

19-
nls.config();
19+
const localize = nls.config()();
2020

2121
async function init(disposables: Disposable[]): Promise<void> {
2222
const rootPath = workspace.rootPath;
@@ -36,8 +36,8 @@ async function init(disposables: Disposable[]): Promise<void> {
3636
const repositoryRoot = await repository.getRoot();
3737
const model = new Model(repositoryRoot, repository, onWorkspaceChange);
3838

39-
const outputChannel = window.createOutputChannel('git');
40-
outputChannel.appendLine(`Using git ${info.version} from ${info.path}`);
39+
const outputChannel = window.createOutputChannel('Git');
40+
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
4141
git.onOutput(str => outputChannel.append(str), null, disposables);
4242

4343
const commandCenter = new CommandCenter(model, outputChannel);

extensions/git/src/model.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { throttle, anyEvent, eventToPromise, filterEvent, mapEvent } from './uti
1111
import { watch } from './watch';
1212
import { decorate, memoize, debounce } from 'core-decorators';
1313
import * as path from 'path';
14+
import * as nls from 'vscode-nls';
1415

16+
const localize = nls.loadMessageBundle();
1517
const iconsRootPath = path.join(path.dirname(__dirname), 'resources', 'icons');
1618

1719
function getIconUri(iconName: string, theme: string): Uri {
@@ -129,7 +131,7 @@ export class MergeGroup extends ResourceGroup {
129131
static readonly ID = 'merge';
130132

131133
constructor(resources: Resource[]) {
132-
super(MergeGroup.ID, 'Merge Changes', resources);
134+
super(MergeGroup.ID, localize('merge changes', "Merge Changes"), resources);
133135
}
134136
}
135137

@@ -138,7 +140,7 @@ export class IndexGroup extends ResourceGroup {
138140
static readonly ID = 'index';
139141

140142
constructor(resources: Resource[]) {
141-
super(IndexGroup.ID, 'Staged Changes', resources);
143+
super(IndexGroup.ID, localize('staged changes', "Staged Changes"), resources);
142144
}
143145
}
144146

@@ -147,7 +149,7 @@ export class WorkingTreeGroup extends ResourceGroup {
147149
static readonly ID = 'workingTree';
148150

149151
constructor(resources: Resource[]) {
150-
super(WorkingTreeGroup.ID, 'Changes', resources);
152+
super(WorkingTreeGroup.ID, localize('changes', "Changes"), resources);
151153
}
152154
}
153155

0 commit comments

Comments
 (0)