I’m added i18next React for old project. So many text not can be translate. How can I search all of them in VSCode?
Some case:
<Button className="w-full" onClick={onClick}>
Save
<Button>
<Button
type="primary"
onClick={onCLick}
className="ml-2"
>
Save
</Button>
<Button>Save</Button>
Translated:
<Button>{t('Save')}</Button>
2
Answers
To search for specific text in multiple files within Visual Studio Code, you can use the built-in search functionality. Here’s how you can perform a search across multiple files:
Open Visual Studio Code and navigate to the root directory of your project.
Press Ctrl + Shift + F (or Cmd + Shift + F on macOS) to open the "Search" view. Alternatively, you can click on the magnifying glass icon in the sidebar and choose "Find in Files" from the drop-down menu.
In the search input field, enter the text you want to search for. You can use regular expressions for more advanced search patterns if needed.
Click on the gear icon (⚙️) on the right side of the search input field to expand the search options.
In the expanded search options, click on the "Files to include" text box and choose the files or file patterns you want to search within. You can use glob patterns to specify file types or patterns (e.g., *.php for PHP files).
Once you’ve configured the search options, click on the search icon (🔍) or press Enter to start the search.
Visual Studio Code will display the search results in the "Search" view. You can click on each search result to open the file and navigate to the specific occurrence of the text.
Additionally, you can use the navigation buttons in the "Search" view to jump to the next or previous search result, and you can use the replace functionality if you want to replace the searched text with something else.
By using these steps, you should be able to search for specific text across multiple files in Visual Studio Code and locate the occurrences you’re looking for.
Find:
Replace: