Skip to content

Commit 91aff1e

Browse files
author
feifei
committed
feat: Support multilingual menu display using i18next (supports Chinese and English)
1 parent 4a55e14 commit 91aff1e

25 files changed

+1436
-366
lines changed

package-lock.json

Lines changed: 38 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@
326326
"fastest-levenshtein": "^1.0.16",
327327
"get-folder-size": "^5.0.0",
328328
"globby": "^14.0.2",
329+
"i18next": "^24.2.2",
329330
"isbinaryfile": "^5.0.2",
330331
"mammoth": "^1.8.0",
331332
"monaco-vscode-textmate-theme-converter": "^0.1.7",
@@ -376,7 +377,7 @@
376377
"prettier": "^3.4.2",
377378
"rimraf": "^6.0.1",
378379
"ts-jest": "^29.2.5",
379-
"typescript": "^5.4.5"
380+
"typescript": "^5.7.3"
380381
},
381382
"lint-staged": {
382383
"*.{js,jsx,ts,tsx,json,css,md}": [

src/shared/experiments.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ type valueof<X> = X[keyof X]
1717

1818
export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
1919
DIFF_STRATEGY: {
20-
name: "Use experimental unified diff strategy",
21-
description:
22-
"Enable the experimental unified diff strategy. This strategy might reduce the number of retries caused by model errors but may cause unexpected behavior or incorrect edits. Only enable if you understand the risks and are willing to carefully review all changes.",
20+
name: "settings.advanced.diff.unifiedStrategy.title",
21+
description: "settings.advanced.diff.unifiedStrategy.description",
2322
enabled: false,
2423
},
2524
SEARCH_AND_REPLACE: {
26-
name: "Use experimental search and replace tool",
27-
description:
28-
"Enable the experimental search and replace tool, allowing Roo to replace multiple instances of a search term in one request.",
25+
name: "settings.advanced.searchReplace.title",
26+
description: "settings.advanced.searchReplace.description",
2927
enabled: false,
3028
},
3129
INSERT_BLOCK: {
32-
name: "Use experimental insert content tool",
30+
name: "settings.advanced.insertBlock.title",
3331

34-
description:
35-
"Enable the experimental insert content tool, allowing Roo to insert content at specific line numbers without needing to create a diff.",
32+
description: "settings.advanced.insertBlock.description",
3633
enabled: false,
3734
},
3835
}

src/shared/support-prompt.ts

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@ interface SupportPromptConfig {
3232

3333
const supportPromptConfigs: Record<string, SupportPromptConfig> = {
3434
ENHANCE: {
35-
label: "Enhance Prompt",
36-
description:
37-
"Use prompt enhancement to get tailored suggestions or improvements for your inputs. This ensures Roo understands your intent and provides the best possible responses. Available via the ✨ icon in chat.",
38-
template: `Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):
39-
35+
label: "supportPrompt.ENHANCE.label",
36+
description: "supportPrompt.ENHANCE.description",
37+
template: `Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, or surrounding quotes):
4038
\${userInput}`,
4139
},
4240
EXPLAIN: {
43-
label: "Explain Code",
44-
description:
45-
"Get detailed explanations of code snippets, functions, or entire files. Useful for understanding complex code or learning new patterns. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
41+
label: "supportPrompt.EXPLAIN.label",
42+
description: "supportPrompt.EXPLAIN.description",
4643
template: `Explain the following code from file path @/\${filePath}:
4744
\${userInput}
4845
@@ -56,9 +53,8 @@ Please provide a clear and concise explanation of what this code does, including
5653
3. Important patterns or techniques used`,
5754
},
5855
FIX: {
59-
label: "Fix Issues",
60-
description:
61-
"Get help identifying and resolving bugs, errors, or code quality issues. Provides step-by-step guidance for fixing problems. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
56+
label: "supportPrompt.FIX.label",
57+
description: "supportPrompt.FIX.description",
6258
template: `Fix any issues in the following code from file path @/\${filePath}
6359
\${diagnosticText}
6460
\${userInput}
@@ -74,9 +70,8 @@ Please:
7470
4. Explain what was fixed and why`,
7571
},
7672
IMPROVE: {
77-
label: "Improve Code",
78-
description:
79-
"Receive suggestions for code optimization, better practices, and architectural improvements while maintaining functionality. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
73+
label: "supportPrompt.IMPROVE.label",
74+
description: "supportPrompt.IMPROVE.description",
8075
template: `Improve the following code from file path @/\${filePath}:
8176
\${userInput}
8277
@@ -89,47 +84,41 @@ Please suggest improvements for:
8984
2. Performance optimization
9085
3. Best practices and patterns
9186
4. Error handling and edge cases
92-
9387
Provide the improved code along with explanations for each enhancement.`,
9488
},
9589
ADD_TO_CONTEXT: {
96-
label: "Add to Context",
97-
description:
98-
"Add context to your current task or conversation. Useful for providing additional information or clarifications. Available in code actions (lightbulb icon in the editor). and the editor context menu (right-click on selected code).",
90+
label: "supportPrompt.ADD_TO_CONTEXT.label",
91+
description: "supportPrompt.ADD_TO_CONTEXT.description",
9992
template: `@/\${filePath}:
10093
\`\`\`
10194
\${selectedText}
10295
\`\`\``,
10396
},
10497
TERMINAL_ADD_TO_CONTEXT: {
105-
label: "Add Terminal Content to Context",
106-
description:
107-
"Add terminal output to your current task or conversation. Useful for providing command outputs or logs. Available in the terminal context menu (right-click on selected terminal content).",
98+
label: "supportPrompt.TERMINAL_ADD_TO_CONTEXT.label",
99+
description: "supportPrompt.TERMINAL_ADD_TO_CONTEXT.description",
108100
template: `\${userInput}
109101
Terminal output:
110102
\`\`\`
111103
\${terminalContent}
112104
\`\`\``,
113105
},
114106
TERMINAL_FIX: {
115-
label: "Fix Terminal Command",
116-
description:
117-
"Get help fixing terminal commands that failed or need improvement. Available in the terminal context menu (right-click on selected terminal content).",
107+
label: "supportPrompt.TERMINAL_FIX.label",
108+
description: "supportPrompt.TERMINAL_FIX.description",
118109
template: `\${userInput}
119110
Fix this terminal command:
120111
\`\`\`
121112
\${terminalContent}
122113
\`\`\`
123-
124114
Please:
125115
1. Identify any issues in the command
126116
2. Provide the corrected command
127117
3. Explain what was fixed and why`,
128118
},
129119
TERMINAL_EXPLAIN: {
130-
label: "Explain Terminal Command",
131-
description:
132-
"Get detailed explanations of terminal commands and their outputs. Available in the terminal context menu (right-click on selected terminal content).",
120+
label: "supportPrompt.TERMINAL_EXPLAIN.label",
121+
description: "supportPrompt.TERMINAL_EXPLAIN.description",
133122
template: `\${userInput}
134123
Explain this terminal command:
135124
\`\`\`

src/shared/tool-groups.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export function getToolOptions(toolConfig: string | readonly [ToolName, ...any[]
6969

7070
// Display names for groups in UI
7171
export const GROUP_DISPLAY_NAMES: Record<ToolGroup, string> = {
72-
read: "Read Files",
73-
edit: "Edit Files",
74-
browser: "Use Browser",
75-
command: "Run Commands",
76-
mcp: "Use MCP",
72+
read: "tools.read.description",
73+
edit: "tools.edit.description",
74+
browser: "tools.browser.description",
75+
command: "tools.command.description",
76+
mcp: "tools.mcp.description",
7777
}

0 commit comments

Comments
 (0)