@@ -22,6 +22,7 @@ import {
2222 LAST_FIND_RELEVANT_FILES_SHRINK_STATE_KEY
2323} from '../constants/state-keys'
2424import { shrink_file } from '../context/utils/shrink-file/shrink-file'
25+ import { t } from '@/i18n'
2526
2627export const find_relevant_files_command = (
2728 workspace_provider : WorkspaceProvider ,
@@ -44,7 +45,9 @@ export const find_relevant_files_command = (
4445 }
4546
4647 if ( ! folder_path ) {
47- vscode . window . showErrorMessage ( 'No folder selected.' )
48+ vscode . window . showErrorMessage (
49+ t ( 'command.find-relevant-files.error.no-folder-selected' )
50+ )
4851 return
4952 }
5053
@@ -55,9 +58,9 @@ export const find_relevant_files_command = (
5558
5659 while ( true ) {
5760 const instructions = await vscode . window . showInputBox ( {
58- title : 'Find Relevant Files' ,
59- prompt : 'Enter instructions to find relevant files' ,
60- placeHolder : 'e.g., changing password' ,
61+ title : t ( 'command.find-relevant-files.input.title' ) ,
62+ prompt : t ( 'command. find- relevant- files.input.prompt' ) ,
63+ placeHolder : t ( 'command.find-relevant-files.input.placeholder' ) ,
6164 value : initial_instructions
6265 } )
6366
@@ -95,7 +98,7 @@ export const find_relevant_files_command = (
9598 await vscode . window . withProgress (
9699 {
97100 location : vscode . ProgressLocation . Window ,
98- title : 'Analyzing directory...'
101+ title : t ( 'command.find-relevant-files.progress.analyzing' )
99102 } ,
100103 async ( ) => {
101104 for ( const file_path of all_files ) {
@@ -137,19 +140,21 @@ export const find_relevant_files_command = (
137140
138141 const shrink_items : vscode . QuickPickItem [ ] = [
139142 {
140- label : 'Send files in full',
143+ label : t ( 'command.find-relevant- files.shrink. full') ,
141144 description : `${ display_token_count ( full_tokens ) } tokens`
142145 } ,
143146 {
144- label : 'Strip function bodies and comments' ,
147+ label : t ( 'command.find-relevant-files.shrink.strip' ) ,
145148 description : `${ display_token_count ( shrink_tokens ) } tokens`
146149 }
147150 ]
148151
149152 const shrink_quick_pick = vscode . window . createQuickPick ( )
150153 shrink_quick_pick . items = shrink_items
151- shrink_quick_pick . title = 'Find Relevant Files'
152- shrink_quick_pick . placeholder = 'Decide whether files should be shrunk'
154+ shrink_quick_pick . title = t ( 'command.find-relevant-files.input.title' )
155+ shrink_quick_pick . placeholder = t (
156+ 'command.find-relevant-files.shrink.placeholder'
157+ )
153158 shrink_quick_pick . activeItems = [
154159 should_shrink ? shrink_items [ 1 ] : shrink_items [ 0 ]
155160 ]
@@ -166,7 +171,7 @@ export const find_relevant_files_command = (
166171 shrink_quick_pick . onDidAccept ( ( ) => {
167172 resolve (
168173 shrink_quick_pick . selectedItems [ 0 ] . label ==
169- 'Strip function bodies and comments'
174+ t ( 'command.find-relevant-files.shrink.strip' )
170175 )
171176 shrink_quick_pick . hide ( )
172177 } )
@@ -200,7 +205,7 @@ export const find_relevant_files_command = (
200205 if ( configs . length === 0 ) {
201206 vscode . commands . executeCommand ( 'codeWebChat.settings' )
202207 vscode . window . showInformationMessage (
203- 'No configurations found for Find Relevant Files.'
208+ t ( 'command.find-relevant-files.error.no-configs' )
204209 )
205210 return
206211 }
@@ -225,7 +230,9 @@ export const find_relevant_files_command = (
225230 selected_config . provider_name
226231 )
227232 if ( ! provider ) {
228- vscode . window . showErrorMessage ( 'API Provider not found.' )
233+ vscode . window . showErrorMessage (
234+ t ( 'command.find-relevant-files.error.provider-not-found' )
235+ )
229236 return
230237 }
231238
@@ -280,26 +287,30 @@ export const find_relevant_files_command = (
280287 const completion_result = await vscode . window . withProgress (
281288 {
282289 location : vscode . ProgressLocation . Notification ,
283- title : 'Finding relevant files...' ,
290+ title : t ( 'command.find- relevant- files.progress.finding' ) ,
284291 cancellable : true
285292 } ,
286293 async ( progress , token ) => {
287294 token . onCancellationRequested ( ( ) => {
288- cancel_token_source . cancel ( 'User canceled' )
295+ cancel_token_source . cancel (
296+ t ( 'command.find-relevant-files.cancel.user' )
297+ )
289298 } )
290299
291- progress . report ( { message : 'Waiting for server...' } )
300+ progress . report ( {
301+ message : t ( 'common.progress.waiting-for-server' )
302+ } )
292303
293304 return await make_api_request ( {
294305 endpoint_url : provider . base_url ,
295306 api_key : provider . api_key ,
296307 body,
297308 cancellation_token : cancel_token_source . token ,
298309 on_chunk : ( ) => {
299- progress . report ( { message : 'Receiving...' } )
310+ progress . report ( { message : t ( 'common.progress.receiving' ) } )
300311 } ,
301312 on_thinking_chunk : ( ) => {
302- progress . report ( { message : 'Thinking...' } )
313+ progress . report ( { message : t ( 'common.progress.thinking' ) } )
303314 }
304315 } )
305316 }
@@ -320,7 +331,9 @@ export const find_relevant_files_command = (
320331 }
321332
322333 if ( extracted_files . length === 0 ) {
323- vscode . window . showInformationMessage ( 'No relevant files found.' )
334+ vscode . window . showInformationMessage (
335+ t ( 'command.find-relevant-files.error.no-files-found' )
336+ )
324337 return
325338 }
326339
@@ -336,7 +349,7 @@ export const find_relevant_files_command = (
336349
337350 const open_file_button = {
338351 iconPath : new vscode . ThemeIcon ( 'go-to-file' ) ,
339- tooltip : 'Go to file'
352+ tooltip : t ( 'common.go-to- file')
340353 }
341354
342355 const quick_pick_items = await Promise . all (
@@ -370,13 +383,15 @@ export const find_relevant_files_command = (
370383 currently_checked . includes ( item . file_path )
371384 )
372385 quick_pick . canSelectMany = true
373- quick_pick . title = 'Search Results'
374- quick_pick . placeholder = 'Select files to add to context'
386+ quick_pick . title = t ( 'command.find-relevant-files.quick-pick.title' )
387+ quick_pick . placeholder = t (
388+ 'command.find-relevant-files.quick-pick.placeholder'
389+ )
375390 quick_pick . ignoreFocusOut = true
376391
377392 const close_button = {
378393 iconPath : new vscode . ThemeIcon ( 'close' ) ,
379- tooltip : 'Close'
394+ tooltip : t ( 'common.close' )
380395 }
381396 quick_pick . buttons = [ vscode . QuickInputButtons . Back , close_button ]
382397
@@ -411,7 +426,9 @@ export const find_relevant_files_command = (
411426 } )
412427 } catch ( error ) {
413428 vscode . window . showErrorMessage (
414- `Error opening file: ${ String ( error ) } `
429+ t ( 'command.find-relevant-files.error.opening-file' , {
430+ error : String ( error )
431+ } )
415432 )
416433 }
417434 }
@@ -449,7 +466,9 @@ export const find_relevant_files_command = (
449466 ) . length
450467
451468 vscode . window . showInformationMessage (
452- `Added ${ newly_selected_count } file(s) to context.`
469+ t ( 'command.find-relevant-files.success.added' , {
470+ count : newly_selected_count
471+ } )
453472 )
454473 break
455474 }
@@ -462,7 +481,7 @@ export const find_relevant_files_command = (
462481 data : error
463482 } )
464483 vscode . window . showErrorMessage (
465- 'Error finding relevant files. Check console.'
484+ t ( 'command.find- relevant- files.error.finding' )
466485 )
467486 }
468487 break
0 commit comments