[vcs-log] graph-api i18n

GitOrigin-RevId: 10033069a892a0817f3f6a1058876cfe4755d3f5
This commit is contained in:
Aleksandr Krasilnikov
2020-02-17 17:48:08 +03:00
committed by intellij-monorepo-bot
parent 9c5fe6be05
commit ea1203ed26
5 changed files with 51 additions and 14 deletions

View File

@@ -156,3 +156,9 @@ vcs.log.filter.tooltip.click.to.see.only={0}+Click to see only \\"{1}\\"
vcs.log.filter.tooltip.no.roots.selected=No Roots Selected
vcs.log.filter.tooltip.roots=Roots:
vcs.log.filter.tooltip.folders=Folders:
graph.sort.linear=Linear
graph.sort.linear.description=In case of merge show incoming commits on top of main branch commits as if they were rebased
graph.sort.standard=Standard
graph.sort.standard.description=In case of merge show incoming commits first (directly below merge commit)
graph.sort.off=Off
graph.sort.off.description=Sort commits topologically and by date

View File

@@ -16,7 +16,6 @@
package com.intellij.vcs.log.graph;
import com.intellij.openapi.util.Condition;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -61,15 +60,14 @@ public interface PermanentGraph<Id> {
Condition<Id> getContainedInBranchCondition(@NotNull Collection<? extends Id> currentBranchHead);
enum SortType {
Normal("Off", "Sort commits topologically and by date"),
Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)"),
LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased");
Normal("Off", "Sort commits topologically and by date"), // NON-NLS
Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)"), // NON-NLS
LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased"); // NON-NLS
@NotNull private final String myPresentation;
@NotNull private final String myDescription;
SortType(@NotNull @Nls(capitalization = Nls.Capitalization.Title) String presentation,
@NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String description) {
SortType(@NotNull String presentation, @NotNull String description) {
myPresentation = presentation;
myDescription = description;
}

View File

@@ -16,6 +16,7 @@ import com.intellij.vcs.log.graph.PermanentGraph;
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
import com.intellij.vcs.log.impl.VcsLogUiProperties;
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
import com.intellij.vcs.log.util.GraphSortPresentationUtil;
import icons.VcsLogIcons;
import org.jetbrains.annotations.NotNull;
@@ -55,8 +56,8 @@ public class IntelliSortChooserPopupAction extends DumbAwareAction {
VcsLogUiProperties properties = e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
e.getPresentation().setEnabled(properties != null);
if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
String description = VcsLogBundle.message("vcs.log.action.intellisort.title",
properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE).getName());
String sortName = GraphSortPresentationUtil.getLocalizedName(properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE));
String description = VcsLogBundle.message("vcs.log.action.intellisort.title", sortName);
e.getPresentation().setDescription(description);
e.getPresentation().setText(description);
}
@@ -70,7 +71,9 @@ public class IntelliSortChooserPopupAction extends DumbAwareAction {
SelectIntelliSortTypeAction(@NotNull VcsLogUi ui,
@NotNull VcsLogUiProperties properties,
@NotNull PermanentGraph.SortType sortType) {
super(sortType.getName(), sortType.getDescription() + ".", null);
super(() -> GraphSortPresentationUtil.getLocalizedName(sortType),
() -> GraphSortPresentationUtil.getLocalizedDescription(sortType) + ".",
null);
myUI = ui;
myProperties = properties;
mySortType = sortType;

View File

@@ -27,6 +27,7 @@ import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
import com.intellij.vcs.log.impl.VcsLogUiProperties;
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
import com.intellij.vcs.log.util.BekUtil;
import com.intellij.vcs.log.util.GraphSortPresentationUtil;
import icons.VcsLogIcons;
import org.jetbrains.annotations.NotNull;
@@ -66,11 +67,15 @@ public class IntelliSortChooserToggleAction extends ToggleAction implements Dumb
e.getPresentation().setEnabled(BekUtil.isBekEnabled() && logUI != null);
if (properties != null && properties.exists(MainVcsLogUiProperties.BEK_SORT_TYPE)) {
String description = properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.Normal ?
VcsLogBundle.message("vcs.log.action.turn.intellisort.on",
StringUtil.toLowerCase(PermanentGraph.SortType.Bek.getDescription())) :
VcsLogBundle.message("vcs.log.action.turn.intellisort.off",
StringUtil.toLowerCase(PermanentGraph.SortType.Normal.getDescription()));
String description;
if (properties.get(MainVcsLogUiProperties.BEK_SORT_TYPE) == PermanentGraph.SortType.Normal) {
String localizedDescription = GraphSortPresentationUtil.getLocalizedDescription(PermanentGraph.SortType.Bek);
description = VcsLogBundle.message("vcs.log.action.turn.intellisort.on", StringUtil.toLowerCase(localizedDescription));
}
else {
String localizedDescription = GraphSortPresentationUtil.getLocalizedDescription(PermanentGraph.SortType.Normal);
description = VcsLogBundle.message("vcs.log.action.turn.intellisort.off", StringUtil.toLowerCase(localizedDescription));
}
e.getPresentation().setDescription(description);
e.getPresentation().setText(description);
}

View File

@@ -0,0 +1,25 @@
// 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 com.intellij.vcs.log.util
import com.intellij.vcs.log.VcsLogBundle
import com.intellij.vcs.log.graph.PermanentGraph
object GraphSortPresentationUtil {
@JvmStatic
val PermanentGraph.SortType.localizedName: String
get() = when (this) {
PermanentGraph.SortType.Normal -> VcsLogBundle.message("graph.sort.off")
PermanentGraph.SortType.Bek -> VcsLogBundle.message("graph.sort.standard")
PermanentGraph.SortType.LinearBek -> VcsLogBundle.message("graph.sort.linear")
}
@JvmStatic
val PermanentGraph.SortType.LocalizedDescription: String
get() = when (this) {
PermanentGraph.SortType.Normal -> VcsLogBundle.message("graph.sort.off.description")
PermanentGraph.SortType.Bek -> VcsLogBundle.message("graph.sort.standard.description")
PermanentGraph.SortType.LinearBek -> VcsLogBundle.message("graph.sort.linear.description")
}
}