From 8522fe2c4b010101dbbf6331d0f8dab215e358d0 Mon Sep 17 00:00:00 2001 From: Nikolay Rykunov Date: Tue, 7 Apr 2020 16:12:25 +0300 Subject: [PATCH] [git] Localize GitStashChangesSaver GitOrigin-RevId: 8ed28e77113dc36008bbca67816e8617b12b33b8 --- .../resources/messages/GitBundle.properties | 12 ++++- .../src/git4idea/stash/GitChangesSaver.java | 4 +- .../git4idea/stash/GitStashChangesSaver.java | 48 ++++++++----------- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/plugins/git4idea/resources/messages/GitBundle.properties b/plugins/git4idea/resources/messages/GitBundle.properties index eaa36d855f8b..07e0957cb275 100644 --- a/plugins/git4idea/resources/messages/GitBundle.properties +++ b/plugins/git4idea/resources/messages/GitBundle.properties @@ -266,9 +266,13 @@ preserving.process.local.changes.not.restored.error.title=Local changes were not restore.notification.failed.shelf.message=Before update your uncommitted changes were saved to shelf.
Update is not complete, you have unresolved merges in your working tree
Resolve conflicts, complete update and restore changes manually. restore.notification.failed.stash.message=Before update your uncommitted changes were saved to stash.
Update is not complete, you have unresolved merges in your working tree
Resolve conflicts, complete update and restore changes manually. restore.notification.failed.title=Local changes were not restored + +save.load.conflict.dialog.diff.left.title=Your uncommitted changes +save.load.conflict.dialog.diff.right.title=Changes from remote save.notification.failed.shelf.text=Tried to save uncommitted changes in shelf before {0}, but failed with an error.
{1} save.notification.failed.stash.text=Tried to save uncommitted changes in stash before {0}, but failed with an error.
{1} save.notification.failed.title=Couldn't save uncommitted changes + smart.operation.dialog.north.panel.label.shelf.text=Your local changes to the following files would be overwritten by {0}.
{1} can shelve the changes, {0} and unshelve them after that. smart.operation.dialog.north.panel.label.stash.text=Your local changes to the following files would be overwritten by {0}.
{1} can stash the changes, {0} and unstash them after that. smart.operation.dialog.ok.action.shelf.description=Shelve local changes, {0}, unshelve @@ -287,15 +291,21 @@ ssh.keyboard.interactive.username=Username: ssh.new.host.key=Connecting to a new host {0}:{1,number,#} that has the key {2} (type {3}).\nDo you want to add this host to known hosts database? ssh.password.message=Password for user {0}: ssh.password.title=SSH Password Login + stash.action.name=Stash stash.button=Create Stash +stash.error.can.not.stash.changes.now=Can not stash changes now stash.keep.index.tooltip=If this checkbox is selected, indexed changes are kept in the index. stash.keep.index=Keep &index stash.message.tooltip=Enter stash message here. stash.message=&Message: +stash.progress.indicator.title=Stashing changes from ''{0}''... stash.title=Stash +stash.unstash.conflict.dialog.description.label.text=Uncommitted changes that were stashed before update have conflicts with updated files. +stash.unstash.progress.indicator.title=Popping changes to ''{0}''... +stash.unstash.unresolved.conflict.warning.notification.message=Your uncommitted changes were saved to stash.
Unstash is not complete, you have unresolved merges in your working tree
Resolve conflicts and drop the stash. +stash.unstash.unresolved.conflict.warning.notification.title=Local changes were restored with conflicts stashing.title=Stashing Changes... -stash.error.can.not.stash.changes.now=Can not stash changes now tag.action.name=Tag tag.button=Create Tag diff --git a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java index 29d3e12f8994..7cc54519deb5 100644 --- a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java @@ -125,7 +125,7 @@ public abstract class GitChangesSaver { */ @NotNull protected static String getConflictRightPanelTitle() { - return "Changes from remote"; + return GitBundle.getString("save.load.conflict.dialog.diff.right.title"); } /** @@ -133,7 +133,7 @@ public abstract class GitChangesSaver { */ @NotNull protected static String getConflictLeftPanelTitle() { - return "Your uncommitted changes"; + return GitBundle.getString("save.load.conflict.dialog.diff.left.title"); } protected class ShowSavedChangesNotificationListener implements NotificationListener { diff --git a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java index e3a00d486d83..39726b74e219 100644 --- a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.stash; import com.intellij.notification.Notification; @@ -51,7 +51,7 @@ public class GitStashChangesSaver extends GitChangesSaver { LOG.info("saving " + rootsToSave); for (VirtualFile root : rootsToSave) { - final String message = "Stashing changes from '" + root.getName() + "'..."; + String message = GitBundle.message("stash.progress.indicator.title", root.getName()); LOG.info(message); final String oldProgressTitle = myProgressIndicator.getText(); myProgressIndicator.setText(message); @@ -86,7 +86,7 @@ public class GitStashChangesSaver extends GitChangesSaver { public void load() { final String oldProgressTitle = myProgressIndicator.getText(); GitStashUtils.unstash(myProject, myStashedRoots, (root) -> { - final String message = "Popping changes to '" + root.getName() + "'..."; + String message = GitBundle.message("stash.unstash.progress.indicator.title", root.getName()); myProgressIndicator.setText(message); GitLineHandler handler = new GitLineHandler(myProject, root, GitCommand.STASH); handler.addParameters("pop"); @@ -134,29 +134,23 @@ public class GitStashChangesSaver extends GitChangesSaver { @Override protected void notifyUnresolvedRemain() { - VcsNotifier.getInstance(myProject).notifyImportantWarning("Local changes were restored with conflicts", - "Your uncommitted changes were saved to stash.
" + - "Unstash is not complete, you have unresolved merges in your working tree
" + - "Resolve conflicts and drop the stash.", - new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, - @NotNull HyperlinkEvent event) { - if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - if (event.getDescription().equals("saver")) { - // we don't use #showSavedChanges to specify unmerged root first - GitUnstashDialog.showUnstashDialog(myProject, - new ArrayList<>( - myStashedRoots), - myStashedRoots.iterator().next() - ); - } - else if (event.getDescription().equals("resolve")) { - mergeNoProceed(); - } - } - } - } + VcsNotifier.getInstance(myProject).notifyImportantWarning( + GitBundle.getString("stash.unstash.unresolved.conflict.warning.notification.title"), + GitBundle.getString("stash.unstash.unresolved.conflict.warning.notification.message"), + new NotificationListener() { + @Override + public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { + if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if (event.getDescription().equals("saver")) { + // we don't use #showSavedChanges to specify unmerged root first + GitUnstashDialog.showUnstashDialog(myProject, new ArrayList<>(myStashedRoots), myStashedRoots.iterator().next()); + } + else if (event.getDescription().equals("resolve")) { + mergeNoProceed(); + } + } + } + } ); } @@ -167,7 +161,7 @@ public class GitStashChangesSaver extends GitChangesSaver { @NotNull @Override public String getMultipleFileMergeDescription(@NotNull Collection files) { - return "Uncommitted changes that were stashed before update have conflicts with updated files."; + return GitBundle.getString("stash.unstash.conflict.dialog.description.label.text"); } @NotNull