💄& localization

This commit is contained in:
Eric Amodio 2021-03-05 17:54:27 -05:00
parent daf840b929
commit c24bfc336c
2 changed files with 16 additions and 10 deletions

View file

@ -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 => { 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({ const res = await octokit.repos.createForAuthenticatedUser({
name: repo!, name: repo!,
@ -177,7 +182,7 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository)
const createdGithubRepository = res.data; 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) { if (!repository) {
repository = await gitAPI.init(folder) || undefined; 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 }); 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'); const branch = await repository.getBranch('HEAD');
await repository.addRemote('origin', createdGithubRepository.clone_url); await repository.addRemote('origin', createdGithubRepository.clone_url);
await repository.push('origin', branch.name, true); await repository.push('origin', branch.name, true);
@ -201,9 +207,9 @@ export async function publishRepository(gitAPI: GitAPI, repository?: Repository)
return; return;
} }
const openInGitHub = 'Open In GitHub'; const openOnGitHub = localize('openingithub', "Open on GitHub");
vscode.window.showInformationMessage(`Successfully published the '${owner}/${repo}' repository on GitHub.`, openInGitHub).then(action => { vscode.window.showInformationMessage(localize('publishing_done', "Successfully published the '{0}' repository to GitHub.", `${owner}/${repo}`), openOnGitHub).then(action => {
if (action === openInGitHub) { if (action === openOnGitHub) {
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(githubRepository.html_url)); vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(githubRepository.html_url));
} }
}); });

View file

@ -33,7 +33,7 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
const res = await octokit.repos.createFork({ owner, repo }); const res = await octokit.repos.createFork({ owner, repo });
const ghRepository = res.data; 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? // Issue: what if there's already an `upstream` repo?
await repository.renameRemote(remote.name, 'upstream'); await repository.renameRemote(remote.name, 'upstream');
@ -55,11 +55,11 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
// yield // yield
(async () => { (async () => {
const openInGitHub = localize('openingithub', "Open In GitHub"); const openOnGitHub = localize('openingithub', "Open on GitHub");
const createPR = localize('createpr', "Create PR"); 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)); await commands.executeCommand('vscode.open', Uri.parse(ghRepository.html_url));
} else if (action === createPR) { } else if (action === createPR) {
const pr = await window.withProgress({ location: ProgressLocation.Notification, cancellable: false, title: localize('createghpr', "Creating GitHub Pull Request...") }, async _ => { const pr = await window.withProgress({ location: ProgressLocation.Notification, cancellable: false, title: localize('createghpr', "Creating GitHub Pull Request...") }, async _ => {