Skip to content

Commit f0ac4ab

Browse files
committed
Localize experimental checkboxes
1 parent 29bab0a commit f0ac4ab

File tree

23 files changed

+410
-60
lines changed

23 files changed

+410
-60
lines changed

src/shared/__tests__/experiments.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ describe("experiments", () => {
55
it("is configured correctly", () => {
66
expect(EXPERIMENT_IDS.POWER_STEERING).toBe("powerSteering")
77
expect(experimentConfigsMap.POWER_STEERING).toMatchObject({
8-
name: 'Use experimental "power steering" mode',
9-
description:
10-
"When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.",
118
enabled: false,
129
})
1310
})

src/shared/experiments.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,25 @@ export type ExperimentKey = keyof typeof EXPERIMENT_IDS
1010
export type ExperimentId = valueof<typeof EXPERIMENT_IDS>
1111

1212
export interface ExperimentConfig {
13-
name: string
14-
description: string
1513
enabled: boolean
1614
}
1715

1816
type valueof<X> = X[keyof X]
1917

2018
export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
2119
DIFF_STRATEGY: {
22-
name: "Use experimental unified diff strategy",
23-
description:
24-
"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.",
2520
enabled: false,
2621
},
2722
SEARCH_AND_REPLACE: {
28-
name: "Use experimental search and replace tool",
29-
description:
30-
"Enable the experimental search and replace tool, allowing Roo to replace multiple instances of a search term in one request.",
3123
enabled: false,
3224
},
3325
INSERT_BLOCK: {
34-
name: "Use experimental insert content tool",
35-
36-
description:
37-
"Enable the experimental insert content tool, allowing Roo to insert content at specific line numbers without needing to create a diff.",
3826
enabled: false,
3927
},
4028
POWER_STEERING: {
41-
name: 'Use experimental "power steering" mode',
42-
description:
43-
"When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message.",
4429
enabled: false,
4530
},
4631
MULTI_SEARCH_AND_REPLACE: {
47-
name: "Use experimental multi block diff tool",
48-
description:
49-
"When enabled, Roo will use multi block diff tool. This will try to update multiple code blocks in the file in one request.",
5032
enabled: false,
5133
},
5234
}
@@ -67,17 +49,4 @@ export const experiments = {
6749
},
6850
} as const
6951

70-
// Expose experiment details for UI - pre-compute from map for better performance
71-
export const experimentLabels = Object.fromEntries(
72-
Object.entries(experimentConfigsMap).map(([_, config]) => [
73-
EXPERIMENT_IDS[_ as keyof typeof EXPERIMENT_IDS] as ExperimentId,
74-
config.name,
75-
]),
76-
) as Record<string, string>
77-
78-
export const experimentDescriptions = Object.fromEntries(
79-
Object.entries(experimentConfigsMap).map(([_, config]) => [
80-
EXPERIMENT_IDS[_ as keyof typeof EXPERIMENT_IDS] as ExperimentId,
81-
config.description,
82-
]),
83-
) as Record<string, string>
52+
// No longer needed as we use translation keys directly in the UI

webview-ui/src/components/settings/ExperimentalFeature.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@ import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
22
import { useAppTranslation } from "@/i18n/TranslationContext"
33

44
interface ExperimentalFeatureProps {
5-
name: string
6-
description: string
75
enabled: boolean
86
onChange: (value: boolean) => void
7+
// Additional property to identify the experiment
8+
experimentKey?: string
99
}
1010

11-
export const ExperimentalFeature = ({ name, description, enabled, onChange }: ExperimentalFeatureProps) => {
11+
export const ExperimentalFeature = ({ enabled, onChange, experimentKey }: ExperimentalFeatureProps) => {
1212
const { t } = useAppTranslation()
1313

14+
// Generate translation keys based on experiment key
15+
const nameKey = experimentKey ? `settings:experimental.${experimentKey}.name` : ""
16+
const descriptionKey = experimentKey ? `settings:experimental.${experimentKey}.description` : ""
17+
1418
return (
1519
<div>
1620
<div className="flex items-center gap-2">
1721
<span className="text-vscode-errorForeground">{t("settings:experimental.warning")}</span>
1822
<VSCodeCheckbox checked={enabled} onChange={(e: any) => onChange(e.target.checked)}>
19-
<span className="font-medium">{name}</span>
23+
<span className="font-medium">{t(nameKey)}</span>
2024
</VSCodeCheckbox>
2125
</div>
22-
<p className="text-vscode-descriptionForeground text-sm mt-0">{description}</p>
26+
<p className="text-vscode-descriptionForeground text-sm mt-0">{t(descriptionKey)}</p>
2327
</div>
2428
)
2529
}

webview-ui/src/components/settings/ExperimentalSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const ExperimentalSettings = ({
4242
.map((config) => (
4343
<ExperimentalFeature
4444
key={config[0]}
45-
{...config[1]}
45+
experimentKey={config[0]}
4646
enabled={experiments[EXPERIMENT_IDS[config[0] as keyof typeof EXPERIMENT_IDS]] ?? false}
4747
onChange={(enabled) =>
4848
setExperimentEnabled(EXPERIMENT_IDS[config[0] as keyof typeof EXPERIMENT_IDS], enabled)

webview-ui/src/i18n/locales/ar/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "استخدام استراتيجية diff الموحدة التجريبية",
172+
"description": "تمكين استراتيجية diff الموحدة التجريبية. قد تقلل هذه الاستراتيجية من عدد إعادة المحاولات الناجمة عن أخطاء النموذج ولكنها قد تسبب سلوكًا غير متوقع أو تعديلات غير صحيحة. قم بتمكينها فقط إذا كنت تفهم المخاطر وعلى استعداد لمراجعة جميع التغييرات بعناية."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "استخدام أداة البحث والاستبدال التجريبية",
176+
"description": "تمكين أداة البحث والاستبدال التجريبية، مما يسمح لـ Roo باستبدال عدة مثيلات لمصطلح البحث في طلب واحد."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "استخدام أداة إدراج المحتوى التجريبية",
180+
"description": "تمكين أداة إدراج المحتوى التجريبية، مما يسمح لـ Roo بإدراج محتوى في أرقام أسطر محددة دون الحاجة إلى إنشاء diff."
181+
},
182+
"POWER_STEERING": {
183+
"name": "استخدام وضع \"التوجيه المعزز\" التجريبي",
184+
"description": "عند تمكينه، سيذكر Roo النموذج بتفاصيل تعريف وضعه الحالي بشكل أكثر تكرارًا. سيؤدي ذلك إلى التزام أقوى بتعريفات الأدوار والتعليمات المخصصة، ولكنه سيستخدم المزيد من token لكل رسالة."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "استخدام أداة diff متعددة الكتل التجريبية",
188+
"description": "عند تمكينه، سيستخدم Roo أداة diff متعددة الكتل. سيحاول هذا تحديث عدة كتل من الكود في الملف في طلب واحد."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "استخدام درجة حرارة مخصصة",

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "Utilitzar estratègia diff unificada experimental",
172+
"description": "Activar l'estratègia diff unificada experimental. Aquesta estratègia podria reduir el nombre de reintents causats per errors del model, però pot causar comportaments inesperats o edicions incorrectes. Activeu-la només si enteneu els riscos i esteu disposats a revisar acuradament tots els canvis."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "Utilitzar eina de cerca i reemplaçament experimental",
176+
"description": "Activar l'eina de cerca i reemplaçament experimental, permetent a Roo reemplaçar múltiples instàncies d'un terme de cerca en una sola petició."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "Utilitzar eina d'inserció de contingut experimental",
180+
"description": "Activar l'eina d'inserció de contingut experimental, permetent a Roo inserir contingut a números de línia específics sense necessitat de crear un diff."
181+
},
182+
"POWER_STEERING": {
183+
"name": "Utilitzar mode \"direcció assistida\" experimental",
184+
"description": "Quan està activat, Roo recordarà al model els detalls de la seva definició de mode actual amb més freqüència. Això portarà a una adherència més forta a les definicions de rol i instruccions personalitzades, però utilitzarà més tokens per missatge."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "Utilitzar eina diff de blocs múltiples experimental",
188+
"description": "Quan està activat, Roo utilitzarà l'eina diff de blocs múltiples. Això intentarà actualitzar múltiples blocs de codi a l'arxiu en una sola petició."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "Utilitzar temperatura personalitzada",

webview-ui/src/i18n/locales/cs/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "Použít experimentální sjednocenou strategii diff",
172+
"description": "Povolit experimentální sjednocenou strategii diff. Tato strategie může snížit počet opakování způsobených chybami modelu, ale může způsobit neočekávané chování nebo nesprávné úpravy. Povolte pouze pokud rozumíte rizikům a jste ochotni pečlivě zkontrolovat všechny změny."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "Použít experimentální nástroj pro vyhledávání a nahrazování",
176+
"description": "Povolit experimentální nástroj pro vyhledávání a nahrazování, umožňující Roo nahradit více výskytů hledaného výrazu v jednom požadavku."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "Použít experimentální nástroj pro vkládání obsahu",
180+
"description": "Povolit experimentální nástroj pro vkládání obsahu, umožňující Roo vkládat obsah na konkrétní čísla řádků bez nutnosti vytvářet diff."
181+
},
182+
"POWER_STEERING": {
183+
"name": "Použít experimentální režim \"posilovače řízení\"",
184+
"description": "Když je povoleno, Roo bude častěji připomínat modelu podrobnosti o definici jeho aktuálního režimu. To povede k silnějšímu dodržování definic rolí a vlastních instrukcí, ale bude používat více tokenů na zprávu."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "Použít experimentální nástroj pro více bloků diff",
188+
"description": "Když je povoleno, Roo použije nástroj pro více bloků diff. Tím se pokusí aktualizovat více bloků kódu v souboru v jednom požadavku."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "Použít vlastní teplotu",

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "Experimentelle einheitliche Diff-Strategie verwenden",
172+
"description": "Aktiviert die experimentelle einheitliche Diff-Strategie. Diese Strategie könnte die Anzahl der durch Modellfehler verursachten Wiederholungen reduzieren, kann aber unerwartetes Verhalten oder falsche Bearbeitungen verursachen. Nur aktivieren, wenn Sie die Risiken verstehen und bereit sind, alle Änderungen sorgfältig zu überprüfen."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "Experimentelles Such- und Ersetzungswerkzeug verwenden",
176+
"description": "Aktiviert das experimentelle Such- und Ersetzungswerkzeug, das Roo ermöglicht, mehrere Instanzen eines Suchbegriffs in einer Anfrage zu ersetzen."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "Experimentelles Inhalts-Einfüge-Werkzeug verwenden",
180+
"description": "Aktiviert das experimentelle Inhalts-Einfüge-Werkzeug, das Roo ermöglicht, Inhalte an bestimmten Zeilennummern einzufügen, ohne einen Diff erstellen zu müssen."
181+
},
182+
"POWER_STEERING": {
183+
"name": "Experimentellen \"Servolenkung\"-Modus verwenden",
184+
"description": "Wenn aktiviert, wird Roo das Modell häufiger an die Details seiner aktuellen Modusdefinition erinnern. Dies führt zu einer stärkeren Einhaltung von Rollendefinitionen und benutzerdefinierten Anweisungen, verwendet aber mehr Tokens pro Nachricht."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "Experimentelles Multi-Block-Diff-Werkzeug verwenden",
188+
"description": "Wenn aktiviert, verwendet Roo das Multi-Block-Diff-Werkzeug. Dies versucht, mehrere Codeblöcke in der Datei in einer Anfrage zu aktualisieren."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "Benutzerdefinierte Temperatur verwenden",

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "Use experimental unified diff strategy",
172+
"description": "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."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "Use experimental search and replace tool",
176+
"description": "Enable the experimental search and replace tool, allowing Roo to replace multiple instances of a search term in one request."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "Use experimental insert content tool",
180+
"description": "Enable the experimental insert content tool, allowing Roo to insert content at specific line numbers without needing to create a diff."
181+
},
182+
"POWER_STEERING": {
183+
"name": "Use experimental \"power steering\" mode",
184+
"description": "When enabled, Roo will remind the model about the details of its current mode definition more frequently. This will lead to stronger adherence to role definitions and custom instructions, but will use more tokens per message."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "Use experimental multi block diff tool",
188+
"description": "When enabled, Roo will use multi block diff tool. This will try to update multiple code blocks in the file in one request."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "Use custom temperature",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,27 @@
166166
}
167167
},
168168
"experimental": {
169-
"warning": "⚠️"
169+
"warning": "⚠️",
170+
"DIFF_STRATEGY": {
171+
"name": "Usar estrategia de diff unificada experimental",
172+
"description": "Habilitar la estrategia de diff unificada experimental. Esta estrategia podría reducir el número de reintentos causados por errores del modelo, pero puede causar comportamientos inesperados o ediciones incorrectas. Habilítela solo si comprende los riesgos y está dispuesto a revisar cuidadosamente todos los cambios."
173+
},
174+
"SEARCH_AND_REPLACE": {
175+
"name": "Usar herramienta experimental de búsqueda y reemplazo",
176+
"description": "Habilitar la herramienta experimental de búsqueda y reemplazo, permitiendo a Roo reemplazar múltiples instancias de un término de búsqueda en una sola solicitud."
177+
},
178+
"INSERT_BLOCK": {
179+
"name": "Usar herramienta experimental de inserción de contenido",
180+
"description": "Habilitar la herramienta experimental de inserción de contenido, permitiendo a Roo insertar contenido en números de línea específicos sin necesidad de crear un diff."
181+
},
182+
"POWER_STEERING": {
183+
"name": "Usar modo experimental de \"dirección asistida\"",
184+
"description": "Cuando está habilitado, Roo recordará al modelo los detalles de su definición de modo actual con más frecuencia. Esto llevará a una mayor adherencia a las definiciones de roles e instrucciones personalizadas, pero usará más tokens por mensaje."
185+
},
186+
"MULTI_SEARCH_AND_REPLACE": {
187+
"name": "Usar herramienta experimental de diff de bloques múltiples",
188+
"description": "Cuando está habilitado, Roo usará la herramienta de diff de bloques múltiples. Esto intentará actualizar múltiples bloques de código en el archivo en una sola solicitud."
189+
}
170190
},
171191
"temperature": {
172192
"useCustom": "Usar temperatura personalizada",

0 commit comments

Comments
 (0)