Mark some strings as translatable

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-12-30 22:49:29 +01:00
parent 925087024c
commit e167ec8b6e
2 changed files with 16 additions and 4 deletions

View file

@ -1,15 +1,21 @@
import React from 'react'; import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { CardTitle, HStack, IconButton, Stack } from 'soapbox/components/ui'; import { CardTitle, HStack, IconButton, Stack } from 'soapbox/components/ui';
import ChatSearch from '../../chat-search/chat-search'; import ChatSearch from '../../chat-search/chat-search';
const messages = defineMessages({
title: { id: 'chat.new_message.title', defaultMessage: 'New Message' },
});
interface IChatPageNew { interface IChatPageNew {
} }
/** New message form to create a chat. */ /** New message form to create a chat. */
const ChatPageNew: React.FC<IChatPageNew> = () => { const ChatPageNew: React.FC<IChatPageNew> = () => {
const intl = useIntl();
const history = useHistory(); const history = useHistory();
return ( return (
@ -22,7 +28,7 @@ const ChatPageNew: React.FC<IChatPageNew> = () => {
onClick={() => history.push('/chats')} onClick={() => history.push('/chats')}
/> />
<CardTitle title='New Message' /> <CardTitle title={intl.formatMessage(messages.title)} />
</HStack> </HStack>
</Stack> </Stack>

View file

@ -1,6 +1,7 @@
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { Icon, Input, Stack } from 'soapbox/components/ui'; import { Icon, Input, Stack } from 'soapbox/components/ui';
@ -17,11 +18,16 @@ import Blankslate from './blankslate';
import EmptyResultsBlankslate from './empty-results-blankslate'; import EmptyResultsBlankslate from './empty-results-blankslate';
import Results from './results'; import Results from './results';
const messages = defineMessages({
placeholder: { id: 'chat_search.placeholder', defaultMessage: 'Type a name' },
});
interface IChatSearch { interface IChatSearch {
isMainPage?: boolean isMainPage?: boolean
} }
const ChatSearch = (props: IChatSearch) => { const ChatSearch = (props: IChatSearch) => {
const intl = useIntl();
const { isMainPage = false } = props; const { isMainPage = false } = props;
const debounce = useDebounce; const debounce = useDebounce;
@ -88,7 +94,7 @@ const ChatSearch = (props: IChatSearch) => {
data-testid='search' data-testid='search'
type='text' type='text'
autoFocus autoFocus
placeholder='Type a name' placeholder={intl.formatMessage(messages.placeholder)}
value={value || ''} value={value || ''}
onChange={(event) => setValue(event.target.value)} onChange={(event) => setValue(event.target.value)}
outerClassName='mt-0' outerClassName='mt-0'