git: fix i18n warnings
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 20 Aug 2020 18:42:45 +0000 (21:42 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 20 Aug 2020 19:51:35 +0000 (19:51 +0000)
GitOrigin-RevId: efaf9e945493c764824abfacd256fd6f039923f6

15 files changed:
platform/dvcs-api/resources/messages/DvcsBundle.properties
platform/vcs-impl/src/git4idea/annotate/AnnotationTooltipBuilder.java
plugins/git4idea/resources/messages/GitBundle.properties
plugins/git4idea/src/git4idea/GitUtil.java
plugins/git4idea/src/git4idea/changes/GitChangeUtils.java
plugins/git4idea/src/git4idea/changes/GitCommittedChangeListProvider.java
plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
plugins/git4idea/src/git4idea/checkin/GitCommitAndPushExecutor.kt
plugins/git4idea/src/git4idea/checkin/GitSkipHooksCommitHandlerFactory.kt
plugins/git4idea/src/git4idea/checkin/GitUnresolvedMergeCheckProvider.kt
plugins/git4idea/src/git4idea/checkin/GitUserNameNotDefinedDialog.java
plugins/git4idea/src/git4idea/checkout/GitCheckoutProvider.java
plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
plugins/git4idea/src/git4idea/config/GitConfigUtil.java

index eb5865422c9d034f5e0d68a24ea1178173faad41..7b4c738dc33b8565a4cf7061e9330961eb7590bc 100644 (file)
@@ -19,6 +19,7 @@ clone.repository.url.autocomplete.hint={0} repositories completion available ( {
 clone.repository.url.autocomplete.login.text=Log in to {0}...
 clone.repository.url.autocomplete.login.tooltip=Log in to see your repositories in the URL list
 cloning.repository=Cloning Source Repository {0}
+error.title.cloning.repository.failed=Clone failed
 sync.setting=Execute branch operations on all roots
 sync.setting.description=If selected, you would be able to checkout, compare, delete and create new branches in all {0} \
                          roots with a single action. It will also affect behavior of the push dialog.
index 52874791c8ea6539edee641b286c0977104c4e18..6f985dd36ebd22d0f3da7338a2f565c61b9792f6 100644 (file)
@@ -78,6 +78,7 @@ public class AnnotationTooltipBuilder {
     return sb.toString();
   }
 
+  @Nls
   @NotNull
   public static String buildSimpleTooltip(@NotNull Project project,
                                           boolean asHtml,
index 42fd2cc613a56a79462b2a60c2ac4e024a60b077..e92c16b4f9ebfef474eb70d666852f8221e26dc6 100644 (file)
@@ -10,7 +10,7 @@ commit.action.commit.and.rebase.text=Commit and Rebase...
 commit.action.name=Comm&it
 commit.author.diffs=<html>Author differs from default</html>
 commit.author=&Author:
-commit.partial.merge.message=Partial commit during a {0} is not allowed.\n\
+commit.partial.merge.message=Partial commit during a {0,choice,1#merge|2#cherry-pick} is not allowed.\n\
   The following files are not included in commit.\n\
   Perform commit with all files included?
 commit.partial.merge.title=Partial Merge Commit
@@ -552,6 +552,7 @@ action.Git.Log.text=Show Git Repository Log...
 action.Git.Init.text=Create Git Repository...
 checkbox.dont.warn.again=Don't warn again
 checkbox.run.git.hooks=Run Git hooks
+tooltip.run.git.hooks=If unchecked, Git hooks will be skipped with the '--no-verify' parameter
 action.NotificationAction.text.resolve=Resolve...
 action.NotificationAction.GitDeleteBranchOperation.text.restore=Restore
 action.NotificationAction.GitDeleteBranchOperation.text.view.commits=View Commits
@@ -1063,4 +1064,39 @@ title.sudo.command.install.git=Install Git
 
 activity.name.unstash=Unstash
 notification.title.unstash.failed=Unstash Failed
-exception.message.could.not.stash.root.error=Couldn''t stash {0}: {1}
\ No newline at end of file
+exception.message.could.not.stash.root.error=Couldn''t stash {0}: {1}
+error.git.parse.unknown.file.status=Unknown file status: {0}
+error.git.parse.not.a.revision.number=The string ''{0}'' does not represent a revision number
+error.git.repository.not.found=The repository does not exists anymore: {0}
+
+title.changes.excluded.from.commit=Changes Excluded from Merge Commit
+label.changes.excluded.from.commit.are.you.sure.want.to.continue=Are you sure you want to exclude these changed files from merge commit?
+button.changes.excluded.from.commit.commit.anyway=Commit Anyway
+title.unresolved.conflicts.pre.commit.check=Unresolved Conflicts
+message.unresolved.conflicts.prevent.commit=Can't commit changes due to unresolved conflicts.
+
+label.user.name=Name:
+label.user.email=E-mail:
+checkbox.set.config.property.globally=Set properties globally
+title.user.name.email.not.specified=Git User Name Is Not Defined
+button.set.name.and.commit=Set and Commit
+validation.warning.set.name.email.for.git=You have to specify user name and email for Git
+label.name.email.not.defined.in.n.roots=Git user.name and user.email properties are not defined in {0,choice,1#root|2#roots} 
+error.cant.set.user.name.email=Couldn't set user.name and user.email
+progress.checking.user.name.email=Checking Git User Name...
+progress.setting.user.name.email=Setting Git User Name...
+progress.setting.config.value=Updating Git Config...
+progress.checking.line.separator.issues=Checking for Line Separator Issues...
+error.title.git.version.does.not.define.home.env=HOME Variable Is Not Defined
+error.message.git.version.does.not.define.home.env=You are using Git {0} which doesn''t define %HOME% environment variable properly.\nConsider updating Git to a newer version or define %HOME% to point to the place where the global .gitconfig is stored \n(it is usually %USERPROFILE% or %HOMEDRIVE%%HOMEPATH%).
+warning.title.commit.with.unfinished.rebase=Unfinished Rebase Process
+warning.message.commit.with.unfinished.rebase=The Git repository at the following path has an <b>unfinished rebase</b> process:<br/>{0}<br/>You probably want to <b>continue rebase</b> instead of committing.<br/>Committing during rebase may lead to the commit loss.
+link.label.commit.with.unfinished.rebase.read.more=Read more about Git rebase
+warning.title.commit.with.detached.head=Commit in Detached HEAD
+warning.message.commit.with.detached.head=The Git repository at the following path is in the <b>detached HEAD</b> state:<br/>{0}<br/>You can look around, make experimental changes and commit them, but be sure to checkout a branch not to lose your work.<br/>Otherwise you risk losing your changes.
+link.label.commit.with.detached.head.read.more=Read more about detached HEAD
+error.commit.cant.collect.partial.changes=Can't collect partial changes to commit
+error.commit.cant.commit.multiple.changelists=Can't commit changes from multiple changelists at once
+error.commit.cant.commit.with.unmerged.paths=Committing is not possible because you have unmerged files.
+error.commit.cant.create.message.file=Creation of commit message file failed
+button.commit.all.files=Commit All Files
\ No newline at end of file
index eb21837df36f8316ed4082ce7c925b2d6662b247..7c26dd8977204fb1c85ba56de688cd1906d6c6b1 100644 (file)
@@ -837,9 +837,10 @@ public final class GitUtil {
     builder.show();
   }
 
+  @NlsSafe
   @NotNull
-  public static String cleanupErrorPrefixes(@NotNull String msg) {
-    final String[] PREFIXES = { "fatal:", "error:" };
+  public static String cleanupErrorPrefixes(@NotNull @NlsSafe String msg) {
+    final @NonNls String[] PREFIXES = { "fatal:", "error:" };
     msg = msg.trim();
     for (String prefix : PREFIXES) {
       if (msg.startsWith(prefix)) {
index 8211947f91062771398bcc5a87b07fa83f2097e2..f5ca4d4c4b1d9bd6df1408d72e1fd3b57828e137 100644 (file)
@@ -18,6 +18,7 @@ import git4idea.GitRevisionNumber;
 import git4idea.GitUtil;
 import git4idea.GitVcs;
 import git4idea.commands.*;
+import git4idea.i18n.GitBundle;
 import git4idea.repo.GitRepository;
 import git4idea.util.StringScanner;
 import org.jetbrains.annotations.NonNls;
@@ -139,7 +140,7 @@ public final class GitChangeUtils {
           after = filePath;
           break;
         default:
-          throw new VcsException("Unknown file status: " + Arrays.asList(tokens));
+          throw new VcsException(GitBundle.message("error.git.parse.unknown.file.status", Arrays.asList(tokens)));
       }
       consumer.consume(status, before, after);
     }
@@ -172,8 +173,7 @@ public final class GitChangeUtils {
       catch (VcsException e) {
         LOG.info("Exception while trying to get some diagnostics info", e);
       }
-      throw new VcsException(String.format("The string '%s' does not represent a revision number. Output: [%s]\n Root: %s",
-                                           reference, output, vcsRoot));
+      throw new VcsException(GitBundle.message("error.git.parse.not.a.revision.number", reference));
     }
     Date timestamp = GitUtil.parseTimestampWithNFEReport(stk.nextToken(), handler, output);
     return new GitRevisionNumber(stk.nextToken(), timestamp);
index 570cb279c5d27af3e06f0b6e0752d1c0c9956af4..144f3c0eb21bc2597e598a7002db5e322070a8c0 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.vcsUtil.VcsUtil;
 import git4idea.*;
 import git4idea.history.GitFileHistory;
 import git4idea.history.GitHistoryUtils;
+import git4idea.i18n.GitBundle;
 import git4idea.repo.GitRepository;
 import git4idea.repo.GitRepositoryManager;
 import org.jetbrains.annotations.NotNull;
@@ -109,7 +110,7 @@ public class GitCommittedChangeListProvider implements CommittedChangesProvider<
     final String author = settings.getUserFilter();
     VirtualFile root = LocalFileSystem.getInstance().findFileByIoFile(l.getRoot());
     if (root == null) {
-      throw new VcsException("The repository does not exists anymore: " + l.getRoot());
+      throw new VcsException(GitBundle.message("error.git.repository.not.found", l.getRoot()));
     }
 
     GitUtil.getLocalCommittedChanges(myProject, root, h -> {
index 4bb72d90cb3a767271d70897cf44caa3d36c58f7..de6f74cec9c86f4bece0c641431ab748af03c78e 100644 (file)
@@ -10,6 +10,7 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.application.TransactionGuard;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.diff.DiffBundle;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
 import com.intellij.openapi.project.Project;
@@ -60,7 +61,6 @@ import git4idea.repo.GitRepository;
 import git4idea.repo.GitRepositoryManager;
 import git4idea.util.GitFileUtils;
 import gnu.trove.THashSet;
-import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -314,7 +314,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
 
       List<FilePath> unmergedFiles = GitChangeUtils.getUnmergedFiles(repository);
       if (!unmergedFiles.isEmpty()) {
-        throw new VcsException("Committing is not possible because you have unmerged files.");
+        throw new VcsException(GitBundle.message("error.commit.cant.commit.with.unmerged.paths"));
       }
 
       // Check what is staged besides our changes
@@ -376,7 +376,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
                                                                       @NotNull Collection<? extends CommitChange> changes) throws VcsException {
     Set<String> changelistIds = map2SetNotNull(changes, change -> change.changelistId);
     if (changelistIds.isEmpty()) return Pair.create(EmptyRunnable.INSTANCE, emptyList());
-    if (changelistIds.size() != 1) throw new VcsException("Can't commit changes from multiple changelists at once");
+    if (changelistIds.size() != 1) throw new VcsException(GitBundle.message("error.commit.cant.commit.multiple.changelists"));
     String changelistId = changelistIds.iterator().next();
 
     Pair<List<PartialCommitHelper>, List<CommitChange>> result = computeAfterLSTManagerUpdate(repository.getProject(), () -> {
@@ -404,7 +404,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
       return Pair.create(helpers, partialChanges);
     });
 
-    if (result == null) throw new VcsException("Can't collect partial changes to commit");
+    if (result == null) throw new VcsException(GitBundle.message("error.commit.cant.collect.partial.changes"));
     List<PartialCommitHelper> helpers = result.first;
     List<CommitChange> partialChanges = result.second;
 
@@ -426,7 +426,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
       FilePath path = Objects.requireNonNull(change.afterPath);
       PartialCommitHelper helper = helpers.get(i);
       VirtualFile file = change.virtualFile;
-      if (file == null) throw new VcsException("Can't find file: " + path.getPath());
+      if (file == null) throw new VcsException(DiffBundle.message("cannot.find.file.error", path.getPresentableUrl()));
 
       GitIndexUtil.StagedFile stagedFile = getStagedFile(repository, change);
       boolean isExecutable = stagedFile != null && stagedFile.isExecutable();
@@ -846,8 +846,9 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
       Ref<Boolean> mergeAll = new Ref<>();
       try {
         ApplicationManager.getApplication().invokeAndWait(() -> {
-          String message = GitBundle.message("commit.partial.merge.message", partialOperation.getName());
-          SelectFilePathsDialog dialog = new SelectFilePathsDialog(project, files, message, null, "Commit All Files",
+          String message = GitBundle.message("commit.partial.merge.message", partialOperation.getIndex());
+          SelectFilePathsDialog dialog = new SelectFilePathsDialog(project, files, message, null,
+                                                                   GitBundle.message("button.commit.all.files"),
                                                                    CommonBundle.getCancelButtonText(), false);
           dialog.setTitle(GitBundle.getString("commit.partial.merge.title"));
           dialog.show();
@@ -919,10 +920,10 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
    */
   private static PartialOperation isMergeCommit(final VcsException ex) {
     String message = ex.getMessage();
-    if (message.contains("cannot do a partial commit during a merge")) {
+    if (message.contains("cannot do a partial commit during a merge")) { //NON-NLS
       return PartialOperation.MERGE;
     }
-    if (message.contains("cannot do a partial commit during a cherry-pick")) {
+    if (message.contains("cannot do a partial commit during a cherry-pick")) { //NON-NLS
       return PartialOperation.CHERRY_PICK;
     }
     return PartialOperation.NONE;
@@ -994,7 +995,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
       messageFile = createCommitMessageFile(project, root, message);
     }
     catch (IOException ex) {
-      throw new VcsException("Creation of commit message file failed", ex);
+      throw new VcsException(GitBundle.message("error.commit.cant.create.message.file"), ex);
     }
 
     try {
@@ -1089,19 +1090,18 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
   }
 
   private enum PartialOperation {
-    NONE("none"),
-    MERGE("merge"),
-    CHERRY_PICK("cherry-pick");
+    NONE(0),
+    MERGE(1),
+    CHERRY_PICK(2);
 
-    private final @Nls String myName;
+    private final int myIndex; // See 'commit.partial.merge.message' bundle string
 
-    PartialOperation(@Nls String name) {
-      myName = name;
+    PartialOperation(int messageIndex) {
+      myIndex = messageIndex;
     }
 
-    @Nls
-    String getName() {
-      return myName;
+    int getIndex() {
+      return myIndex;
     }
   }
 
@@ -1219,6 +1219,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment, AmendCommitAwa
       return !CASE_SENSITIVE_FILE_PATH_HASHING_STRATEGY.equals(beforePath, afterPath);
     }
 
+    @NonNls
     @Override
     public String toString() {
       return String.format("%s -> %s", beforePath, afterPath);
index 6a9a5a96c7625e4030c0fe006288c908a8ba891e..96fe3739284fb0db75601b4610a774793e2fa3b7 100644 (file)
@@ -10,6 +10,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.NlsContexts;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.HtmlBuilder;
@@ -23,7 +24,6 @@ import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.PairConsumer;
 import com.intellij.util.ui.UIUtil;
-import com.intellij.xml.util.XmlStringUtil;
 import git4idea.GitUtil;
 import git4idea.GitVcs;
 import git4idea.commands.Git;
@@ -35,6 +35,7 @@ import git4idea.i18n.GitBundle;
 import git4idea.rebase.GitRebaseUtils;
 import git4idea.repo.GitRepository;
 import git4idea.repo.GitRepositoryManager;
+import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -105,7 +106,7 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
       final Collection<VirtualFile> files = myPanel.getVirtualFiles(); // deleted files aren't included, but for them we don't care about CRLFs.
       final AtomicReference<GitCrlfProblemsDetector> crlfHelper = new AtomicReference<>();
       ProgressManager.getInstance().run(
-        new Task.Modal(myProject, "Checking for Line Separator Issues...", true) {
+        new Task.Modal(myProject, GitBundle.message("progress.checking.line.separator.issues"), true) {
           @Override
           public void run(@NotNull ProgressIndicator indicator) {
             crlfHelper.set(GitCrlfProblemsDetector.detect(GitCheckinHandlerFactory.MyCheckinHandler.this.myProject,
@@ -146,7 +147,7 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
     }
 
     private void setCoreAutoCrlfAttribute(@NotNull VirtualFile aRoot) {
-      ProgressManager.getInstance().run(new Task.Modal(myProject, "Updating Git Config...", true) {
+      ProgressManager.getInstance().run(new Task.Modal(myProject, GitBundle.message("progress.setting.config.value"), true) {
         @Override
         public void run(@NotNull ProgressIndicator pi) {
           try {
@@ -164,13 +165,8 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
       GitVersion version = GitExecutableManager.getInstance().getVersionUnderModalProgressOrCancel(myProject);
       if (System.getenv("HOME") == null && GitVersionSpecialty.DOESNT_DEFINE_HOME_ENV_VAR.existsIn(version)) {
         Messages.showErrorDialog(myProject,
-                                 "You are using Git " +
-                                 version.getPresentation() +
-                                 " which doesn't define %HOME% environment variable properly.\n" +
-                                 "Consider updating Git to a newer version " +
-                                 "or define %HOME% to point to the place where the global .gitconfig is stored \n" +
-                                 "(it is usually %USERPROFILE% or %HOMEDRIVE%%HOMEPATH%).",
-                                 "HOME Variable Is Not Defined");
+                                 GitBundle.message("error.message.git.version.does.not.define.home.env", version.getPresentation()),
+                                 GitBundle.message("error.title.git.version.does.not.define.home.env"));
         return ReturnResult.CANCEL;
       }
       return ReturnResult.COMMIT;
@@ -210,7 +206,7 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
                                                                         @NotNull final Collection<? extends VirtualFile> roots,
                                                                         final boolean stopWhenFoundFirst) {
       final Map<VirtualFile, Couple<String>> defined = new HashMap<>();
-      ProgressManager.getInstance().run(new Task.Modal(project, "Checking Git User Name...", true) {
+      ProgressManager.getInstance().run(new Task.Modal(project, GitBundle.message("progress.checking.user.name.email"), true) {
         @Override
         public void run(@NotNull ProgressIndicator pi) {
           for (VirtualFile root : roots) {
@@ -238,8 +234,8 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
     private boolean setUserNameUnderProgress(@NotNull final Project project,
                                              @NotNull final Collection<? extends VirtualFile> notDefined,
                                              @NotNull final GitUserNameNotDefinedDialog dialog) {
-      final Ref<String> error = Ref.create();
-      ProgressManager.getInstance().run(new Task.Modal(project, "Setting Git User Name...", true) {
+      final Ref<@Nls String> error = Ref.create();
+      ProgressManager.getInstance().run(new Task.Modal(project, GitBundle.message("progress.setting.user.name.email"), true) {
         @Override
         public void run(@NotNull ProgressIndicator pi) {
           try {
@@ -255,9 +251,8 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
             }
           }
           catch (VcsException e) {
-            String message = "Couldn't set user.name and user.email";
-            LOG.error(message, e);
-            error.set(message);
+            LOG.error("Couldn't set user.name and user.email", e);
+            error.set(GitBundle.message("error.cant.set.user.name.email"));
           }
         }
       });
@@ -294,26 +289,24 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
         return ReturnResult.COMMIT;
       }
 
-      final String title;
-      final String message;
-      final String rootPath = detachedRoot.myRoot.getPresentableUrl();
-      final String messageCommonStart = "The Git repository at the following path";
+      HtmlChunk rootPath = HtmlChunk.text(detachedRoot.myRoot.getPresentableUrl()).bold();
+      final @NlsContexts.DialogTitle String title;
+      final @NlsContexts.DialogMessage HtmlBuilder message = new HtmlBuilder();
       if (detachedRoot.myRebase) {
-        title = "Unfinished Rebase Process";
-        message = new HtmlBuilder()
-          .appendRaw(messageCommonStart + " has an <b>unfinished rebase</b> process:").br()
-          .append(HtmlChunk.text(rootPath).bold()).br()
-          .appendRaw("You probably want to <b>continue rebase</b> instead of committing.").br()
-          .append("Committing during rebase may lead to the commit loss.").br()
-          .appendLink("https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html", "Read more about Git rebase").toString();
-      } else {
-        title = "Commit in Detached HEAD";
-        message = new HtmlBuilder()
-          .appendRaw(messageCommonStart + " is in the <b>detached HEAD</b> state:").br()
-          .append(HtmlChunk.text(rootPath).bold()).br() 
-          .append("You can look around, make experimental changes and commit them, but be sure to checkout a branch not to lose your work.").br()
-          .append("Otherwise you risk losing your changes.").br()
-          .appendLink("http://gitolite.com/detached-head.html", "Read more about detached HEAD").toString();
+        title = GitBundle.message("warning.title.commit.with.unfinished.rebase");
+        message
+          .appendRaw(GitBundle.message("warning.message.commit.with.unfinished.rebase", rootPath.toString()))
+          .br()
+          .appendLink("https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html",
+                      GitBundle.message("link.label.commit.with.unfinished.rebase.read.more"));
+      }
+      else {
+        title = GitBundle.message("warning.title.commit.with.detached.head");
+        message
+          .appendRaw(GitBundle.message("warning.message.commit.with.detached.head", rootPath.toString()))
+          .br()
+          .appendLink("http://gitolite.com/detached-head.html",
+                      GitBundle.message("link.label.commit.with.detached.head.read.more"));
       }
 
       DialogWrapper.DoNotAskOption dontAskAgain = new DialogWrapper.DoNotAskOption.Adapter() {
@@ -325,14 +318,16 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
         @NotNull
         @Override
         public String getDoNotShowMessage() {
-          return "Don't warn again";
+          return GitBundle.message("checkbox.dont.warn.again");
         }
       };
-      int choice = Messages.showOkCancelDialog(myProject, XmlStringUtil.wrapInHtml(message), title, "Commit",
-                                               CommonBundle.getCancelButtonText(), Messages.getWarningIcon(), dontAskAgain);
+      int choice = Messages.showOkCancelDialog(myProject, message.wrapWithHtmlBody().toString(), title,
+                                               GitBundle.message("commit.action.name"), CommonBundle.getCancelButtonText(),
+                                               Messages.getWarningIcon(), dontAskAgain);
       if (choice == Messages.OK) {
         return ReturnResult.COMMIT;
-      } else {
+      }
+      else {
         return ReturnResult.CLOSE_WINDOW;
       }
     }
index 9f2b8e962ab71f74a72256c442b612a36fa854a7..ab6ff3ee7a6200121c1eb5a9c5f8906b38ab9217 100644 (file)
@@ -6,6 +6,7 @@ import com.intellij.openapi.vcs.changes.CommitContext
 import com.intellij.openapi.vcs.changes.CommitExecutor
 import com.intellij.openapi.vcs.changes.CommitSession
 import com.intellij.vcs.commit.commitProperty
+import git4idea.i18n.GitBundle
 import org.jetbrains.annotations.Nls
 
 private val IS_PUSH_AFTER_COMMIT_KEY = Key.create<Boolean>("Git.Commit.IsPushAfterCommit")
@@ -13,7 +14,7 @@ internal var CommitContext.isPushAfterCommit: Boolean by commitProperty(IS_PUSH_
 
 class GitCommitAndPushExecutor : CommitExecutor {
   @Nls
-  override fun getActionText(): String = "Commit and &Push..."
+  override fun getActionText(): String = GitBundle.message("action.Git.Commit.And.Push.Executor.text")
 
   override fun useDefaultAction(): Boolean = false
 
index 49751da674e5feb876609accb05fe7ae8ae2c2cc..469f80d9eb6753adadd271605c7079f59efc8cdd 100644 (file)
@@ -15,6 +15,7 @@ import com.intellij.util.ui.JBUI
 import com.intellij.vcs.commit.commitProperty
 import git4idea.GitUtil.getRepositoryManager
 import git4idea.GitVcs
+import git4idea.i18n.GitBundle
 import git4idea.repo.GitRepository
 import git4idea.repo.GitRepositoryManager
 import java.awt.event.KeyEvent
@@ -46,9 +47,9 @@ private class GitSkipHooksConfigurationPanel(
     CheckinChangeListSpecificComponent {
 
   private val vcs = GitVcs.getInstance(panel.project)
-  private val runHooks = NonFocusableCheckBox("Run Git hooks").apply {
+  private val runHooks = NonFocusableCheckBox(GitBundle.message("checkbox.run.git.hooks")).apply {
     mnemonic = KeyEvent.VK_H
-    toolTipText = "<html>If unchecked, Git hook will be skipped with the '--no-verify' parameter</html>"
+    toolTipText = GitBundle.message("tooltip.run.git.hooks")
   }
   private var selectedState = true
 
index eb14de564c0d254df14ec45866fa94b1f8a2857d..553b41421025daa6fc90c376b7be4d63be97121c 100644 (file)
@@ -29,6 +29,7 @@ import com.intellij.openapi.vcs.checkin.UnresolvedMergeCheckProvider
 import com.intellij.util.containers.MultiMap
 import com.intellij.util.ui.JBUI
 import git4idea.GitVcs
+import git4idea.i18n.GitBundle
 import git4idea.repo.GitRepository
 import git4idea.repo.GitRepositoryManager
 import javax.swing.JComponent
@@ -57,8 +58,8 @@ class GitUnresolvedMergeCheckProvider : UnresolvedMergeCheckProvider() {
     val hasConflicts = groupedChanges.values().any { it.fileStatus === FileStatus.MERGED_WITH_CONFLICTS }
     if (hasConflicts) {
       Messages.showMessageDialog(panel.component,
-                                 "Can't commit changes due to unresolved conflicts.",
-                                 "Unresolved Conflicts",
+                                 GitBundle.message("message.unresolved.conflicts.prevent.commit"),
+                                 GitBundle.message("title.unresolved.conflicts.pre.commit.check"),
                                  Messages.getWarningIcon())
       return CheckinHandler.ReturnResult.CANCEL
     }
@@ -80,14 +81,14 @@ class GitUnresolvedMergeCheckProvider : UnresolvedMergeCheckProvider() {
     val browser = SimpleChangesBrowser(project, changes)
 
     init {
-      title = "Changes Excluded from Merge Commit"
-      setOKButtonText("Commit Anyway")
+      title = GitBundle.message("title.changes.excluded.from.commit")
+      setOKButtonText(GitBundle.message("button.changes.excluded.from.commit.commit.anyway"))
 
       init()
     }
 
     override fun createNorthPanel(): JComponent? {
-      val label = JLabel("Are you sure you want to exclude these changed files from merge commit?")
+      val label = JLabel(GitBundle.message("label.changes.excluded.from.commit.are.you.sure.want.to.continue"))
       label.border = JBUI.Borders.empty(5, 1)
       return label
     }
index 6d2e573df5ac9a57063a17f553930d6579966298..268eed804ba457c4ae930bad49df97976b61f1f8 100644 (file)
@@ -19,15 +19,17 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.ValidationInfo;
 import com.intellij.openapi.util.Couple;
-import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.util.NlsContexts;
+import com.intellij.openapi.util.text.HtmlBuilder;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.ui.components.JBCheckBox;
 import com.intellij.ui.components.JBLabel;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.ui.GridBag;
+import com.intellij.util.ui.JBUI;
 import com.intellij.util.ui.UIUtil;
-import com.intellij.xml.util.XmlStringUtil;
 import git4idea.config.GitVcsSettings;
+import git4idea.i18n.GitBundle;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -63,15 +65,15 @@ class GitUserNameNotDefinedDialog extends DialogWrapper {
 
     myProposedValues = calcProposedValues(rootsWithDefinedProps);
 
-    setTitle("Git User Name Is Not Defined");
-    setOKButtonText("Set and Commit");
+    setTitle(GitBundle.message("title.user.name.email.not.specified"));
+    setOKButtonText(GitBundle.message("button.set.name.and.commit"));
 
     init();
   }
 
   @Override
   protected ValidationInfo doValidate() {
-    String message = "You have to specify user name and email for Git";
+    String message = GitBundle.message("validation.warning.set.name.email.for.git");
     if (isEmptyOrSpaces(getUserName())) {
       return new ValidationInfo(message, myNameTextField);
     }
@@ -109,12 +111,12 @@ class GitUserNameNotDefinedDialog extends DialogWrapper {
     JLabel description = new JLabel(getMessageText());
 
     myNameTextField = new JTextField(20);
-    JBLabel nameLabel = new JBLabel("Name: ");
+    JBLabel nameLabel = new JBLabel(GitBundle.message("label.user.name") + " ");
     nameLabel.setDisplayedMnemonic('n');
     nameLabel.setLabelFor(myNameTextField);
 
     myEmailTextField = new JTextField(20);
-    JBLabel emailLabel = new JBLabel("E-mail: ");
+    JBLabel emailLabel = new JBLabel(GitBundle.message("label.user.email") + " ");
     emailLabel.setDisplayedMnemonic('e');
     emailLabel.setLabelFor(myEmailTextField);
 
@@ -126,20 +128,20 @@ class GitUserNameNotDefinedDialog extends DialogWrapper {
       myNameTextField.setText(SystemProperties.getUserName());
     }
 
-    myGlobalCheckbox = new JBCheckBox("Set properties globally", mySettings.shouldSetUserNameGlobally());
+    myGlobalCheckbox = new JBCheckBox(GitBundle.message("checkbox.set.config.property.globally"), mySettings.shouldSetUserNameGlobally());
     myGlobalCheckbox.setMnemonic('g');
 
     JPanel rootPanel = new JPanel(new GridBagLayout());
     GridBag g = new GridBag()
-      .setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP))
+      .setDefaultInsets(JBUI.insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP))
       .setDefaultAnchor(GridBagConstraints.LINE_START)
       .setDefaultFill(GridBagConstraints.HORIZONTAL);
 
     rootPanel.add(description, g.nextLine().next().coverLine(3).pady(DEFAULT_HGAP));
     rootPanel.add(icon, g.nextLine().next().coverColumn(3));
-    rootPanel.add(nameLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
+    rootPanel.add(nameLabel, g.next().fillCellNone().insets(JBUI.insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
     rootPanel.add(myNameTextField, g.next());
-    rootPanel.add(emailLabel, g.nextLine().next().next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
+    rootPanel.add(emailLabel, g.nextLine().next().next().fillCellNone().insets(JBUI.insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
     rootPanel.add(myEmailTextField, g.next());
     rootPanel.add(myGlobalCheckbox, g.nextLine().next().next().coverLine(2));
 
@@ -151,16 +153,18 @@ class GitUserNameNotDefinedDialog extends DialogWrapper {
     return null;
   }
 
+  @NlsContexts.Label
   @NotNull
   private String getMessageText() {
     if (myAllRootsAffectedByCommit.size() == myRootsWithUndefinedProps.size()) {
       return "";
     }
-    String text = "Git user.name and user.email properties are not defined in " + StringUtil.pluralize("root", myRootsWithUndefinedProps.size()) + "<br/>";
+    HtmlBuilder sb = new HtmlBuilder()
+      .append(GitBundle.message("label.name.email.not.defined.in.n.roots", myRootsWithUndefinedProps.size()));
     for (VirtualFile root : myRootsWithUndefinedProps) {
-      text += root.getPresentableUrl() + "<br/>";
+      sb.br().append(root.getPresentableUrl());
     }
-    return XmlStringUtil.wrapInHtml(text);
+    return sb.wrapWithHtmlBody().toString();
   }
 
   public String getUserName() {
index ea0f32e4e82e5389807d7e9f191693f997da82a3..f59aa926984c31a2d94890c4a7a0e8bb4317cc50 100644 (file)
@@ -9,7 +9,10 @@ import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.progress.Task;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.NlsSafe;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.text.HtmlBuilder;
+import com.intellij.openapi.util.text.HtmlChunk;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vcs.CheckoutProviderEx;
 import com.intellij.openapi.vcs.VcsNotifier;
@@ -18,6 +21,7 @@ import com.intellij.openapi.vcs.ui.VcsCloneComponent;
 import com.intellij.openapi.vcs.ui.cloneDialog.VcsCloneDialogComponentStateListener;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.containers.ContainerUtil;
 import git4idea.GitUtil;
 import git4idea.GitVcs;
 import git4idea.commands.Git;
@@ -25,17 +29,21 @@ import git4idea.commands.GitCommandResult;
 import git4idea.commands.GitLineHandlerListener;
 import git4idea.commands.GitStandardProgressAnalyzer;
 import git4idea.ui.GitCloneDialogComponent;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
+import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
 
 /**
  * Checkout provider for the Git
  */
 public final class GitCheckoutProvider extends CheckoutProviderEx {
+  private static final List<@NonNls String> NON_ERROR_LINE_PREFIXES = Arrays.asList("Cloning into", "remote:", "submodule");
+
   @Override
   public String getVcsName() {
     return "_Git";
@@ -101,13 +109,11 @@ public final class GitCheckoutProvider extends CheckoutProviderEx {
     if (result.success()) {
       return true;
     }
-    String description = result.getErrorOutput().stream()
-      .filter(msg -> !StringUtil.startsWithIgnoreCase(msg, "Cloning into")
-                     && !StringUtil.startsWithIgnoreCase(msg, "remote:")
-                     && !StringUtil.startsWithIgnoreCase(msg, "submodule"))
-      .map(msg -> GitUtil.cleanupErrorPrefixes(msg))
-      .collect(Collectors.joining("<br/>"));
-    VcsNotifier.getInstance(project).notifyError("Clone failed", StringUtil.capitalize(description), true);
+    List<@NlsSafe String> errorLines = ContainerUtil.filter(result.getErrorOutput(), line ->
+      !ContainerUtil.exists(NON_ERROR_LINE_PREFIXES, prefix -> StringUtil.startsWithIgnoreCase(line, prefix)));
+    List<HtmlChunk> displayErrorLines = ContainerUtil.map(errorLines, msg -> HtmlChunk.text(GitUtil.cleanupErrorPrefixes(msg)));
+    String description = new HtmlBuilder().appendWithSeparators(HtmlChunk.br(), displayErrorLines).toString();
+    VcsNotifier.getInstance(project).notifyError(DvcsBundle.message("error.title.cloning.repository.failed"), description, true);
     return false;
   }
 
index 9e6897ce1c7065cd1af5cf1035b30fc084e54f6d..3d0a8872a96303cc1c5abfb1215a6ff34b633075 100644 (file)
@@ -65,7 +65,9 @@ public class GitCherryPicker extends VcsCherryPicker {
   @NotNull
   private String createCommitMessage(@NotNull GitRepository repository, @NotNull VcsFullCommitDetails commit) {
     String message = commit.getFullMessage();
-    if (shouldAddSuffix(repository, commit.getId())) message += "\n\n(cherry picked from commit " + commit.getId().asString() + ")";
+    if (shouldAddSuffix(repository, commit.getId())) {
+      message += String.format("\n\n(cherry picked from commit %s)", commit.getId().asString()); //NON-NLS Do not i18n commit template
+    }
     return message;
   }
 
index 6993d81f520e8c2f82191dac6b93c62aa2a038b3..ac13ba15cd5cf3206bf27be9315a2f27c7460315 100644 (file)
@@ -2,6 +2,7 @@
 package git4idea.config;
 
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.NlsSafe;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vcs.VcsException;
 import com.intellij.openapi.vfs.CharsetToolkit;
@@ -24,16 +25,19 @@ import java.util.Map;
  */
 public final class GitConfigUtil {
 
-  public static final String USER_NAME = "user.name";
-  public static final String USER_EMAIL = "user.email";
-  public static final String CORE_AUTOCRLF = "core.autocrlf";
+  public static final @NlsSafe String USER_NAME = "user.name";
+  public static final @NlsSafe String USER_EMAIL = "user.email";
+  public static final @NlsSafe String CORE_AUTOCRLF = "core.autocrlf";
+  public static final @NlsSafe String CREDENTIAL_HELPER = "credential.helper";
+  public static final @NlsSafe String LOG_OUTPUT_ENCODING = "i18n.logoutputencoding";
+  public static final @NlsSafe String COMMIT_ENCODING = "i18n.commitencoding";
 
   private GitConfigUtil() {
   }
 
   public static void getValues(@NotNull Project project,
                                @NotNull VirtualFile root,
-                               @Nullable String keyMask,
+                               @Nullable @NonNls String keyMask,
                                @NotNull Map<String, String> result) throws VcsException {
     GitLineHandler h = new GitLineHandler(project, root, GitCommand.CONFIG);
     h.setSilent(true);
@@ -66,7 +70,7 @@ public final class GitConfigUtil {
   }
 
   @Nullable
-  private static String getValue(@NotNull GitLineHandler h, @NotNull String key) throws VcsException {
+  private static String getValue(@NotNull GitLineHandler h, @NotNull @NonNls String key) throws VcsException {
     h.setSilent(true);
     h.addParameters("--null", "--get", key);
     GitCommandResult result = Git.getInstance().runCommand(h);
@@ -83,7 +87,7 @@ public final class GitConfigUtil {
    * @return true if the value represents "true", false if the value represents "false", null if the value doesn't look like a boolean value.
    */
   @Nullable
-  public static Boolean getBooleanValue(@NotNull String value) {
+  public static Boolean getBooleanValue(@NotNull @NonNls String value) {
     value = StringUtil.toLowerCase(value);
     if (ContainerUtil.newHashSet("true", "yes", "on", "1").contains(value)) return true;
     if (ContainerUtil.newHashSet("false", "no", "off", "0", "").contains(value)) return false;
@@ -97,7 +101,7 @@ public final class GitConfigUtil {
   public static String getCommitEncoding(@NotNull Project project, @NotNull VirtualFile root) {
     String encoding = null;
     try {
-      encoding = getValue(project, root, "i18n.commitencoding");
+      encoding = getValue(project, root, COMMIT_ENCODING);
     }
     catch (VcsException e) {
       // ignore exception
@@ -111,7 +115,7 @@ public final class GitConfigUtil {
   public static String getLogEncoding(@NotNull Project project, @NotNull VirtualFile root) {
     String encoding = null;
     try {
-      encoding = getValue(project, root, "i18n.logoutputencoding");
+      encoding = getValue(project, root, LOG_OUTPUT_ENCODING);
     }
     catch (VcsException e) {
       // ignore exception
@@ -130,9 +134,9 @@ public final class GitConfigUtil {
 
   public static void setValue(@NotNull Project project,
                               @NotNull VirtualFile root,
-                              @NotNull String key,
-                              @NotNull String value,
-                              String... additionalParameters) throws VcsException {
+                              @NotNull @NonNls String key,
+                              @NotNull @NonNls String value,
+                              @NonNls String... additionalParameters) throws VcsException {
     GitLineHandler h = new GitLineHandler(project, root, GitCommand.CONFIG);
     h.setSilent(true);
     h.addParameters(additionalParameters);
@@ -146,7 +150,7 @@ public final class GitConfigUtil {
   public static boolean isCredentialHelperUsed(@NotNull Project project, @NotNull File workingDirectory) {
     try {
       GitLineHandler handler = new GitLineHandler(project, workingDirectory, GitCommand.CONFIG);
-      String value = getValue(handler, "credential.helper");
+      String value = getValue(handler, CREDENTIAL_HELPER);
       return StringUtil.isNotEmpty(value);
     }
     catch (VcsException ignored) {