diff --git a/apps/remix-ide/src/app/tabs/locales/en/search.json b/apps/remix-ide/src/app/tabs/locales/en/search.json index 5bb29ab8d2..9eff38fb36 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/search.json +++ b/apps/remix-ide/src/app/tabs/locales/en/search.json @@ -10,5 +10,15 @@ "search.useRegularExpression": "Use Regular Expression", "search.replaceWithoutConfirmation": "replace without confirmation", "search.filesToInclude": "Files to include", - "search.filesToExclude": "Files to exclude" + "search.filesToExclude": "Files to exclude", + "search.toggleReplace": "Toggle Replace", + "search.replaceInFiles": "replace in files", + "search.stop": "stop", + "search.undoChanges": "Undo changes to {path}", + "search.confirmreplaceMsg": "Are you sure you want to replace \"{find}\" by \"{replace}\" in {filename}?", + "search.yes": "Yes", + "search.no": "No", + "search.loading": "Loading", + "search.text1": "showing {count} results in {fileCount} files", + "search.text2": "Too many resuls to display...{br}Please narrow down your search." } diff --git a/libs/remix-ui/search/src/lib/components/FindContainer.tsx b/libs/remix-ui/search/src/lib/components/FindContainer.tsx index 82311b08b6..7568fa7576 100644 --- a/libs/remix-ui/search/src/lib/components/FindContainer.tsx +++ b/libs/remix-ui/search/src/lib/components/FindContainer.tsx @@ -1,5 +1,6 @@ import {CustomTooltip} from '@remix-ui/helper' import React, {useContext, useEffect, useState} from 'react' +import {FormattedMessage} from 'react-intl' import {SearchContext} from '../context/context' import {Find} from './Find' import {OverWriteCheck} from './OverWriteCheck' @@ -14,7 +15,7 @@ export const FindContainer = (props) => { }, [expanded]) return (
- + } tooltipClasses="text-nowrap" tooltipId="toggleReplaceTooltip" placement="left-start">
{ @@ -15,7 +15,9 @@ export const Replace = (props) => { return ( <>
- +
diff --git a/libs/remix-ui/search/src/lib/components/StopSearch.tsx b/libs/remix-ui/search/src/lib/components/StopSearch.tsx index 391a33b45f..90d9e68859 100644 --- a/libs/remix-ui/search/src/lib/components/StopSearch.tsx +++ b/libs/remix-ui/search/src/lib/components/StopSearch.tsx @@ -1,5 +1,6 @@ import React from 'react' import {useContext} from 'react' +import {FormattedMessage} from 'react-intl' import {SearchContext} from '../context/context' export const StopSearch = () => { @@ -9,7 +10,7 @@ export const StopSearch = () => { } return ( await cancel()}> - stop + ) } diff --git a/libs/remix-ui/search/src/lib/components/Undo.tsx b/libs/remix-ui/search/src/lib/components/Undo.tsx index 7111667cb9..da7bd94604 100644 --- a/libs/remix-ui/search/src/lib/components/Undo.tsx +++ b/libs/remix-ui/search/src/lib/components/Undo.tsx @@ -1,6 +1,7 @@ import {useDialogDispatchers} from '@remix-ui/app' import React from 'react' import {useContext} from 'react' +import {FormattedMessage} from 'react-intl' import {SearchContext} from '../context/context' import * as path from 'path' @@ -30,7 +31,7 @@ export const Undo = () => { className="undo-button btn btn-secondary btn-block my-3" >
- Undo changes to {path.basename(state.undoBuffer[`${state.workspace}/${state.currentFile}`].path)} + ) : null} diff --git a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx index 191e51c2f9..5c3d88b54c 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultItem.tsx @@ -1,6 +1,6 @@ import {useDialogDispatchers} from '@remix-ui/app' import React, {useContext, useEffect, useRef, useState} from 'react' -import {FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import {SearchContext} from '../../context/context' import {SearchResult, SearchResultLine} from '../../types' import {ResultFileName} from './ResultFileName' @@ -12,6 +12,7 @@ interface ResultItemProps { } export const ResultItem = (props: ResultItemProps) => { + const intl = useIntl() const {state, findText, disableForceReload, updateCount, replaceAllInFile} = useContext(SearchContext) const [loading, setLoading] = useState(false) const [lines, setLines] = useState([]) @@ -72,11 +73,18 @@ export const ResultItem = (props: ResultItemProps) => { } else { modal({ id: 'confirmreplace', - title: 'Replace', - message: `Are you sure you want to replace '${state.find}' by '${state.replace}' in ${props.file.filename}?`, - okLabel: 'Yes', + title: intl.formatMessage({id: 'search.replace'}), + message: intl.formatMessage( + {id: 'search.confirmreplaceMsg'}, + { + find: state.find, + replace: state.replace, + filename: props.file.filename + } + ), + okLabel: intl.formatMessage({id: 'search.yes'}), okFn: confirmReplace, - cancelLabel: 'No', + cancelLabel: intl.formatMessage({id: 'search.no'}), cancelFn: () => {}, data: null }) @@ -122,7 +130,12 @@ export const ResultItem = (props: ResultItemProps) => {
{props.file.count}
- {loading ?
Loading...
: null} + {loading ? ( +
+ + ... +
+ ) : null} {!toggleExpander && !loading ? (
{state.replaceEnabled ? ( diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index bb10a8b4c8..7578ffd62e 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -1,6 +1,7 @@ import {useDialogDispatchers} from '@remix-ui/app' import {CustomTooltip} from '@remix-ui/helper' import React, {useContext} from 'react' +import {FormattedMessage, useIntl} from 'react-intl' import {SearchContext} from '../../context/context' import {SearchResult, SearchResultLine, SearchResultLineLine} from '../../types' @@ -11,6 +12,7 @@ interface ResultSummaryProps { } export const ResultSummary = (props: ResultSummaryProps) => { + const intl = useIntl() const {hightLightInPath, replaceText, state} = useContext(SearchContext) const {modal} = useDialogDispatchers() const selectLine = async (line: SearchResultLineLine) => { @@ -32,11 +34,18 @@ export const ResultSummary = (props: ResultSummaryProps) => { } else { modal({ id: 'confirmreplace', - title: 'Replace', - message: `Are you sure you want to replace '${line.center}' by '${state.replace}' in ${props.searchResult.filename}?`, - okLabel: 'Yes', + title: intl.formatMessage({id: 'search.replace'}), + message: intl.formatMessage( + {id: 'search.confirmreplaceMsg'}, + { + find: line.center, + replace: state.replace, + filename: props.searchResult.filename + } + ), + okLabel: intl.formatMessage({id: 'search.yes'}), okFn: confirmReplace, - cancelLabel: 'No', + cancelLabel: intl.formatMessage({id: 'search.no'}), cancelFn: () => {}, data: line }) @@ -62,7 +71,7 @@ export const ResultSummary = (props: ResultSummaryProps) => {
{state.replaceEnabled ? (
- + } tooltipClasses="text-nowrap" tooltipId="replaceTooltip" placement="top-start">
{ diff --git a/libs/remix-ui/search/src/lib/components/results/Results.tsx b/libs/remix-ui/search/src/lib/components/results/Results.tsx index 82d702f845..f94d94d868 100644 --- a/libs/remix-ui/search/src/lib/components/results/Results.tsx +++ b/libs/remix-ui/search/src/lib/components/results/Results.tsx @@ -1,4 +1,5 @@ import React, {useContext, useEffect} from 'react' +import {FormattedMessage} from 'react-intl' import {SearchContext} from '../../context/context' import {StopSearch} from '../StopSearch' import {ResultItem} from './ResultItem' @@ -14,12 +15,12 @@ export const Results = () => { {state.find && !state.clipped ? (
- showing {state.count} results {state.fileCount} in files +
) : null} {state.find && state.clipped ? (
- Too many resuls to display...

Please narrow down your search. + }} />
) : null} {state.searchResults &&