Skip to content

Commit dd40fd1

Browse files
committed
update i18n and minor fixes
1 parent b4aac40 commit dd40fd1

File tree

6 files changed

+50
-36
lines changed

6 files changed

+50
-36
lines changed

packages/core/package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@
312312
"AWS.amazonq.featureDev.pillText.generatingCode": "Generating code...",
313313
"AWS.amazonq.featureDev.pillText.requestingChanges": "Requesting changes ...",
314314
"AWS.amazonq.featureDev.pillText.insertCode": "Accept code",
315+
"AWS.amazonq.featureDev.pillText.acceptAllChanges": "Accept all changes",
316+
"AWS.amazonq.featureDev.pillText.acceptRemainingChanges": "Accept remaining changes",
315317
"AWS.amazonq.featureDev.pillText.stoppingCodeGeneration": "Stopping code generation...",
316318
"AWS.amazonq.featureDev.pillText.sendFeedback": "Send feedback",
317319
"AWS.amazonq.featureDev.pillText.selectFiles": "Select files for context",

packages/core/src/amazonq/webview/ui/diffTree/actions.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@
66
import { MynahIcons } from '@aws/mynah-ui'
77
import { FileNodeAction, TreeNodeDetails } from '@aws/mynah-ui/dist/static'
88
import { DiffTreeFileInfo } from './types'
9+
import { uiComponentsTexts } from '../texts/constants'
910

1011
export function getDetails(filePaths: DiffTreeFileInfo[]): Record<string, TreeNodeDetails> {
1112
const details: Record<string, TreeNodeDetails> = {}
1213
for (const filePath of filePaths) {
1314
if (filePath.changeApplied) {
1415
details[filePath.relativePath] = {
1516
status: 'success',
16-
label: 'Change accepted',
17+
label: uiComponentsTexts.changeAccepted,
1718
icon: MynahIcons.OK,
1819
}
1920
} else if (filePath.rejected) {
2021
details[filePath.relativePath] = {
2122
status: 'error',
22-
label: 'Change rejected',
23+
label: uiComponentsTexts.changeRejected,
2324
icon: MynahIcons.CANCEL_CIRCLE,
2425
}
2526
}
@@ -39,7 +40,7 @@ export function getActions(filePaths: DiffTreeFileInfo[]): Record<string, FileNo
3940
{
4041
icon: MynahIcons.REVERT,
4142
name: 'revert-rejection',
42-
description: 'Revert rejection',
43+
description: uiComponentsTexts.revertRejection,
4344
},
4445
]
4546
break
@@ -49,13 +50,13 @@ export function getActions(filePaths: DiffTreeFileInfo[]): Record<string, FileNo
4950
icon: MynahIcons.OK,
5051
status: 'success',
5152
name: 'accept-change',
52-
description: 'Accept change',
53+
description: uiComponentsTexts.acceptChange,
5354
},
5455
{
5556
icon: MynahIcons.CANCEL_CIRCLE,
5657
status: 'error',
5758
name: 'reject-change',
58-
description: 'Reject change',
59+
description: uiComponentsTexts.rejectChange,
5960
},
6061
]
6162
break

packages/core/src/amazonq/webview/ui/texts/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ export const uiComponentsTexts = {
2424
noMoreTabsTooltip: 'You can only open ten conversation tabs at a time.',
2525
codeSuggestionWithReferenceTitle: 'Some suggestions contain code with references.',
2626
spinnerText: 'Generating your answer...',
27+
changeAccepted: 'Change accepted',
28+
changeRejected: 'Change rejected',
29+
acceptChange: 'Accept change',
30+
rejectChange: 'Reject change',
31+
revertRejection: 'Revert rejection',
2732
}
2833

2934
export const userGuideURL = 'https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/software-dev.html'

packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export class FeatureDevController {
476476
tabID: tabID,
477477
messageId,
478478
})
479-
await session.updateChatAnswer(tabID, 'Accept all changes')
479+
await session.updateChatAnswer(tabID, i18n('AWS.amazonq.featureDev.pillText.acceptAllChanges'))
480480
}
481481
this.messenger.sendUpdatePlaceholder(tabID, i18n('AWS.amazonq.featureDev.pillText.selectOption'))
482482
} finally {
@@ -762,12 +762,12 @@ export class FeatureDevController {
762762
}
763763
}
764764

765-
await session.updateFilesPaths(
766-
tabId,
767-
session.state.filePaths ?? [],
768-
session.state.deletedFiles ?? [],
769-
messageId
770-
)
765+
await session.updateFilesPaths({
766+
tabID: tabId,
767+
filePaths: session.state.filePaths ?? [],
768+
deletedFiles: session.state.deletedFiles ?? [],
769+
messageId,
770+
})
771771

772772
if (session.acceptCodeMessageId) {
773773
const allFilePathsAccepted = session.state.filePaths?.every(

packages/core/src/amazonqFeatureDev/session/session.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
type NewFileInfo,
1414
type SessionState,
1515
type SessionStateConfig,
16+
UpdateFilesPathsParams,
1617
} from '../types'
1718
import { ConversationIdNotFoundError } from '../errors'
1819
import { referenceLogText } from '../constants'
@@ -153,18 +154,13 @@ export class Session {
153154
return resp.interaction
154155
}
155156

156-
public async updateFilesPaths(
157-
tabID: string,
158-
filePaths: NewFileInfo[],
159-
deletedFiles: DeletedFileInfo[],
160-
messageId: string,
161-
disableFileActions: boolean = false
162-
) {
157+
public async updateFilesPaths(params: UpdateFilesPathsParams) {
158+
const { tabID, filePaths, deletedFiles, messageId, disableFileActions = false } = params
163159
this.messenger.updateFileComponent(tabID, filePaths, deletedFiles, messageId, disableFileActions)
164160
if ([...filePaths, ...deletedFiles].some((file) => file.rejected || file.changeApplied)) {
165-
await this.updateChatAnswer(tabID, 'Accept remaining changes')
161+
await this.updateChatAnswer(tabID, i18n('AWS.amazonq.featureDev.pillText.acceptRemainingChanges'))
166162
} else {
167-
await this.updateChatAnswer(tabID, 'Accept all changes')
163+
await this.updateChatAnswer(tabID, i18n('AWS.amazonq.featureDev.pillText.acceptAllChanges'))
168164
}
169165
}
170166

@@ -196,21 +192,23 @@ export class Session {
196192
}
197193

198194
public async insertChanges() {
199-
const newFilePaths = this.state.filePaths?.filter((i) => !i.rejected && !i.changeApplied) ?? []
195+
const newFilePaths =
196+
this.state.filePaths?.filter((filePath) => !filePath.rejected && !filePath.changeApplied) ?? []
200197
await this.insertNewFiles(newFilePaths)
201198

202-
const deletedFiles = this.state.deletedFiles?.filter((i) => !i.rejected && !i.changeApplied) ?? []
199+
const deletedFiles =
200+
this.state.deletedFiles?.filter((deletedFile) => !deletedFile.rejected && !deletedFile.changeApplied) ?? []
203201
await this.applyDeleteFiles(deletedFiles)
204202

205203
await this.insertCodeReferenceLogs(this.state.references ?? [])
206204

207205
if (this._codeResultMessageId) {
208-
await this.updateFilesPaths(
209-
this.state.tabID,
210-
this.state.filePaths ?? [],
211-
this.state.deletedFiles ?? [],
212-
this._codeResultMessageId
213-
)
206+
await this.updateFilesPaths({
207+
tabID: this.state.tabID,
208+
filePaths: this.state.filePaths ?? [],
209+
deletedFiles: this.state.deletedFiles ?? [],
210+
messageId: this._codeResultMessageId,
211+
})
214212
}
215213
}
216214

@@ -247,13 +245,13 @@ export class Session {
247245
return
248246
}
249247

250-
await this.updateFilesPaths(
251-
this.state.tabID,
252-
this.state.filePaths ?? [],
253-
this.state.deletedFiles ?? [],
254-
this._codeResultMessageId,
255-
true
256-
)
248+
await this.updateFilesPaths({
249+
tabID: this.state.tabID,
250+
filePaths: this.state.filePaths ?? [],
251+
deletedFiles: this.state.deletedFiles ?? [],
252+
messageId: this._codeResultMessageId,
253+
disableFileActions: true,
254+
})
257255
this._codeResultMessageId = undefined
258256
}
259257

packages/core/src/amazonqFeatureDev/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,11 @@ export interface SessionStorage {
114114
}
115115

116116
export type LLMResponseType = 'EMPTY' | 'INVALID_STATE' | 'VALID'
117+
118+
export interface UpdateFilesPathsParams {
119+
tabID: string
120+
filePaths: NewFileInfo[]
121+
deletedFiles: DeletedFileInfo[]
122+
messageId: string
123+
disableFileActions?: boolean
124+
}

0 commit comments

Comments
 (0)