fix: ttag translation

This commit is contained in:
Maël Gangloff
2024-07-29 00:04:45 +02:00
parent 50ca561cb5
commit 767b2c8d70
4 changed files with 161 additions and 153 deletions

View File

@@ -41,37 +41,36 @@ type FieldType = {
}
const domainRole = {
registrant: () => t`Registrant`,
technical: () => t`Technical`,
administrative: () => t`Administrative`,
abuse: () => t`Abuse`,
billing: () => t`Billing`,
registrar: () => t`Registrar`,
reseller: () => t`Reseller`,
sponsor: () => t`Sponsor`,
proxy: () => t`Proxy`,
notifications: () => t`Notifications`,
noc: () => t`Noc`
}
const domainEvent = {
registration: () => t`Registration`,
reregistration: () => t`Reregistration`,
'last changed': () => t`Last changed`,
expiration: () => t`Expiration`,
deletion: () => t`Deletion`,
reinstantiation: () => t`Reinstantiation`,
transfer: () => t`Transfer`,
locked: () => t`Locked`,
unlocked: () => t`Unlocked`,
'registrar expiration': () => t`Registrar expiration`,
'enum validation expiration': () => t`ENUM validation expiration`
}
const locale = navigator.language.split('-')[0]
export default function DomainSearchPage() {
const domainRole = {
registrant: t`Registrant`,
technical: t`Technical`,
administrative: t`Administrative`,
abuse: t`Abuse`,
billing: t`Billing`,
registrar: t`Registrar`,
reseller: t`Reseller`,
sponsor: t`Sponsor`,
proxy: t`Proxy`,
notifications: t`Notifications`,
noc: t`Noc`
}
const domainEvent = {
registration: t`Registration`,
reregistration: t`Reregistration`,
'last changed': t`Last changed`,
expiration: t`Expiration`,
deletion: t`Deletion`,
reinstantiation: t`Reinstantiation`,
transfer: t`Transfer`,
locked: t`Locked`,
unlocked: t`Unlocked`,
'registrar expiration': t`Registrar expiration`,
'enum validation expiration': t`ENUM validation expiration`
}
const [domain, setDomain] = useState<Domain | null>()
const [messageApi, contextHolder] = message.useMessage()
@@ -170,7 +169,7 @@ export default function DomainSearchPage() {
return {
label: new Date(date).toLocaleString(locale),
children: Object.keys(domainEvent).includes(action) ? domainEvent[action as keyof typeof domainEvent]() : action,
children: Object.keys(domainEvent).includes(action) ? domainEvent[action as keyof typeof domainEvent] : action,
color,
dot,
pending: new Date(date).getTime() > new Date().getTime()
@@ -209,7 +208,7 @@ export default function DomainSearchPage() {
title={e.entity.handle}
description={name}
/>
<div>{e.roles.map((r) => Object.keys(domainRole).includes(r) ? domainRole[r as keyof typeof domainRole]() : r).join(', ')}</div>
<div>{e.roles.map((r) => Object.keys(domainRole).includes(r) ? domainRole[r as keyof typeof domainRole] : r).join(', ')}</div>
</List.Item>
}}
/>

View File

@@ -25,55 +25,57 @@ const formItemLayoutWithOutLabel = {
},
};
const triggerEventItems: { label: string, value: EventAction }[] = [
{
label: t`When a domain is expired`,
value: 'expiration'
},
{
label: t`When a domain is deleted`,
value: 'deletion'
},
{
label: t`When a domain is updated`,
value: 'last changed'
},
{
label: t`When a domain is transferred`,
value: 'transfer'
},
{
label: t`When a domain is locked`,
value: 'locked'
},
{
label: t`When a domain is unlocked`,
value: 'unlocked'
},
{
label: t`When a domain is reregistered`,
value: 'reregistration'
},
{
label: t`When a domain is reinstantiated`,
value: 'reinstantiation'
},
{
label: t`When a domain is registered`,
value: 'registration'
}
]
const trigerActionItems = [
{
label: t`Send me an email`,
value: 'email'
}
]
type Watchlist = { token: string, domains: { ldhName: string }[], triggers?: { event: EventAction, action: string }[] }
export default function WatchlistPage() {
const triggerEventItems: { label: string, value: EventAction }[] = [
{
label: t`When a domain is expired`,
value: 'expiration'
},
{
label: t`When a domain is deleted`,
value: 'deletion'
},
{
label: t`When a domain is updated`,
value: 'last changed'
},
{
label: t`When a domain is transferred`,
value: 'transfer'
},
{
label: t`When a domain is locked`,
value: 'locked'
},
{
label: t`When a domain is unlocked`,
value: 'unlocked'
},
{
label: t`When a domain is reregistered`,
value: 'reregistration'
},
{
label: t`When a domain is reinstantiated`,
value: 'reinstantiation'
},
{
label: t`When a domain is registered`,
value: 'registration'
}
]
const trigerActionItems = [
{
label: t`Send me an email`,
value: 'email'
}
]
const [form] = Form.useForm()
const [messageApi, contextHolder] = message.useMessage()
const [watchlists, setWatchlists] = useState<Watchlist[] | null>()

View File

@@ -1,6 +1,7 @@
import React, {useEffect, useState} from "react";
import {Card, Flex, Skeleton, Typography} from "antd";
import {getUser, User} from "../../utils/api";
import {t} from 'ttag'
export default function UserPage() {
@@ -12,12 +13,12 @@ export default function UserPage() {
return <Skeleton loading={user === null} active>
<Flex gap="middle" align="center" justify="center" vertical>
<Card title="My Account">
<Card title={t`My Account`}>
<Typography.Paragraph>
Username : {user?.email}
{t`Username`} : {user?.email}
</Typography.Paragraph>
<Typography.Paragraph>
Roles : {user?.roles.join(',')}
{t`Roles`} : {user?.roles.join(',')}
</Typography.Paragraph>
</Card>
</Flex>