Translate some things on search (#1917)

This commit is contained in:
Eric Bailey 2023-11-15 19:00:43 -06:00 committed by GitHub
parent 22b76423a0
commit fe1a7183fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -65,7 +65,6 @@ function Loader() {
) )
} }
// TODO refactor how to translate?
function EmptyState({message, error}: {message: string; error?: string}) { function EmptyState({message, error}: {message: string; error?: string}) {
const pal = usePalette('default') const pal = usePalette('default')
const {isMobile} = useWebMediaQueries() const {isMobile} = useWebMediaQueries()
@ -196,6 +195,7 @@ type SearchResultSlice =
} }
function SearchScreenPostResults({query}: {query: string}) { function SearchScreenPostResults({query}: {query: string}) {
const {_} = useLingui()
const pal = usePalette('default') const pal = usePalette('default')
const [isPTR, setIsPTR] = React.useState(false) const [isPTR, setIsPTR] = React.useState(false)
const { const {
@ -246,7 +246,9 @@ function SearchScreenPostResults({query}: {query: string}) {
return error ? ( return error ? (
<EmptyState <EmptyState
message="We're sorry, but your search could not be completed. Please try again in a few minutes." message={_(
msg`We're sorry, but your search could not be completed. Please try again in a few minutes.`,
)}
error={error.toString()} error={error.toString()}
/> />
) : ( ) : (
@ -278,7 +280,7 @@ function SearchScreenPostResults({query}: {query: string}) {
contentContainerStyle={{paddingBottom: 100}} contentContainerStyle={{paddingBottom: 100}}
/> />
) : ( ) : (
<EmptyState message={`No results found for ${query}`} /> <EmptyState message={_(msg`No results found for ${query}`)} />
)} )}
</> </>
) : ( ) : (
@ -289,6 +291,7 @@ function SearchScreenPostResults({query}: {query: string}) {
} }
function SearchScreenUserResults({query}: {query: string}) { function SearchScreenUserResults({query}: {query: string}) {
const {_} = useLingui()
const [isFetched, setIsFetched] = React.useState(false) const [isFetched, setIsFetched] = React.useState(false)
const [dataUpdatedAt, setDataUpdatedAt] = React.useState(0) const [dataUpdatedAt, setDataUpdatedAt] = React.useState(0)
const [results, setResults] = React.useState< const [results, setResults] = React.useState<
@ -335,7 +338,7 @@ function SearchScreenUserResults({query}: {query: string}) {
contentContainerStyle={{paddingBottom: 100}} contentContainerStyle={{paddingBottom: 100}}
/> />
) : ( ) : (
<EmptyState message={`No results found for ${query}`} /> <EmptyState message={_(msg`No results found for ${query}`)} />
)} )}
</> </>
) : ( ) : (
@ -587,7 +590,7 @@ export function SearchScreenMobile(
/> />
)) ))
) : ( ) : (
<EmptyState message={`No results found for ${query}`} /> <EmptyState message={_(msg`No results found for ${query}`)} />
)} )}
<View style={{height: 200}} /> <View style={{height: 200}} />

View file

@ -157,7 +157,7 @@ export function DesktopSearch() {
/> />
<TextInput <TextInput
testID="searchTextInput" testID="searchTextInput"
placeholder="Search" placeholder={_(msg`Search`)}
placeholderTextColor={pal.colors.textLight} placeholderTextColor={pal.colors.textLight}
selectTextOnFocus selectTextOnFocus
returnKeyType="search" returnKeyType="search"