From d4fdfad747108d669d9ab517e1916f6bc30210a3 Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Mon, 13 Jan 2020 20:13:32 +0300 Subject: [PATCH] i18n for sh colors GitOrigin-RevId: 05aafec61e67f196cf8383facd3c430edcf02ce2 --- .../sh/resources/messages/ShBundle.properties | 24 ++++++++++- .../intellij/sh/highlighter/ShColorPage.java | 43 ++++++++++--------- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/plugins/sh/resources/messages/ShBundle.properties b/plugins/sh/resources/messages/ShBundle.properties index 0848e8489a18..7c9a33f67024 100644 --- a/plugins/sh/resources/messages/ShBundle.properties +++ b/plugins/sh/resources/messages/ShBundle.properties @@ -48,4 +48,26 @@ action.ShGenerateWhileLoop.description=Creates while loop action.ShGenerateForLoop.text=For Loop action.ShGenerateForLoop.description=Creates for loop action.runShellFileAction.text=Run File -action.runShellFileAction.description=Run current shell file in the terminal \ No newline at end of file +action.runShellFileAction.description=Run current shell file in the terminal + +sh.color.function.declaration=Function Declaration +sh.color.conditional.operators=Conditional operators +sh.color.commands.subshell.command=Commands//Subshell Command +sh.color.commands.generic.command=Commands//Generic Command +sh.color.redirection=Redirection +sh.color.backquotes=Backquotes +sh.color.braces.square.brackets=Braces//Square Brackets +sh.color.braces.curly.brackets=Braces//Curly Brackets +sh.color.braces.parentheses=Braces//Parentheses +sh.color.here.documents.end=Here Documents End +sh.color.here.documents.start=Here Documents Start +sh.color.here.documents=Here Documents +sh.color.shebang.comment=Shebang Comment +sh.color.line.comment=Line Comment +sh.color.raw.string=Raw String +sh.color.string=String +sh.color.variables.composed.variable=Variables//Composed Variable +sh.color.variables.variable.declaration=Variables//Variable Declaration +sh.color.variables.variable.usage=Variables//Variable Usage +sh.color.keyword=Keyword +sh.color.number=Number \ No newline at end of file diff --git a/plugins/sh/src/com/intellij/sh/highlighter/ShColorPage.java b/plugins/sh/src/com/intellij/sh/highlighter/ShColorPage.java index 457d3a338bc2..7e9c2e3e60d6 100644 --- a/plugins/sh/src/com/intellij/sh/highlighter/ShColorPage.java +++ b/plugins/sh/src/com/intellij/sh/highlighter/ShColorPage.java @@ -7,6 +7,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.options.colors.AttributesDescriptor; import com.intellij.openapi.options.colors.ColorDescriptor; import com.intellij.openapi.options.colors.ColorSettingsPage; +import com.intellij.sh.ShBundle; import com.intellij.sh.ShFileType; import com.intellij.sh.ShLanguage; import org.jetbrains.annotations.NonNls; @@ -19,31 +20,31 @@ import java.util.Map; public class ShColorPage implements ColorSettingsPage { private static final AttributesDescriptor[] ATTRS = { - new AttributesDescriptor("Number", ShHighlighterColors.NUMBER), - new AttributesDescriptor("Keyword", ShHighlighterColors.KEYWORD), - new AttributesDescriptor("Variables//Variable Usage", ShHighlighterColors.VARIABLE), - new AttributesDescriptor("Variables//Variable Declaration", ShHighlighterColors.VARIABLE_DECLARATION), - new AttributesDescriptor("Variables//Composed Variable", ShHighlighterColors.COMPOSED_VARIABLE), - new AttributesDescriptor("String", ShHighlighterColors.STRING), - new AttributesDescriptor("Raw String", ShHighlighterColors.RAW_STRING), - new AttributesDescriptor("Line Comment", ShHighlighterColors.LINE_COMMENT), - new AttributesDescriptor("Shebang Comment", ShHighlighterColors.SHEBANG_COMMENT), + new AttributesDescriptor(ShBundle.message("sh.color.number"), ShHighlighterColors.NUMBER), + new AttributesDescriptor(ShBundle.message("sh.color.keyword"), ShHighlighterColors.KEYWORD), + new AttributesDescriptor(ShBundle.message("sh.color.variables.variable.usage"), ShHighlighterColors.VARIABLE), + new AttributesDescriptor(ShBundle.message("sh.color.variables.variable.declaration"), ShHighlighterColors.VARIABLE_DECLARATION), + new AttributesDescriptor(ShBundle.message("sh.color.variables.composed.variable"), ShHighlighterColors.COMPOSED_VARIABLE), + new AttributesDescriptor(ShBundle.message("sh.color.string"), ShHighlighterColors.STRING), + new AttributesDescriptor(ShBundle.message("sh.color.raw.string"), ShHighlighterColors.RAW_STRING), + new AttributesDescriptor(ShBundle.message("sh.color.line.comment"), ShHighlighterColors.LINE_COMMENT), + new AttributesDescriptor(ShBundle.message("sh.color.shebang.comment"), ShHighlighterColors.SHEBANG_COMMENT), - new AttributesDescriptor("Here Documents", ShHighlighterColors.HERE_DOC), - new AttributesDescriptor("Here Documents Start", ShHighlighterColors.HERE_DOC_START), - new AttributesDescriptor("Here Documents End", ShHighlighterColors.HERE_DOC_END), + new AttributesDescriptor(ShBundle.message("sh.color.here.documents"), ShHighlighterColors.HERE_DOC), + new AttributesDescriptor(ShBundle.message("sh.color.here.documents.start"), ShHighlighterColors.HERE_DOC_START), + new AttributesDescriptor(ShBundle.message("sh.color.here.documents.end"), ShHighlighterColors.HERE_DOC_END), - new AttributesDescriptor("Braces//Parentheses", ShHighlighterColors.PAREN), - new AttributesDescriptor("Braces//Curly Brackets", ShHighlighterColors.BRACE), - new AttributesDescriptor("Braces//Square Brackets", ShHighlighterColors.BRACKET), + new AttributesDescriptor(ShBundle.message("sh.color.braces.parentheses"), ShHighlighterColors.PAREN), + new AttributesDescriptor(ShBundle.message("sh.color.braces.curly.brackets"), ShHighlighterColors.BRACE), + new AttributesDescriptor(ShBundle.message("sh.color.braces.square.brackets"), ShHighlighterColors.BRACKET), - new AttributesDescriptor("Backquotes", ShHighlighterColors.BACKQUOTE), - new AttributesDescriptor("Redirection", ShHighlighterColors.REDIRECTION), - new AttributesDescriptor("Commands//Generic Command", ShHighlighterColors.GENERIC_COMMAND), - new AttributesDescriptor("Commands//Subshell Command", ShHighlighterColors.SUBSHELL_COMMAND), - new AttributesDescriptor("Conditional operators", ShHighlighterColors.CONDITIONAL_OPERATORS), + new AttributesDescriptor(ShBundle.message("sh.color.backquotes"), ShHighlighterColors.BACKQUOTE), + new AttributesDescriptor(ShBundle.message("sh.color.redirection"), ShHighlighterColors.REDIRECTION), + new AttributesDescriptor(ShBundle.message("sh.color.commands.generic.command"), ShHighlighterColors.GENERIC_COMMAND), + new AttributesDescriptor(ShBundle.message("sh.color.commands.subshell.command"), ShHighlighterColors.SUBSHELL_COMMAND), + new AttributesDescriptor(ShBundle.message("sh.color.conditional.operators"), ShHighlighterColors.CONDITIONAL_OPERATORS), - new AttributesDescriptor("Function Declaration", ShHighlighterColors.FUNCTION_DECLARATION) + new AttributesDescriptor(ShBundle.message("sh.color.function.declaration"), ShHighlighterColors.FUNCTION_DECLARATION) }; @NonNls private static final HashMap TAG_DESCRIPTOR_MAP = new HashMap<>();