related to #18615
This commit is contained in:
Joao Moreno
2017-01-17 17:38:00 +01:00
parent fab6f8871a
commit 43dd9b76b0
7 changed files with 87 additions and 48 deletions

View File

@@ -9,6 +9,9 @@ import { Uri, commands, scm, Disposable, SCMResourceGroup, SCMResource, window,
import { IRef, RefType } from './git';
import { Model, Resource, Status } from './model';
import * as path from 'path';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
function resolveGitURI(uri: Uri): SCMResource | SCMResourceGroup | undefined {
if (uri.authority !== 'git') {
@@ -50,12 +53,16 @@ class CheckoutItem implements QuickPickItem {
class CheckoutTagItem extends CheckoutItem {
get description(): string { return `Tag at ${this.shortCommit}`; }
get description(): string {
return localize('tag at', "Tag at {0}", this.shortCommit);
}
}
class CheckoutRemoteHeadItem extends CheckoutItem {
get description(): string { return `Remote branch at ${this.shortCommit}`; }
get description(): string {
return localize('remote branch at', "Remote branch at {0}", this.shortCommit);
}
protected get treeish(): string | undefined {
if (!this.ref.name) {
@@ -93,7 +100,7 @@ export class CommandCenter {
switch (err.gitErrorCode) {
case 'DirtyWorkTree':
message = 'Please clean your repository working tree before checkout.';
message = localize('clean repo', "Please clean your repository working tree before checkout.");
break;
default:
message = (err.stderr || err.message).replace(/^error: /, '');
@@ -106,7 +113,7 @@ export class CommandCenter {
}
const outputChannel = this.outputChannel as OutputChannel;
const openOutputChannelChoice = 'Open Git Log';
const openOutputChannelChoice = localize('open git log', "Open Git Log");
const choice = await window.showErrorMessage(message, openOutputChannelChoice);
if (choice === openOutputChannelChoice) {
@@ -270,9 +277,9 @@ export class CommandCenter {
}
const basename = path.basename(resource.uri.fsPath);
const message = `Are you sure you want to clean changes in ${basename}?`;
const yes = 'Yes';
const no = 'No, keep them';
const message = localize('confirm clean', "Are you sure you want to clean changes in {0}?", basename);
const yes = localize('yes', "Yes");
const no = localize('no, keep them', "No, keep them");
const pick = await window.showQuickPick([yes, no], { placeHolder: message });
if (pick !== yes) {
@@ -285,9 +292,9 @@ export class CommandCenter {
@CommandCenter.Command('git.cleanAll')
@CommandCenter.CatchErrors
async cleanAll(): Promise<void> {
const message = `Are you sure you want to clean all changes?`;
const yes = 'Yes';
const no = 'No, keep them';
const message = localize('confirm clean all', "Are you sure you want to clean all changes?");
const yes = localize('yes', "Yes");
const no = localize('no, keep them', "No, keep them");
const pick = await window.showQuickPick([yes, no], { placeHolder: message });
if (pick !== yes) {
@@ -359,8 +366,8 @@ export class CommandCenter {
@CommandCenter.CatchErrors
async branch(): Promise<void> {
const result = await window.showInputBox({
placeHolder: 'Branch name',
prompt: 'Please provide a branch name'
placeHolder: localize('branch name', "Branch name"),
prompt: localize('provide branch name', "Please provide a branch name")
});
if (!result) {
@@ -406,7 +413,7 @@ export class CommandCenter {
async publish(): Promise<void> {
const branchName = this.model.HEAD && this.model.HEAD.name || '';
const picks = this.model.remotes.map(r => r.name);
const placeHolder = `Pick a remote to publish the branch '${branchName}' to:`;
const placeHolder = localize('pick remote', "Pick a remote to publish the branch '{0}' to:", branchName);
const choice = await window.showQuickPick(picks, { placeHolder });
if (!choice) {

View File

@@ -15,7 +15,7 @@ import * as _ from 'lodash';
import { EventEmitter, Event } from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle(__filename);
const localize = nls.loadMessageBundle();
const readdir = denodeify(fs.readdir);
const readfile = denodeify<string, string, string>(fs.readFile);

View File

@@ -16,7 +16,7 @@ import { GitContentProvider } from './contentProvider';
import { AutoFetcher } from './autofetch';
import * as nls from 'vscode-nls';
nls.config();
const localize = nls.config()();
async function init(disposables: Disposable[]): Promise<void> {
const rootPath = workspace.rootPath;
@@ -36,8 +36,8 @@ async function init(disposables: Disposable[]): Promise<void> {
const repositoryRoot = await repository.getRoot();
const model = new Model(repositoryRoot, repository, onWorkspaceChange);
const outputChannel = window.createOutputChannel('git');
outputChannel.appendLine(`Using git ${info.version} from ${info.path}`);
const outputChannel = window.createOutputChannel('Git');
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
git.onOutput(str => outputChannel.append(str), null, disposables);
const commandCenter = new CommandCenter(model, outputChannel);

View File

@@ -11,7 +11,9 @@ import { throttle, anyEvent, eventToPromise, filterEvent, mapEvent } from './uti
import { watch } from './watch';
import { decorate, memoize, debounce } from 'core-decorators';
import * as path from 'path';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
const iconsRootPath = path.join(path.dirname(__dirname), 'resources', 'icons');
function getIconUri(iconName: string, theme: string): Uri {
@@ -129,7 +131,7 @@ export class MergeGroup extends ResourceGroup {
static readonly ID = 'merge';
constructor(resources: Resource[]) {
super(MergeGroup.ID, 'Merge Changes', resources);
super(MergeGroup.ID, localize('merge changes', "Merge Changes"), resources);
}
}
@@ -138,7 +140,7 @@ export class IndexGroup extends ResourceGroup {
static readonly ID = 'index';
constructor(resources: Resource[]) {
super(IndexGroup.ID, 'Staged Changes', resources);
super(IndexGroup.ID, localize('staged changes', "Staged Changes"), resources);
}
}
@@ -147,7 +149,7 @@ export class WorkingTreeGroup extends ResourceGroup {
static readonly ID = 'workingTree';
constructor(resources: Resource[]) {
super(WorkingTreeGroup.ID, 'Changes', resources);
super(WorkingTreeGroup.ID, localize('changes', "Changes"), resources);
}
}

View File

@@ -8,6 +8,9 @@
import { window, Disposable, StatusBarItem, StatusBarAlignment } from 'vscode';
import { RefType, IBranch } from './git';
import { Model, Operation } from './model';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class CheckoutStatusBar {
@@ -116,11 +119,11 @@ export class SyncStatusBar {
text += `${HEAD.behind}${HEAD.ahead}`;
}
command = 'git.sync';
tooltip = 'Synchronize changes';
tooltip = localize('sync changes', "Synchronize changes");
} else {
icon = '$(cloud-upload)';
command = 'git.publish';
tooltip = 'Publish changes';
tooltip = localize('publish changes', "Publish changes");
}
} else {
command = '';
@@ -130,7 +133,7 @@ export class SyncStatusBar {
if (this.state.isSyncRunning) {
text = '';
command = '';
tooltip = 'Synchronizing changes...';
tooltip = localize('syncing changes', "Synchronizing changes...");
}
this.raw.text = [icon, text].join(' ').trim();