Skip to content

Commit

Permalink
git: nls
Browse files Browse the repository at this point in the history
related to #18615
  • Loading branch information
joaomoreno committed Jan 17, 2017
1 parent fab6f88 commit 43dd9b7
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 48 deletions.
50 changes: 25 additions & 25 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"commands": [
{
"command": "git.refresh",
"title": "Refresh",
"title": "%command.refresh%",
"category": "Git",
"icon": {
"light": "resources/icons/light/refresh.svg",
Expand All @@ -32,17 +32,17 @@
},
{
"command": "git.openChange",
"title": "Open Change",
"title": "%command.openChange%",
"category": "Git"
},
{
"command": "git.openFile",
"title": "Open File",
"title": "%command.openFile%",
"category": "Git"
},
{
"command": "git.stage",
"title": "Stage",
"title": "%command.stage%",
"category": "Git",
"icon": {
"light": "resources/icons/light/stage.svg",
Expand All @@ -51,7 +51,7 @@
},
{
"command": "git.stageAll",
"title": "Stage All",
"title": "%command.stageAll%",
"category": "Git",
"icon": {
"light": "resources/icons/light/stage.svg",
Expand All @@ -60,7 +60,7 @@
},
{
"command": "git.unstage",
"title": "Unstage",
"title": "%command.unstage%",
"category": "Git",
"icon": {
"light": "resources/icons/light/unstage.svg",
Expand All @@ -69,7 +69,7 @@
},
{
"command": "git.unstageAll",
"title": "Unstage All",
"title": "%command.unstageAll%",
"category": "Git",
"icon": {
"light": "resources/icons/light/unstage.svg",
Expand All @@ -78,7 +78,7 @@
},
{
"command": "git.clean",
"title": "Clean",
"title": "%command.clean%",
"category": "Git",
"icon": {
"light": "resources/icons/light/clean.svg",
Expand All @@ -87,7 +87,7 @@
},
{
"command": "git.cleanAll",
"title": "Clean All",
"title": "%command.cleanAll%",
"category": "Git",
"icon": {
"light": "resources/icons/light/clean.svg",
Expand All @@ -96,72 +96,72 @@
},
{
"command": "git.commitStaged",
"title": "Commit Staged",
"title": "%command.commitStaged%",
"category": "Git"
},
{
"command": "git.commitStagedSigned",
"title": "Commit Staged (Signed Off)",
"title": "%command.commitStagedSigned%",
"category": "Git"
},
{
"command": "git.commitAll",
"title": "Commit All",
"title": "%command.commitAll%",
"category": "Git"
},
{
"command": "git.commitAllSigned",
"title": "Commit All (Signed Off)",
"title": "%command.commitAllSigned%",
"category": "Git"
},
{
"command": "git.undoCommit",
"title": "Undo Last Commit",
"title": "%command.undoCommit%",
"category": "Git"
},
{
"command": "git.checkout",
"title": "Checkout to...",
"title": "%command.checkout%",
"category": "Git"
},
{
"command": "git.branch",
"title": "Create Branch...",
"title": "%command.branch%",
"category": "Git"
},
{
"command": "git.pull",
"title": "Pull",
"title": "%command.pull%",
"category": "Git"
},
{
"command": "git.pullRebase",
"title": "Pull (Rebase)",
"title": "%command.pullRebase%",
"category": "Git"
},
{
"command": "git.push",
"title": "Push",
"title": "%command.push%",
"category": "Git"
},
{
"command": "git.pushTo",
"title": "Push to...",
"title": "%command.pushTo%",
"category": "Git"
},
{
"command": "git.sync",
"title": "Sync",
"title": "%command.sync%",
"category": "Git"
},
{
"command": "git.publish",
"title": "Publish",
"title": "%command.publish%",
"category": "Git"
},
{
"command": "git.showOutput",
"title": "Show Git Output",
"title": "%command.showOutput%",
"category": "Git"
}
],
Expand Down Expand Up @@ -352,7 +352,7 @@
{
"id": "git-commit",
"aliases": [
"Git Commit Message",
"%language-alias.git-commit%",
"git-commit"
],
"filenames": [
Expand All @@ -364,7 +364,7 @@
{
"id": "git-rebase",
"aliases": [
"Git Rebase Message",
"%language-alias.git-rebase%",
"git-rebase"
],
"filenames": [
Expand Down
27 changes: 27 additions & 0 deletions extensions/git/package.nls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"command.refresh": "Refresh",
"command.openChange": "Open Change",
"command.openFile": "Open File",
"command.stage": "Stage",
"command.stageAll": "Stage All",
"command.unstage": "Unstage",
"command.unstageAll": "Unstage All",
"command.clean": "Clean",
"command.cleanAll": "Clean All",
"command.commitStaged": "Commit Staged",
"command.commitStagedSigned": "Commit Staged (Signed Off)",
"command.commitAll": "Commit All",
"command.commitAllSigned": "Commit All (Signed Off)",
"command.undoCommit": "Undo Last Commit",
"command.checkout": "Checkout to...",
"command.branch": "Create Branch...",
"command.pull": "Pull",
"command.pullRebase": "Pull (Rebase)",
"command.push": "Push",
"command.pushTo": "Push to...",
"command.sync": "Sync",
"command.publish": "Publish",
"command.showOutput": "Show Git Output",
"language-alias.git-commit": "Git Commit Message",
"language-alias.git-rebase": "Git Rebase Message"
}
33 changes: 20 additions & 13 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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: /, '');
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions extensions/git/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions extensions/git/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand Down
Loading

0 comments on commit 43dd9b7

Please sign in to comment.