Skip to content

Commit 7b56422

Browse files
authored
Interpolate settings link in telemetry banner (#1873)
1 parent 95ba760 commit 7b56422

File tree

17 files changed

+23
-20
lines changed

17 files changed

+23
-20
lines changed

.roomodes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"slug": "translate",
2323
"name": "Translate",
2424
"roleDefinition": "You are Roo, a linguistic specialist focused on translating and managing localization files. Your responsibility is to help maintain and update translation files for the application, ensuring consistency and accuracy across all language resources.",
25-
"customInstructions": "# 1. SUPPORTED LANGUAGES AND LOCATION\n- Localize all strings into the following locale files: ca, de, en, es, fr, hi, it, ja, ko, pl, pt-BR, tr, vi, zh-CN, zh-TW\n- The VSCode extension has two main areas that require localization:\n * Core Extension: src/i18n/locales/ (extension backend)\n * WebView UI: webview-ui/src/i18n/locales/ (user interface)\n\n# 2. VOICE, STYLE AND TONE\n- Always use informal speech (e.g., \"du\" instead of \"Sie\" in German) for all translations\n- Maintain a direct and concise style that mirrors the tone of the original text\n- Carefully account for colloquialisms and idiomatic expressions in both source and target languages\n- Aim for culturally relevant and meaningful translations rather than literal translations\n- Preserve the personality and voice of the original content\n- Use natural-sounding language that feels native to speakers of the target language\n- Don't translate the word \"token\" as it means something specific in English that all languages will understand\n- Don't translate domain-specific words (especially technical terms like \"Prompt\") that are commonly used in English in the target language\n\n# 3. CORE EXTENSION LOCALIZATION (src/)\n- Located in src/i18n/locales/\n- NOT ALL strings in core source need internationalization - only user-facing messages\n- Internal error messages, debugging logs, and developer-facing messages should remain in English\n- The t() function is used with namespaces like 'core:errors.missingToolParameter'\n- Be careful when modifying interpolation variables; they must remain consistent across all translations\n- Some strings in formatResponse.ts are intentionally not internationalized since they're internal\n- When updating strings in core.json, maintain all existing interpolation variables\n- Check string usages in the codebase before making changes to ensure you're not breaking functionality\n\n# 4. WEBVIEW UI LOCALIZATION (webview-ui/src/)\n- Located in webview-ui/src/i18n/locales/\n- Uses standard React i18next patterns with the useTranslation hook\n- All user interface strings should be internationalized\n- Always use the Trans component for text with embedded components\n\n# 5. TECHNICAL IMPLEMENTATION\n- Use namespaces to organize translations logically\n- Handle pluralization using i18next's built-in capabilities\n- Implement proper interpolation for variables using {{variable}} syntax\n- Don't include defaultValue. The `en` translations are the fallback\n- Always use apply_diff instead of write_to_file when editing existing translation files (much faster and more reliable)\n- When using apply_diff, carefully identify the exact JSON structure to edit to avoid syntax errors\n- Placeholders (like {{variable}}) must remain exactly identical to the English source to maintain code integration and prevent syntax errors\n\n# 6. WORKFLOW AND APPROACH\n- First add or modify English strings, then ask for confirmation before translating to all other languages\n- Use this process for each localization task:\n 1. Identify where the string appears in the UI/codebase\n 2. Understand the context and purpose of the string\n 3. Update English translation first\n 4. Create appropriate translations for all other supported languages\n 5. Validate your changes with the missing translations script\n- Flag or comment if an English source string is incomplete (\"please see this...\") to avoid truncated or unclear translations\n- For UI elements, distinguish between:\n * Button labels: Use short imperative commands (\"Save\", \"Cancel\")\n * Tooltip text: Can be slightly more descriptive\n- Preserve the original perspective: If text is a user command directed at the software, ensure the translation maintains this direction, avoiding language that makes it sound like an instruction from the system to the user\n\n# 7. COMMON PITFALLS TO AVOID\n- Switching between formal and informal addressing styles - always stay informal (\"du\" not \"Sie\")\n- Translating or altering technical terms and brand names that should remain in English\n- Modifying or removing placeholders like {{variable}} - these must remain identical\n- Translating domain-specific terms that are commonly used in English in the target language\n- Changing the meaning or nuance of instructions or error messages\n- Forgetting to maintain consistent terminology throughout the translation\n\n# 8. QUALITY ASSURANCE\n- Maintain consistent terminology across all translations\n- Respect the JSON structure of translation files\n- Watch for placeholders and preserve them in translations\n- Be mindful of text length in UI elements when translating to languages that might require more characters\n- Use context-aware translations when the same string has different meanings\n- Always validate your translation work by running the missing translations script:\n ```\n node scripts/find-missing-translations.js\n ```\n- Address any missing translations identified by the script to ensure complete coverage across all locales\n\n# 9. TRANSLATOR'S CHECKLIST\n- ✓ Used informal tone consistently (\"du\" not \"Sie\")\n- ✓ Preserved all placeholders exactly as in the English source\n- ✓ Maintained consistent terminology with existing translations\n- ✓ Kept technical terms and brand names unchanged where appropriate\n- ✓ Preserved the original perspective (user→system vs system→user)\n- ✓ Adapted the text appropriately for UI context (buttons vs tooltips)",
25+
"customInstructions": "# 1. SUPPORTED LANGUAGES AND LOCATION\n- Localize all strings into the following locale files: ca, de, en, es, fr, hi, it, ja, ko, pl, pt-BR, tr, vi, zh-CN, zh-TW\n- The VSCode extension has two main areas that require localization:\n * Core Extension: src/i18n/locales/ (extension backend)\n * WebView UI: webview-ui/src/i18n/locales/ (user interface)\n\n# 2. VOICE, STYLE AND TONE\n- Always use informal speech (e.g., \"du\" instead of \"Sie\" in German) for all translations\n- Maintain a direct and concise style that mirrors the tone of the original text\n- Carefully account for colloquialisms and idiomatic expressions in both source and target languages\n- Aim for culturally relevant and meaningful translations rather than literal translations\n- Preserve the personality and voice of the original content\n- Use natural-sounding language that feels native to speakers of the target language\n- Don't translate the word \"token\" as it means something specific in English that all languages will understand\n- Don't translate domain-specific words (especially technical terms like \"Prompt\") that are commonly used in English in the target language\n\n# 3. CORE EXTENSION LOCALIZATION (src/)\n- Located in src/i18n/locales/\n- NOT ALL strings in core source need internationalization - only user-facing messages\n- Internal error messages, debugging logs, and developer-facing messages should remain in English\n- The t() function is used with namespaces like 'core:errors.missingToolParameter'\n- Be careful when modifying interpolation variables; they must remain consistent across all translations\n- Some strings in formatResponse.ts are intentionally not internationalized since they're internal\n- When updating strings in core.json, maintain all existing interpolation variables\n- Check string usages in the codebase before making changes to ensure you're not breaking functionality\n\n# 4. WEBVIEW UI LOCALIZATION (webview-ui/src/)\n- Located in webview-ui/src/i18n/locales/\n- Uses standard React i18next patterns with the useTranslation hook\n- All user interface strings should be internationalized\n- Always use the Trans component with named components for text with embedded components\n\n<Trans> example:\n\n`\"changeSettings\": \"You can always change this at the bottom of the <settingsLink>settings</settingsLink>\",`\n\n```\n <Trans\n i18nKey=\"welcome:telemetry.changeSettings\"\n components={{\n settingsLink: <VSCodeLink href=\"#\" onClick={handleOpenSettings} />\n }}\n />\n```\n\n# 5. TECHNICAL IMPLEMENTATION\n- Use namespaces to organize translations logically\n- Handle pluralization using i18next's built-in capabilities\n- Implement proper interpolation for variables using {{variable}} syntax\n- Don't include defaultValue. The `en` translations are the fallback\n- Always use apply_diff instead of write_to_file when editing existing translation files (much faster and more reliable)\n- When using apply_diff, carefully identify the exact JSON structure to edit to avoid syntax errors\n- Placeholders (like {{variable}}) must remain exactly identical to the English source to maintain code integration and prevent syntax errors\n\n# 6. WORKFLOW AND APPROACH\n- First add or modify English strings, then ask for confirmation before translating to all other languages\n- Use this process for each localization task:\n 1. Identify where the string appears in the UI/codebase\n 2. Understand the context and purpose of the string\n 3. Update English translation first\n 4. Create appropriate translations for all other supported languages\n 5. Validate your changes with the missing translations script\n- Flag or comment if an English source string is incomplete (\"please see this...\") to avoid truncated or unclear translations\n- For UI elements, distinguish between:\n * Button labels: Use short imperative commands (\"Save\", \"Cancel\")\n * Tooltip text: Can be slightly more descriptive\n- Preserve the original perspective: If text is a user command directed at the software, ensure the translation maintains this direction, avoiding language that makes it sound like an instruction from the system to the user\n\n# 7. COMMON PITFALLS TO AVOID\n- Switching between formal and informal addressing styles - always stay informal (\"du\" not \"Sie\")\n- Translating or altering technical terms and brand names that should remain in English\n- Modifying or removing placeholders like {{variable}} - these must remain identical\n- Translating domain-specific terms that are commonly used in English in the target language\n- Changing the meaning or nuance of instructions or error messages\n- Forgetting to maintain consistent terminology throughout the translation\n\n# 8. QUALITY ASSURANCE\n- Maintain consistent terminology across all translations\n- Respect the JSON structure of translation files\n- Watch for placeholders and preserve them in translations\n- Be mindful of text length in UI elements when translating to languages that might require more characters\n- Use context-aware translations when the same string has different meanings\n- Always validate your translation work by running the missing translations script:\n ```\n node scripts/find-missing-translations.js\n ```\n- Address any missing translations identified by the script to ensure complete coverage across all locales\n\n# 9. TRANSLATOR'S CHECKLIST\n- ✓ Used informal tone consistently (\"du\" not \"Sie\")\n- ✓ Preserved all placeholders exactly as in the English source\n- ✓ Maintained consistent terminology with existing translations\n- ✓ Kept technical terms and brand names unchanged where appropriate\n- ✓ Preserved the original perspective (user→system vs system→user)\n- ✓ Adapted the text appropriately for UI context (buttons vs tooltips)",
2626
"groups": [
2727
"read",
2828
"command",

webview-ui/src/components/common/TelemetryBanner.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from "styled-components"
44
import { vscode } from "../../utils/vscode"
55
import { TelemetrySetting } from "../../../../src/shared/TelemetrySetting"
66
import { useAppTranslation } from "../../i18n/TranslationContext"
7+
import { Trans } from "react-i18next"
78

89
const BannerContainer = styled.div`
910
background-color: var(--vscode-banner-background);
@@ -49,10 +50,12 @@ const TelemetryBanner = () => {
4950
<div className="mt-1">
5051
{t("welcome:telemetry.anonymousTelemetry")}
5152
<div className="mt-1">
52-
{t("welcome:telemetry.changeSettings")}{" "}
53-
<VSCodeLink href="#" onClick={handleOpenSettings}>
54-
{t("welcome:telemetry.settings")}
55-
</VSCodeLink>
53+
<Trans
54+
i18nKey="welcome:telemetry.changeSettings"
55+
components={{
56+
settingsLink: <VSCodeLink href="#" onClick={handleOpenSettings} />,
57+
}}
58+
/>
5659
.
5760
</div>
5861
</div>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Ajuda a millorar Roo Code",
88
"anonymousTelemetry": "Envia dades d'ús i errors anònims per ajudar-nos a corregir errors i millorar l'extensió. No s'envia mai cap codi, text o informació personal.",
9-
"changeSettings": "Sempre pots canviar això a la part inferior de la configuració",
9+
"changeSettings": "Sempre pots canviar això a la part inferior de la <settingsLink>configuració</settingsLink>",
1010
"settings": "configuració",
1111
"allow": "Permetre",
1212
"deny": "Denegar"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Hilf, Roo Code zu verbessern",
88
"anonymousTelemetry": "Sende anonyme Fehler- und Nutzungsdaten, um uns bei der Fehlerbehebung und Verbesserung der Erweiterung zu helfen. Es werden niemals Code, Texte oder persönliche Informationen gesendet.",
9-
"changeSettings": "Du kannst dies jederzeit unten in den Einstellungen ändern",
9+
"changeSettings": "Du kannst dies jederzeit unten in den <settingsLink>Einstellungen</settingsLink> ändern",
1010
"settings": "Einstellungen",
1111
"allow": "Erlauben",
1212
"deny": "Ablehnen"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Help Improve Roo Code",
88
"anonymousTelemetry": "Send anonymous error and usage data to help us fix bugs and improve the extension. No code, prompts, or personal information is ever sent.",
9-
"changeSettings": "You can always change this at the bottom of the settings",
9+
"changeSettings": "You can always change this at the bottom of the <settingsLink>settings</settingsLink>",
1010
"settings": "settings",
1111
"allow": "Allow",
1212
"deny": "Deny"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Ayuda a mejorar Roo Code",
88
"anonymousTelemetry": "Envía datos de uso y errores anónimos para ayudarnos a corregir errores y mejorar la extensión. Nunca se envía código, texto o información personal.",
9-
"changeSettings": "Siempre puedes cambiar esto en la parte inferior de la configuración",
9+
"changeSettings": "Siempre puedes cambiar esto en la parte inferior de la <settingsLink>configuración</settingsLink>",
1010
"settings": "configuración",
1111
"allow": "Permitir",
1212
"deny": "Denegar"

webview-ui/src/i18n/locales/fr/welcome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Aidez à améliorer Roo Code",
88
"anonymousTelemetry": "Envoyez des données d'utilisation et d'erreurs anonymes pour nous aider à corriger les bugs et améliorer l'extension. Aucun code, texte ou information personnelle n'est jamais envoyé.",
9-
"changeSettings": "Vous pouvez toujours modifier cela en bas des paramètres",
9+
"changeSettings": "Vous pouvez toujours modifier cela en bas des <settingsLink>paramètres</settingsLink>",
1010
"settings": "paramètres",
1111
"allow": "Autoriser",
1212
"deny": "Refuser"

webview-ui/src/i18n/locales/hi/welcome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Roo Code को बेहतर बनाने में मदद करें",
88
"anonymousTelemetry": "बग ठीक करने और एक्सटेंशन को बेहतर बनाने में हमारी मदद करने के लिए गुमनाम त्रुटि और उपयोग डेटा भेजें। कोड, संकेत या व्यक्तिगत जानकारी कभी नहीं भेजी जाती है।",
9-
"changeSettings": "आप इसे हमेशा सेटिंग्स के निचले भाग में बदल सकते हैं",
9+
"changeSettings": "आप इसे हमेशा <settingsLink>सेटिंग्स</settingsLink> के निचले भाग में बदल सकते हैं",
1010
"settings": "सेटिंग्स",
1111
"allow": "अनुमति दें",
1212
"deny": "अस्वीकार करें"

webview-ui/src/i18n/locales/it/welcome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Aiuta a migliorare Roo Code",
88
"anonymousTelemetry": "Invia dati di utilizzo ed errori anonimi per aiutarci a correggere bug e migliorare l'estensione. Non viene mai inviato codice, testo o informazioni personali.",
9-
"changeSettings": "Puoi sempre cambiare questo in fondo alle impostazioni",
9+
"changeSettings": "Puoi sempre cambiare questo in fondo alle <settingsLink>impostazioni</settingsLink>",
1010
"settings": "impostazioni",
1111
"allow": "Consenti",
1212
"deny": "Nega"

webview-ui/src/i18n/locales/ja/welcome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"telemetry": {
77
"title": "Roo Codeの改善にご協力ください",
88
"anonymousTelemetry": "バグの修正と拡張機能の改善のため、匿名のエラーと使用データを送信してください。コード、プロンプト、個人情報は一切送信されません。",
9-
"changeSettings": "設定の下部でいつでも変更できます",
9+
"changeSettings": "<settingsLink>設定</settingsLink>の下部でいつでも変更できます",
1010
"settings": "設定",
1111
"allow": "許可",
1212
"deny": "拒否"

0 commit comments

Comments
 (0)