From c24bfc336c2c19acbc520414548e62885665fb85 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 5 Mar 2021 17:54:27 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84&=20localization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/github/src/publish.ts | 18 ++++++++++++------ extensions/github/src/pushErrorHandler.ts | 8 ++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/extensions/github/src/publish.ts b/extensions/github/src/publish.ts index cf8f306cf2d..af75e3e476b 100644 --- a/extensions/github/src/publish.ts +++ b/extensions/github/src/publish.ts @@ -168,7 +168,12 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository) } const githubRepository = await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: false, title: 'Publish to GitHub' }, async progress => { - progress.report({ message: `Publishing to GitHub ${isPrivate ? 'private' : 'public'} repository`, increment: 25 }); + progress.report({ + message: isPrivate + ? localize('publishing_private', "Publishing to a private GitHub repository") + : localize('publishing_public', "Publishing to a public GitHub repository"), + increment: 25 + }); const res = await octokit.repos.createForAuthenticatedUser({ name: repo!, @@ -177,7 +182,7 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository) const createdGithubRepository = res.data; - progress.report({ message: 'Creating first commit', increment: 25 }); + progress.report({ message: localize('publishing_firstcommit', "Creating first commit"), increment: 25 }); if (!repository) { repository = await gitAPI.init(folder) || undefined; @@ -189,7 +194,8 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository) await repository.commit('first commit', { all: true }); } - progress.report({ message: 'Uploading files', increment: 25 }); + progress.report({ message: localize('publishing_uploading', "Uploading files"), increment: 25 }); + const branch = await repository.getBranch('HEAD'); await repository.addRemote('origin', createdGithubRepository.clone_url); await repository.push('origin', branch.name, true); @@ -201,9 +207,9 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository) return; } - const openInGitHub = 'Open In GitHub'; - vscode.window.showInformationMessage(`Successfully published the '${owner}/${repo}' repository on GitHub.`, openInGitHub).then(action => { - if (action === openInGitHub) { + const openOnGitHub = localize('openingithub', "Open on GitHub"); + vscode.window.showInformationMessage(localize('publishing_done', "Successfully published the '{0}' repository to GitHub.", `${owner}/${repo}`), openOnGitHub).then(action => { + if (action === openOnGitHub) { vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(githubRepository.html_url)); } }); diff --git a/extensions/github/src/pushErrorHandler.ts b/extensions/github/src/pushErrorHandler.ts index 0b2f3b9de60..0303dfc5c0e 100644 --- a/extensions/github/src/pushErrorHandler.ts +++ b/extensions/github/src/pushErrorHandler.ts @@ -33,7 +33,7 @@ async function handlePushError(repository: Repository, remote: Remote, refspec: const res = await octokit.repos.createFork({ owner, repo }); const ghRepository = res.data; - progress.report({ message: localize('pushing', "Pushing changes..."), increment: 33 }); + progress.report({ message: localize('forking_pushing', "Pushing changes..."), increment: 33 }); // Issue: what if there's already an `upstream` repo? await repository.renameRemote(remote.name, 'upstream'); @@ -55,11 +55,11 @@ async function handlePushError(repository: Repository, remote: Remote, refspec: // yield (async () => { - const openInGitHub = localize('openingithub', "Open In GitHub"); + const openOnGitHub = localize('openingithub', "Open on GitHub"); const createPR = localize('createpr', "Create PR"); - const action = await window.showInformationMessage(localize('done', "The fork '{0}' was successfully created on GitHub.", ghRepository.full_name), openInGitHub, createPR); + const action = await window.showInformationMessage(localize('forking_done', "The fork '{0}' was successfully created on GitHub.", ghRepository.full_name), openOnGitHub, createPR); - if (action === openInGitHub) { + if (action === openOnGitHub) { await commands.executeCommand('vscode.open', Uri.parse(ghRepository.html_url)); } else if (action === createPR) { const pr = await window.withProgress({ location: ProgressLocation.Notification, cancellable: false, title: localize('createghpr', "Creating GitHub Pull Request...") }, async _ => {