diff --git a/extensions/git/package.json b/extensions/git/package.json index 21ba188e9c5822c9e11ac17797e3c994faf26a0d..12466f9340c4aef0322a47531c45a0dd97305b7a 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -23,7 +23,7 @@ "commands": [ { "command": "git.refresh", - "title": "Refresh", + "title": "%command.refresh%", "category": "Git", "icon": { "light": "resources/icons/light/refresh.svg", @@ -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", @@ -51,7 +51,7 @@ }, { "command": "git.stageAll", - "title": "Stage All", + "title": "%command.stageAll%", "category": "Git", "icon": { "light": "resources/icons/light/stage.svg", @@ -60,7 +60,7 @@ }, { "command": "git.unstage", - "title": "Unstage", + "title": "%command.unstage%", "category": "Git", "icon": { "light": "resources/icons/light/unstage.svg", @@ -69,7 +69,7 @@ }, { "command": "git.unstageAll", - "title": "Unstage All", + "title": "%command.unstageAll%", "category": "Git", "icon": { "light": "resources/icons/light/unstage.svg", @@ -78,7 +78,7 @@ }, { "command": "git.clean", - "title": "Clean", + "title": "%command.clean%", "category": "Git", "icon": { "light": "resources/icons/light/clean.svg", @@ -87,7 +87,7 @@ }, { "command": "git.cleanAll", - "title": "Clean All", + "title": "%command.cleanAll%", "category": "Git", "icon": { "light": "resources/icons/light/clean.svg", @@ -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" } ], @@ -352,7 +352,7 @@ { "id": "git-commit", "aliases": [ - "Git Commit Message", + "%language-alias.git-commit%", "git-commit" ], "filenames": [ @@ -364,7 +364,7 @@ { "id": "git-rebase", "aliases": [ - "Git Rebase Message", + "%language-alias.git-rebase%", "git-rebase" ], "filenames": [ diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json new file mode 100644 index 0000000000000000000000000000000000000000..282f4830455e9e43d5c7bbc5c9f349d98c989691 --- /dev/null +++ b/extensions/git/package.nls.json @@ -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" +} \ No newline at end of file diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 2d93fcf61425b3646427d10186e21de9cfd4c008..68419bd0af8cc13e378e2e111b5cef50ed8a81a8 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -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 { - 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 { 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 { 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) { diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 7ede35395df9af15b39b1a5bd4f63c65209e4e9e..24c64dc110c933c9cc6c170d3133bef750f10e43 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -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(fs.readFile); diff --git a/extensions/git/src/main.ts b/extensions/git/src/main.ts index 9ae2c38e69af20f30e6623f3d3f1659ca0339ba6..83fa024be5ee12d49dbaf421b09df4247aa2a03b 100644 --- a/extensions/git/src/main.ts +++ b/extensions/git/src/main.ts @@ -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 { const rootPath = workspace.rootPath; @@ -36,8 +36,8 @@ async function init(disposables: Disposable[]): Promise { 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); diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index 4b081ff398bdd85ff6eca774f55900e4cfcc8fc7..bd02d7e374d917a0ece3ac81b5dc89524cd2662b 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -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); } } diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index 3890f58642418a5dd51870c161bd2ef1145334e7..63193008c5f8994fb1f7803eca4bdf55b682ebcf 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -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();