[java-compiler] Properly localize MakeModuleAction presentation

GitOrigin-RevId: 3a4ace4dfb390f048f341b1f3181b43e6dd84f5e
This commit is contained in:
Tagir Valeev
2021-07-01 09:44:14 +00:00
committed by intellij-monorepo-bot
parent 311c540e2b
commit 33884c70e3
2 changed files with 14 additions and 13 deletions

View File

@@ -15,6 +15,7 @@
*/ */
package com.intellij.compiler.actions; package com.intellij.compiler.actions;
import com.intellij.ide.nls.NlsMessages;
import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.compiler.JavaCompilerBundle; import com.intellij.openapi.compiler.JavaCompilerBundle;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
@@ -23,6 +24,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.task.ProjectTaskManager; import com.intellij.task.ProjectTaskManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.stream.Stream;
public class MakeModuleAction extends CompileActionBase { public class MakeModuleAction extends CompileActionBase {
private static final Logger LOG = Logger.getInstance(MakeModuleAction.class); private static final Logger LOG = Logger.getInstance(MakeModuleAction.class);
@@ -61,22 +64,17 @@ public class MakeModuleAction extends CompileActionBase {
String presentationText; String presentationText;
if (modules != null) { if (modules != null) {
String text = actionName; if (modules.length == 1) {
for (int i = 0; i < modules.length; i++) { presentationText = JavaCompilerBundle.message("action.make.single.module.text", modules[0].getName());
if (text.length() > 30) { } else {
text = JavaCompilerBundle.message("action.make.selected.modules.text"); String moduleNames = Stream.of(modules).map(m -> "'"+m.getName()+"'").collect(NlsMessages.joiningNarrowAnd());
break; presentationText = moduleNames.length() > 20 ?
} JavaCompilerBundle.message("action.make.selected.modules.text") :
Module toMake = modules[i]; JavaCompilerBundle.message("action.make.few.modules.text", moduleNames);
if (i!=0) {
text += ",";
}
text += " '" + toMake.getName() + "'";
} }
presentationText = text;
} }
else if (module != null) { else if (module != null) {
presentationText = actionName + " '" + module.getName() + "'"; presentationText = JavaCompilerBundle.message("action.make.single.module.text", module.getName());
} }
else { else {
presentationText = actionName; presentationText = actionName;

View File

@@ -11,6 +11,9 @@ action.compile.description.selected.files=Selected Files
rebuild.lvcs.label.no.errors=''{0}'' with no errors rebuild.lvcs.label.no.errors=''{0}'' with no errors
rebuild.lvcs.label.with.errors=''{0}'' with errors rebuild.lvcs.label.with.errors=''{0}'' with errors
action.make.selected.modules.text=Build Selected _Modules action.make.selected.modules.text=Build Selected _Modules
action.make.single.module.text=Build _Module ''{0}''
# {0} = comma-separated quoted module names
action.make.few.modules.text=Build _Modules {0}
message.resource.patterns.format.changed=The format of resource patterns has changed.\n{0} failed to convert existing regular expression patterns:\n{1}\nPlease enter pattern string in a new format.\nEach resource pattern may contain the following wildcards:\n? - one character\n* - zero or more characters\n! - negate the pattern (allowed only at the start of a pattern)\nUse ; (semicolon) to separate resource patterns;\nEscape the "!" character with a backslash ("\\").\nYou might also need to modify template project settings.\nPress ''{2}'' to accept entered patterns, ''{3}'' to load default patterns in new format. message.resource.patterns.format.changed=The format of resource patterns has changed.\n{0} failed to convert existing regular expression patterns:\n{1}\nPlease enter pattern string in a new format.\nEach resource pattern may contain the following wildcards:\n? - one character\n* - zero or more characters\n! - negate the pattern (allowed only at the start of a pattern)\nUse ; (semicolon) to separate resource patterns;\nEscape the "!" character with a backslash ("\\").\nYou might also need to modify template project settings.\nPress ''{2}'' to accept entered patterns, ''{3}'' to load default patterns in new format.
pattern.conversion.dialog.title=Pattern Conversion pattern.conversion.dialog.title=Pattern Conversion
error.bad.resource.patterns=The following resource patterns are malformed:{0} error.bad.resource.patterns=The following resource patterns are malformed:{0}