@@ -319,7 +322,7 @@ function SelectRoomButton({ roomList, selectedRooms, onChange }: SelectRoomButto
radii="Pill"
before={
}
>
-
Select Rooms
+
{t('Search.select_rooms')}
);
@@ -347,11 +350,12 @@ export function SearchFilters({
onGlobalChange,
onOrderChange,
}: SearchFiltersProps) {
+ const { t } = useTranslation();
const mx = useMatrixClient();
return (
- Filter
+ {t('Search.filter')}
onGlobalChange(true)}
>
- Global
+ {t('Search.global')}
)}
void;
};
export function SearchInput({ active, loading, searchInputRef, onSearch, onReset }: SearchProps) {
+ const { t } = useTranslation();
const handleSearchSubmit: FormEventHandler = (evt) => {
evt.preventDefault();
const { searchInput } = evt.target as HTMLFormElement & {
@@ -24,7 +26,7 @@ export function SearchInput({ active, loading, searchInputRef, onSearch, onReset
return (
- Search
+ {t('Search.search')}
}
onClick={onReset}
>
- Clear
+ {t('Search.clear')}
) : (
- Enter
+ {t('Search.enter')}
)
}
diff --git a/src/app/features/message-search/SearchResultGroup.tsx b/src/app/features/message-search/SearchResultGroup.tsx
index 14817cc4..39a153d9 100644
--- a/src/app/features/message-search/SearchResultGroup.tsx
+++ b/src/app/features/message-search/SearchResultGroup.tsx
@@ -3,6 +3,7 @@ import React, { MouseEventHandler, useMemo } from 'react';
import { IEventWithRoomId, JoinRule, RelationType, Room } from 'matrix-js-sdk';
import { HTMLReactParserOptions } from 'html-react-parser';
import { Avatar, Box, Chip, Header, Icon, Icons, Text, config } from 'folds';
+import { useTranslation } from 'react-i18next';
import { Opts as LinkifyOpts } from 'linkifyjs';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import {
@@ -74,6 +75,7 @@ export function SearchResultGroup({
hour24Clock,
dateFormatString,
}: SearchResultGroupProps) {
+ const { t } = useTranslation();
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
const highlightRegex = useMemo(() => makeHighlightRegex(highlights), [highlights]);
@@ -165,7 +167,7 @@ export function SearchResultGroup({
return (
- Room Tombstone. {content.body}
+ {t('Search.room_tombstone')} {content.body}
);
@@ -180,7 +182,7 @@ export function SearchResultGroup({
{event.type}
- {' event'}
+ {` ${t('Search.event')}`}
);
@@ -303,7 +305,7 @@ export function SearchResultGroup({
variant="Secondary"
radii="400"
>
- Open
+ {t('Search.open')}
diff --git a/src/app/features/search/Search.tsx b/src/app/features/search/Search.tsx
index cfc4ee5f..34a594cf 100644
--- a/src/app/features/search/Search.tsx
+++ b/src/app/features/search/Search.tsx
@@ -25,6 +25,7 @@ import React, {
useRef,
useState,
} from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import { isKeyHotkey } from 'is-hotkey';
import { useAtom, useAtomValue } from 'jotai';
import { Room } from 'matrix-js-sdk';
@@ -135,6 +136,7 @@ type SearchProps = {
requestClose: () => void;
};
export function Search({ requestClose }: SearchProps) {
+ const { t } = useTranslation();
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
const scrollRef = useRef(null);
@@ -269,7 +271,7 @@ export function Search({ requestClose }: SearchProps) {
variant="Background"
radii="400"
outlined
- placeholder="Search"
+ placeholder={t('Search.search')}
before={}
onChange={handleInputChange}
onKeyDown={handleInputKeyDown}
@@ -286,12 +288,12 @@ export function Search({ requestClose }: SearchProps) {
gap="100"
>
- {result ? 'No Match Found' : 'No Rooms'}
+ {result ? t('Search.no_match_found') : t('Search.no_rooms')}
{result
- ? `No match found for "${result.query}".`
- : `You do not have any Rooms to display yet.`}
+ ? t('Search.no_match_for_query', { query: result.query })
+ : t('Search.no_rooms_to_display')}
)}
@@ -409,8 +411,11 @@ export function Search({ requestClose }: SearchProps) {
- Type # for rooms, @ for DMs and * for spaces. Hotkey:{' '}
- {isMacOS() ? KeySymbol.Command : 'Ctrl'} + k
+ }}
+ />
diff --git a/src/app/pages/client/home/Search.tsx b/src/app/pages/client/home/Search.tsx
index d5ddfb77..f0898109 100644
--- a/src/app/pages/client/home/Search.tsx
+++ b/src/app/pages/client/home/Search.tsx
@@ -1,5 +1,6 @@
import React, { useRef } from 'react';
import { Box, Icon, Icons, Text, Scroll, IconButton } from 'folds';
+import { useTranslation } from 'react-i18next';
import { Page, PageContent, PageContentCenter, PageHeader } from '../../../components/page';
import { MessageSearch } from '../../../features/message-search';
import { useHomeRooms } from './useHomeRooms';
@@ -7,6 +8,7 @@ import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
export function HomeSearch() {
+ const { t } = useTranslation();
const scrollRef = useRef
(null);
const rooms = useHomeRooms();
const screenSize = useScreenSizeContext();
@@ -29,7 +31,7 @@ export function HomeSearch() {
{screenSize !== ScreenSize.Mobile && }
- Message Search
+ {t('Search.message_search')}
@@ -40,7 +42,7 @@ export function HomeSearch() {
setOpen(true);
return (
-
+
{(triggerRef) => (
diff --git a/src/app/pages/client/space/Search.tsx b/src/app/pages/client/space/Search.tsx
index 017262b5..f895acda 100644
--- a/src/app/pages/client/space/Search.tsx
+++ b/src/app/pages/client/space/Search.tsx
@@ -1,5 +1,6 @@
import React, { useRef } from 'react';
import { Box, Icon, Icons, Text, Scroll, IconButton } from 'folds';
+import { useTranslation } from 'react-i18next';
import { useAtomValue } from 'jotai';
import { Page, PageContent, PageContentCenter, PageHeader } from '../../../components/page';
import { MessageSearch } from '../../../features/message-search';
@@ -13,6 +14,7 @@ import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
export function SpaceSearch() {
+ const { t } = useTranslation();
const mx = useMatrixClient();
const scrollRef = useRef(null);
const space = useSpace();
@@ -44,7 +46,7 @@ export function SpaceSearch() {
{screenSize !== ScreenSize.Mobile && }
- Message Search
+ {t('Search.message_search')}