Skip to content

Commit cf8b970

Browse files
committed
feat(mcp): add localization for MCP Result Panel #371
1 parent dfe9d3f commit cf8b970

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/ui/McpChatResultPanel.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.unitmesh.devti.mcp.ui
22

3+
import cc.unitmesh.devti.AutoDevBundle
34
import cc.unitmesh.devti.mcp.client.CustomMcpServerManager
45
import cc.unitmesh.devti.mcp.ui.model.McpChatConfig
56
import cc.unitmesh.devti.util.parser.CodeFence
@@ -48,8 +49,8 @@ class McpChatResultPanel(private val project: Project, val config: McpChatConfig
4849
}
4950

5051
private val tabbedPane = JBTabbedPane().apply {
51-
addTab("Response", responseScrollPane)
52-
addTab("Tools", toolsScrollPane)
52+
addTab(AutoDevBundle.message("mcp.chat.result.tab.response"), responseScrollPane)
53+
addTab(AutoDevBundle.message("mcp.chat.result.tab.tools"), toolsScrollPane)
5354
}
5455

5556
private val borderColor = JBColor(0xE5E7EB, 0x3C3F41) // Equivalent to Tailwind gray-200
@@ -77,7 +78,7 @@ class McpChatResultPanel(private val project: Project, val config: McpChatConfig
7778

7879
val toolCalls = extractToolCalls(text)
7980
if (toolCalls.isEmpty()) {
80-
val noToolsLabel = JBLabel("No tool calls found in the response").apply {
81+
val noToolsLabel = JBLabel(AutoDevBundle.message("mcp.chat.result.no.tools")).apply {
8182
foreground = JBColor(0x6B7280, 0x9DA0A8) // Gray text
8283
horizontalAlignment = SwingConstants.CENTER
8384
}
@@ -183,7 +184,7 @@ class McpChatResultPanel(private val project: Project, val config: McpChatConfig
183184
}
184185

185186
// Add execute button and result panel
186-
val executeButton = JButton("Execute").apply {
187+
val executeButton = JButton(AutoDevBundle.message("mcp.chat.result.execute")).apply {
187188
font = JBUI.Fonts.label(12f)
188189
addActionListener {
189190
executeToolCall(toolCall, panel)
@@ -223,7 +224,7 @@ class McpChatResultPanel(private val project: Project, val config: McpChatConfig
223224

224225
parentPanel.add(resultPanel, BorderLayout.SOUTH)
225226

226-
val loadingLabel = JBLabel("Executing tool ${toolCall.name}...").apply {
227+
val loadingLabel = JBLabel(AutoDevBundle.message("mcp.chat.result.executing", toolCall.name)).apply {
227228
horizontalAlignment = SwingConstants.CENTER
228229
}
229230
resultPanel.add(loadingLabel, BorderLayout.CENTER)
@@ -244,7 +245,7 @@ class McpChatResultPanel(private val project: Project, val config: McpChatConfig
244245
val result = if (matchingTool != null) {
245246
mcpServerManager.execute(project, matchingTool, params)
246247
} else {
247-
"Error: Could not find matching tool '${toolCall.name}'"
248+
AutoDevBundle.message("mcp.chat.result.error.tool.not.found", toolCall.name)
248249
}
249250

250251
resultPanel.removeAll()

core/src/main/resources/messages/AutoDevBundle_en.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,13 @@ mcp.chat.config.dialog.title=Model Configuration
234234
mcp.chat.config.dialog.temperature=Temperature: {0}
235235
mcp.chat.config.dialog.enabled.tools=Enabled Tools
236236

237+
# MCP Chat Result Panel
238+
mcp.chat.result.tab.response=Response
239+
mcp.chat.result.tab.tools=Tools
240+
mcp.chat.result.no.tools=No tool calls found in the response
241+
mcp.chat.result.execute=Execute
242+
mcp.chat.result.executing=Executing tool {0}...
243+
mcp.chat.result.error.tool.not.found=Error: Could not find matching tool ''{0}''
244+
237245
indexer.generate.domain=Generate domain.csv
246+

core/src/main/resources/messages/AutoDevBundle_zh.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,12 @@ mcp.chat.config.dialog.temperature=温度: {0}
226226
mcp.chat.config.dialog.enabled.tools=已启用工具
227227

228228
indexer.generate.domain=生成 domain.csv
229+
230+
# MCP Chat Result Panel
231+
mcp.chat.result.tab.response=响应
232+
mcp.chat.result.tab.tools=工具
233+
mcp.chat.result.no.tools=响应中未找到工具调用
234+
mcp.chat.result.execute=执行
235+
mcp.chat.result.executing=正在执行工具 {0}...
236+
mcp.chat.result.error.tool.not.found=错误:找不到匹配的工具 ''{0}''
237+

0 commit comments

Comments
 (0)