💄& 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 => {
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));
}
});

View file

@ -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 _ => {