vcs: i18n

GitOrigin-RevId: 1d736eb054a9355abbb0390276b06235a2521467
This commit is contained in:
Aleksey Pivovarov
2022-10-04 11:40:33 +02:00
committed by intellij-monorepo-bot
parent a649c9308b
commit e6e2fbac35
7 changed files with 17 additions and 13 deletions

View File

@@ -7,6 +7,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.ui.VcsCloneComponent;
import com.intellij.openapi.vcs.ui.VcsCloneComponentStub;
import com.intellij.openapi.vcs.ui.cloneDialog.VcsCloneDialogComponentStateListener;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -14,8 +16,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Comparator;
import static com.intellij.ui.GuiUtils.getTextWithoutMnemonicEscaping;
/**
* Implement this interface and register it as extension to checkoutProvider extension point in order to provide checkout
*/
@@ -30,7 +30,7 @@ public interface CheckoutProvider {
@Deprecated(forRemoval = true)
void doCheckout(@NotNull final Project project, @Nullable Listener listener);
@NonNls String getVcsName();
@Nls @NotNull String getVcsName();
interface Listener {
void directoryCheckedOut(File directory, VcsKey vcs);
@@ -40,7 +40,7 @@ public interface CheckoutProvider {
class CheckoutProviderComparator implements Comparator<CheckoutProvider> {
@Override
public int compare(@NotNull final CheckoutProvider o1, @NotNull final CheckoutProvider o2) {
return getTextWithoutMnemonicEscaping(o1.getVcsName()).compareTo(getTextWithoutMnemonicEscaping(o2.getVcsName()));
return UIUtil.removeMnemonic(o1.getVcsName()).compareTo(UIUtil.removeMnemonic(o2.getVcsName()));
}
}

View File

@@ -32,7 +32,7 @@ class RepositoryUrlCloneDialogExtension : VcsCloneDialogExtension {
override fun getTooltip(): String {
return CheckoutProvider.EXTENSION_POINT_NAME.extensions
.map { it.vcsName }
.joinToString { it.replace("_", "") }
.joinToString { UIUtil.removeMnemonic(it) }
}
override fun createMainComponent(project: Project, modalityState: ModalityState): VcsCloneDialogExtensionComponent {
@@ -61,7 +61,7 @@ class RepositoryUrlCloneDialogExtension : VcsCloneDialogExtension {
val northPanel = panel {
row(VcsBundle.message("vcs.common.labels.version.control")) {
comboBox = comboBox(providers.asList(), SimpleListCellRenderer.create("") { it.vcsName.removePrefix("_") })
comboBox = comboBox(providers.asList(), SimpleListCellRenderer.create("") { UIUtil.removeMnemonic(it.vcsName) })
.applyToComponent {
selectedItem = null
}

View File

@@ -31,6 +31,7 @@ import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.commands.GitLineHandlerListener;
import git4idea.commands.GitStandardProgressAnalyzer;
import git4idea.i18n.GitBundle;
import git4idea.ui.GitCloneDialogComponent;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -52,8 +53,8 @@ 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";
public @NotNull String getVcsName() {
return GitBundle.message("git4idea.vcs.name.with.mnemonic");
}
@Override

View File

@@ -1,4 +1,5 @@
hg4idea.vcs.name=Mercurial
hg4idea.vcs.name.with.mnemonic=_Mercurial
hg4idea.vcs.short.name=Hg
hg4idea.vcs.short.name.with.mnemonic=H_g

View File

@@ -108,8 +108,8 @@ public class HgCheckoutProvider implements CheckoutProvider {
}
@Override
public String getVcsName() {
return "_Mercurial";
public @NotNull String getVcsName() {
return HgBundle.message("hg4idea.vcs.name.with.mnemonic");
}
@NotNull

View File

@@ -890,4 +890,5 @@ error.svn.status.with.no.output=Status request returned nothing for command: {0}
error.svn.status.not.in.working.copy=Status requested not in working copy: {0}
toolwindow.working.copies.info.title=Subversion Working Copies Information
svn.short.name.with.mnemonic=_SVN
svn.name.with.mnemonic=_Subversion
notification.group.svn.roots=Subversion root detection failed

View File

@@ -142,7 +142,8 @@ public class SvnCheckoutProvider implements CheckoutProvider {
showErrorDialog(message("message.text.cannot.checkout", exception.getMessage()), message("dialog.title.check.out"));
});
return CloneStatus.FAILURE;
} finally {
}
finally {
VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target);
if (vf != null) {
vf.refresh(true, true, () -> getApplication().invokeLater(() -> notifyListener()));
@@ -270,8 +271,8 @@ public class SvnCheckoutProvider implements CheckoutProvider {
}
@Override
public String getVcsName() {
return "_Subversion";
public @NotNull String getVcsName() {
return message("svn.name.with.mnemonic");
}
public static class CheckoutFormatFromUserProvider {