feat: better translation

This commit is contained in:
Maël Gangloff 2024-08-20 19:15:04 +02:00
parent e8d771aed3
commit 8d8ae45aad
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
4 changed files with 53 additions and 45 deletions

View File

@ -170,7 +170,7 @@ export function ConnectorForm({form, onCreate}: { form: FormInstance, onCreate:
</> </>
} }
<Form.Item style={{marginTop: 10}}> <Form.Item style={{marginTop: '5vh'}}>
<Space> <Space>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
{t`Create`} {t`Create`}

View File

@ -1,4 +1,4 @@
import {Card, Divider, Space, Table, Tag, Typography} from "antd"; import {Card, Divider, Space, Table, Tag, Tooltip, Typography} from "antd";
import {DisconnectOutlined, LinkOutlined} from "@ant-design/icons"; import {DisconnectOutlined, LinkOutlined} from "@ant-design/icons";
import {t} from "ttag"; import {t} from "ttag";
import {ViewDiagramWatchlistButton} from "./diagram/ViewDiagramWatchlistButton"; import {ViewDiagramWatchlistButton} from "./diagram/ViewDiagramWatchlistButton";
@ -11,7 +11,7 @@ import {Watchlist} from "../../../pages/tracking/WatchlistPage";
import {Connector} from "../../../utils/api/connectors"; import {Connector} from "../../../utils/api/connectors";
import useBreakpoint from "../../../hooks/useBreakpoint"; import useBreakpoint from "../../../hooks/useBreakpoint";
import {CalendarWatchlistButton} from "./CalendarWatchlistButton"; import {CalendarWatchlistButton} from "./CalendarWatchlistButton";
import {rdapEventNameTranslation} from "../../search/rdapTranslation"; import {rdapEventDetailTranslation, rdapEventNameTranslation} from "../../search/rdapTranslation";
export function WatchlistCard({watchlist, onUpdateWatchlist, connectors, onDelete}: { export function WatchlistCard({watchlist, onUpdateWatchlist, connectors, onDelete}: {
watchlist: Watchlist, watchlist: Watchlist,
@ -21,6 +21,7 @@ export function WatchlistCard({watchlist, onUpdateWatchlist, connectors, onDelet
}) { }) {
const sm = useBreakpoint('sm') const sm = useBreakpoint('sm')
const rdapEventNameTranslated = rdapEventNameTranslation() const rdapEventNameTranslated = rdapEventNameTranslation()
const rdapEventDetailTranslated = rdapEventDetailTranslation()
const columns = [ const columns = [
{ {
@ -75,9 +76,12 @@ export function WatchlistCard({watchlist, onUpdateWatchlist, connectors, onDelet
dataSource={[{ dataSource={[{
domains: watchlist.domains.map(d => <Tag>{punycode.toUnicode(d.ldhName)}</Tag>), domains: watchlist.domains.map(d => <Tag>{punycode.toUnicode(d.ldhName)}</Tag>),
events: watchlist.triggers?.filter(t => t.action === 'email') events: watchlist.triggers?.filter(t => t.action === 'email')
.map(t => <Tag color={actionToColor(t.event)}> .map(t => <Tooltip
{rdapEventNameTranslated[t.event as keyof typeof rdapEventNameTranslated]} title={t.event in rdapEventDetailTranslated ? rdapEventDetailTranslated[t.event as keyof typeof rdapEventDetailTranslated] : undefined}>
</Tag> <Tag color={actionToColor(t.event)}>
{rdapEventNameTranslated[t.event as keyof typeof rdapEventNameTranslated]}
</Tag>
</Tooltip>
) )
}]} }]}
{...(sm ? {scroll: {y: 'max-content'}} : {scroll: {y: 240}})} {...(sm ? {scroll: {y: 'max-content'}} : {scroll: {y: 240}})}

View File

@ -1,10 +1,10 @@
import {Button, Form, FormInstance, Input, Select, SelectProps, Space, Tag, Typography} from "antd"; import {Button, Form, FormInstance, Input, Select, SelectProps, Space, Tag, Tooltip, Typography} from "antd";
import {t} from "ttag"; import {t} from "ttag";
import {ApiOutlined, MinusCircleOutlined, PlusOutlined} from "@ant-design/icons"; import {ApiOutlined, MinusCircleOutlined, PlusOutlined} from "@ant-design/icons";
import React from "react"; import React from "react";
import {Connector} from "../../../utils/api/connectors"; import {Connector} from "../../../utils/api/connectors";
import {actionToColor} from "../../search/EventTimeline"; import {actionToColor} from "../../search/EventTimeline";
import {rdapEventNameTranslation} from "../../search/rdapTranslation"; import {rdapEventDetailTranslation, rdapEventNameTranslation} from "../../search/rdapTranslation";
type TagRender = SelectProps['tagRender']; type TagRender = SelectProps['tagRender'];
@ -33,6 +33,7 @@ export function WatchlistForm({form, connectors, onFinish, isCreation}: {
isCreation: boolean isCreation: boolean
}) { }) {
const rdapEventNameTranslated = rdapEventNameTranslation() const rdapEventNameTranslated = rdapEventNameTranslation()
const rdapEventDetailTranslated = rdapEventDetailTranslation()
const triggerTagRenderer: TagRender = (props) => { const triggerTagRenderer: TagRender = (props) => {
const {value, closable, onClose} = props; const {value, closable, onClose} = props;
@ -40,16 +41,18 @@ export function WatchlistForm({form, connectors, onFinish, isCreation}: {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
} }
return ( return (<Tooltip
<Tag title={value in rdapEventDetailTranslated ? rdapEventDetailTranslated[value as keyof typeof rdapEventDetailTranslated] : undefined}>
color={actionToColor(value)} <Tag
onMouseDown={onPreventMouseDown} color={actionToColor(value)}
closable={closable} onMouseDown={onPreventMouseDown}
onClose={onClose} closable={closable}
style={{marginInlineEnd: 4}} onClose={onClose}
> style={{marginInlineEnd: 4}}
{rdapEventNameTranslated[value as keyof typeof rdapEventNameTranslated]} >
</Tag> {rdapEventNameTranslated[value as keyof typeof rdapEventNameTranslated]}
</Tag>
</Tooltip>
) )
} }
@ -159,6 +162,7 @@ export function WatchlistForm({form, connectors, onFinish, isCreation}: {
style={{width: '100%'}} style={{width: '100%'}}
options={Object.keys(rdapEventNameTranslated).map(e => ({ options={Object.keys(rdapEventNameTranslated).map(e => ({
value: e, value: e,
title: e in rdapEventDetailTranslated ? rdapEventDetailTranslated[e as keyof typeof rdapEventDetailTranslated] : undefined,
label: rdapEventNameTranslated[e as keyof typeof rdapEventNameTranslated] label: rdapEventNameTranslated[e as keyof typeof rdapEventNameTranslated]
}))} }))}
/> />
@ -240,7 +244,7 @@ export function WatchlistForm({form, connectors, onFinish, isCreation}: {
</> </>
)} )}
</Form.List> </Form.List>
<Form.Item style={{marginTop: '10px'}}> <Form.Item style={{marginTop: '5vh'}}>
<Space> <Space>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
{isCreation ? t`Create` : t`Update`} {isCreation ? t`Create` : t`Update`}

View File

@ -22,8 +22,8 @@ msgstr ""
#: assets/components/tracking/connector/ConnectorForm.tsx:142 #: assets/components/tracking/connector/ConnectorForm.tsx:142
#: assets/components/tracking/connector/ConnectorForm.tsx:156 #: assets/components/tracking/connector/ConnectorForm.tsx:156
#: assets/components/tracking/connector/ConnectorForm.tsx:165 #: assets/components/tracking/connector/ConnectorForm.tsx:165
#: assets/components/tracking/watchlist/WatchlistForm.tsx:110 #: assets/components/tracking/watchlist/WatchlistForm.tsx:113
#: assets/components/tracking/watchlist/WatchlistForm.tsx:206 #: assets/components/tracking/watchlist/WatchlistForm.tsx:210
msgid "Required" msgid "Required"
msgstr "" msgstr ""
@ -469,7 +469,7 @@ msgid "Entities"
msgstr "" msgstr ""
#: assets/components/search/DomainSearchBar.tsx:26 #: assets/components/search/DomainSearchBar.tsx:26
#: assets/components/tracking/watchlist/WatchlistForm.tsx:113 #: assets/components/tracking/watchlist/WatchlistForm.tsx:116
msgid "This domain name does not appear to be valid" msgid "This domain name does not appear to be valid"
msgstr "" msgstr ""
@ -544,12 +544,12 @@ msgid ""
msgstr "" msgstr ""
#: assets/components/tracking/connector/ConnectorForm.tsx:176 #: assets/components/tracking/connector/ConnectorForm.tsx:176
#: assets/components/tracking/watchlist/WatchlistForm.tsx:246 #: assets/components/tracking/watchlist/WatchlistForm.tsx:250
msgid "Create" msgid "Create"
msgstr "" msgstr ""
#: assets/components/tracking/connector/ConnectorForm.tsx:179 #: assets/components/tracking/connector/ConnectorForm.tsx:179
#: assets/components/tracking/watchlist/WatchlistForm.tsx:249 #: assets/components/tracking/watchlist/WatchlistForm.tsx:253
msgid "Reset" msgid "Reset"
msgstr "" msgstr ""
@ -582,72 +582,72 @@ msgstr ""
msgid "No" msgid "No"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:67 #: assets/components/tracking/watchlist/WatchlistForm.tsx:70
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:78 #: assets/components/tracking/watchlist/WatchlistForm.tsx:81
msgid "Watchlist Name" msgid "Watchlist Name"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:79 #: assets/components/tracking/watchlist/WatchlistForm.tsx:82
msgid "Naming the Watchlist makes it easier to find in the list below." msgid "Naming the Watchlist makes it easier to find in the list below."
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:90 #: assets/components/tracking/watchlist/WatchlistForm.tsx:93
msgid "At least one domain name" msgid "At least one domain name"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistCard.tsx:27 #: assets/components/tracking/watchlist/WatchlistCard.tsx:28
#: assets/components/tracking/watchlist/WatchlistForm.tsx:101 #: assets/components/tracking/watchlist/WatchlistForm.tsx:104
msgid "Domain names" msgid "Domain names"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:119 #: assets/components/tracking/watchlist/WatchlistForm.tsx:122
msgid "Domain name" msgid "Domain name"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:136 #: assets/components/tracking/watchlist/WatchlistForm.tsx:139
msgid "Add a Domain name" msgid "Add a Domain name"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistCard.tsx:31 #: assets/components/tracking/watchlist/WatchlistCard.tsx:32
#: assets/components/tracking/watchlist/WatchlistForm.tsx:143 #: assets/components/tracking/watchlist/WatchlistForm.tsx:146
msgid "Tracked events" msgid "Tracked events"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:145 #: assets/components/tracking/watchlist/WatchlistForm.tsx:148
msgid "At least one trigger" msgid "At least one trigger"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:167 #: assets/components/tracking/watchlist/WatchlistForm.tsx:171
#: assets/components/tracking/watchlist/WatchlistForm.tsx:181 #: assets/components/tracking/watchlist/WatchlistForm.tsx:185
msgid "Connector" msgid "Connector"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:177 #: assets/components/tracking/watchlist/WatchlistForm.tsx:181
msgid "" msgid ""
"Please make sure the connector information is valid to purchase a domain " "Please make sure the connector information is valid to purchase a domain "
"that may be available soon." "that may be available soon."
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:197 #: assets/components/tracking/watchlist/WatchlistForm.tsx:201
msgid "DSN" msgid "DSN"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:209 #: assets/components/tracking/watchlist/WatchlistForm.tsx:213
msgid "This DSN does not appear to be valid" msgid "This DSN does not appear to be valid"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:227 #: assets/components/tracking/watchlist/WatchlistForm.tsx:231
msgid "Check out this link to the Symfony documentation to help you build the DSN" msgid "Check out this link to the Symfony documentation to help you build the DSN"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:236 #: assets/components/tracking/watchlist/WatchlistForm.tsx:240
msgid "Add a Webhook" msgid "Add a Webhook"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistForm.tsx:246 #: assets/components/tracking/watchlist/WatchlistForm.tsx:250
msgid "Update" msgid "Update"
msgstr "" msgstr ""
@ -697,11 +697,11 @@ msgstr ""
msgid "Are you sure to delete this Watchlist?" msgid "Are you sure to delete this Watchlist?"
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistCard.tsx:44 #: assets/components/tracking/watchlist/WatchlistCard.tsx:45
msgid "This Watchlist is not linked to a Connector." msgid "This Watchlist is not linked to a Connector."
msgstr "" msgstr ""
#: assets/components/tracking/watchlist/WatchlistCard.tsx:47 #: assets/components/tracking/watchlist/WatchlistCard.tsx:48
msgid "Watchlist" msgid "Watchlist"
msgstr "" msgstr ""