Skip to content

Commit 4283262

Browse files
authored
feat: use template variables for version numbers in announcement strings (#3755)
1 parent c042909 commit 4283262

File tree

19 files changed

+84
-36
lines changed

19 files changed

+84
-36
lines changed

webview-ui/src/components/chat/Announcement.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
44

55
import { useAppTranslation } from "@src/i18n/TranslationContext"
66
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@src/components/ui"
7+
import { version } from "../../../../package.json"
78

89
interface AnnouncementProps {
910
hideAnnouncement: () => void
@@ -34,8 +35,8 @@ const Announcement = ({ hideAnnouncement }: AnnouncementProps) => {
3435
}}>
3536
<DialogContent className="max-w-96">
3637
<DialogHeader>
37-
<DialogTitle>{t("chat:announcement.title")}</DialogTitle>
38-
<DialogDescription>{t("chat:announcement.description")}</DialogDescription>
38+
<DialogTitle>{t("chat:announcement.title", { version })}</DialogTitle>
39+
<DialogDescription>{t("chat:announcement.description", { version })}</DialogDescription>
3940
</DialogHeader>
4041
<div>
4142
<h3>{t("chat:announcement.whatsNew")}</h3>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { render, screen } from "@testing-library/react"
2+
import { jest } from "@jest/globals" // Or 'jest' if using Jest
3+
import { version } from "../../../../../package.json"
4+
5+
import Announcement from "../Announcement"
6+
7+
// Mock the components from @src/components/ui
8+
jest.mock("@src/components/ui", () => ({
9+
Dialog: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
10+
DialogContent: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
11+
DialogDescription: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
12+
DialogHeader: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
13+
DialogTitle: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
14+
}))
15+
16+
// Mock the useAppTranslation hook
17+
jest.mock("@src/i18n/TranslationContext", () => ({
18+
useAppTranslation: () => ({
19+
t: (key: string, options?: { version: string }) => {
20+
if (key === "chat:announcement.title") {
21+
return `🎉 Roo Code ${options?.version} Released`
22+
}
23+
if (key === "chat:announcement.description") {
24+
return `Roo Code ${options?.version} brings powerful new features and improvements based on your feedback.`
25+
}
26+
// Return key for other translations not relevant to this test
27+
return key
28+
},
29+
}),
30+
}))
31+
32+
describe("Announcement", () => {
33+
const mockHideAnnouncement = jest.fn()
34+
const expectedVersion = version
35+
36+
it("renders the announcement with the version number from package.json", () => {
37+
render(<Announcement hideAnnouncement={mockHideAnnouncement} />)
38+
39+
// Check if the mocked version number is present in the title and description
40+
expect(screen.getByText(`🎉 Roo Code ${expectedVersion} Released`)).toBeInTheDocument()
41+
expect(
42+
screen.getByText(
43+
`Roo Code ${expectedVersion} brings powerful new features and improvements based on your feedback.`,
44+
),
45+
).toBeInTheDocument()
46+
})
47+
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "Copiar a l'entrada (o Shift + clic)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 publicat",
211-
"description": "Roo Code 3.17 porta noves funcionalitats potents i millores basades en els teus comentaris.",
210+
"title": "🎉 Roo Code {{version}} publicat",
211+
"description": "Roo Code {{version}} porta noves funcionalitats potents i millores basades en els teus comentaris.",
212212
"whatsNew": "Novetats",
213213
"feature1": "<bold>Emmagatzematge en caché implícit per a Gemini</bold>: Les crides a l'API de Gemini ara s'emmagatzemen automàticament en caché, reduint els costos d'API",
214214
"feature2": "<bold>Selecció de mode més intel·ligent</bold>: Les definicions de mode ara poden incloure orientació sobre quan s'ha d'utilitzar cada mode, permetent una millor orquestració",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "In Eingabefeld kopieren (oder Shift + Klick)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 veröffentlicht",
211-
"description": "Roo Code 3.17 bringt leistungsstarke neue Funktionen und Verbesserungen basierend auf deinem Feedback.",
210+
"title": "🎉 Roo Code {{version}} veröffentlicht",
211+
"description": "Roo Code {{version}} bringt leistungsstarke neue Funktionen und Verbesserungen basierend auf deinem Feedback.",
212212
"whatsNew": "Was ist neu",
213213
"feature1": "<bold>Implizites Caching für Gemini</bold>: Gemini API-Aufrufe werden jetzt automatisch zwischengespeichert, wodurch API-Kosten reduziert werden",
214214
"feature2": "<bold>Intelligentere Modusauswahl</bold>: Modusdefinitionen können jetzt Hinweise enthalten, wann jeder Modus verwendet werden sollte, was eine bessere Orchestrierung ermöglicht",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@
200200
"description": "Auto-approve allows Roo Code to perform actions without asking for permission. Only enable for actions you fully trust. More detailed configuration available in <settingsLink>Settings</settingsLink>."
201201
},
202202
"announcement": {
203-
"title": "🎉 Roo Code 3.17 Released",
204-
"description": "Roo Code 3.17 brings powerful new features and improvements based on your feedback.",
203+
"title": "🎉 Roo Code {{version}} Released",
204+
"description": "Roo Code {{version}} brings powerful new features and improvements based on your feedback.",
205205
"whatsNew": "What's New",
206206
"feature1": "<bold>Implicit Caching for Gemini</bold>: Gemini API calls are now automatically cached, reducing API costs",
207207
"feature2": "<bold>Smarter Mode Selection</bold>: Mode definitions can now include guidance on when each mode should be used, enabling better orchestration",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "Copiar a la entrada (o Shift + clic)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 publicado",
211-
"description": "Roo Code 3.17 trae potentes nuevas funcionalidades y mejoras basadas en tus comentarios.",
210+
"title": "🎉 Roo Code {{version}} publicado",
211+
"description": "Roo Code {{version}} trae potentes nuevas funcionalidades y mejoras basadas en tus comentarios.",
212212
"whatsNew": "Novedades",
213213
"feature1": "<bold>Caché implícito para Gemini</bold>: Las llamadas a la API de Gemini ahora se almacenan automáticamente en caché, reduciendo los costos de API",
214214
"feature2": "<bold>Selección de modo más inteligente</bold>: Las definiciones de modo ahora pueden incluir orientación sobre cuándo debe usarse cada modo, permitiendo una mejor orquestación",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "Copier vers l'entrée (ou Shift + clic)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 est sortie",
211-
"description": "Roo Code 3.17 apporte de puissantes nouvelles fonctionnalités et améliorations basées sur vos retours.",
210+
"title": "🎉 Roo Code {{version}} est sortie",
211+
"description": "Roo Code {{version}} apporte de puissantes nouvelles fonctionnalités et améliorations basées sur vos retours.",
212212
"whatsNew": "Quoi de neuf",
213213
"feature1": "<bold>Mise en cache implicite pour Gemini</bold> : Les appels à l'API Gemini sont désormais automatiquement mis en cache, réduisant les coûts d'API",
214214
"feature2": "<bold>Sélection de mode plus intelligente</bold> : Les définitions de mode peuvent maintenant inclure des indications sur quand chaque mode doit être utilisé, permettant une meilleure orchestration",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "इनपुट में कॉपी करें (या Shift + क्लिक)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 रिलीज़ हुआ",
211-
"description": "Roo Code 3.17 आपके फीडबैक के आधार पर शक्तिशाली नई सुविधाएँ और सुधार लाता है।",
210+
"title": "🎉 Roo Code {{version}} रिलीज़ हुआ",
211+
"description": "Roo Code {{version}} आपके फीडबैक के आधार पर शक्तिशाली नई सुविधाएँ और सुधार लाता है।",
212212
"whatsNew": "नई सुविधाएँ",
213213
"feature1": "<bold>Gemini के लिए अंतर्निहित कैशिंग</bold>: Gemini API कॉल अब स्वचालित रूप से कैश किए जाते हैं, जिससे API लागत कम होती है",
214214
"feature2": "<bold>स्मार्ट मोड चयन</bold>: मोड परिभाषाओं में अब यह मार्गदर्शन शामिल हो सकता है कि प्रत्येक मोड कब उपयोग किया जाना चाहिए, जिससे बेहतर समन्वय संभव हो",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "Copia nell'input (o Shift + clic)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Rilasciato Roo Code 3.17",
211-
"description": "Roo Code 3.17 introduce potenti nuove funzionalità e miglioramenti basati sui tuoi feedback.",
210+
"title": "🎉 Rilasciato Roo Code {{version}}",
211+
"description": "Roo Code {{version}} introduce potenti nuove funzionalità e miglioramenti basati sui tuoi feedback.",
212212
"whatsNew": "Novità",
213213
"feature1": "<bold>Caching implicito per Gemini</bold>: Le chiamate API Gemini vengono ora memorizzate automaticamente nella cache, riducendo i costi API",
214214
"feature2": "<bold>Selezione della modalità più intelligente</bold>: Le definizioni delle modalità possono ora includere indicazioni su quando ogni modalità dovrebbe essere utilizzata, permettendo una migliore orchestrazione",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
"copyToInput": "入力欄にコピー(またはShift + クリック)"
208208
},
209209
"announcement": {
210-
"title": "🎉 Roo Code 3.17 リリース",
211-
"description": "Roo Code 3.17は、あなたのフィードバックに基づく強力な新機能と改善をもたらします。",
210+
"title": "🎉 Roo Code {{version}} リリース",
211+
"description": "Roo Code {{version}}は、あなたのフィードバックに基づく強力な新機能と改善をもたらします。",
212212
"whatsNew": "新機能",
213213
"feature1": "<bold>Geminiの暗黙的キャッシング</bold>: Gemini APIコールが自動的にキャッシュされるようになり、APIコストが削減されます",
214214
"feature2": "<bold>よりスマートなモード選択</bold>: モード定義に各モードをいつ使用すべきかの指針を含めることができるようになり、より優れた調整が可能になります",

0 commit comments

Comments
 (0)