🌐 Sync french translations and fix some non-sentence translations

This commit is contained in:
Baptiste Arnaud
2023-12-28 12:15:35 +01:00
parent d42e4a9ce1
commit 28b2b1a60c
11 changed files with 173 additions and 118 deletions

View File

@@ -84,7 +84,7 @@ export const ApiTokensList = ({ user }: Props) => {
{apiTokens?.map((token) => (
<Tr key={token.id}>
<Td>{token.name}</Td>
<Td>{parseTimeSince(token.createdAt)} ago</Td>
<Td>{parseTimeSince(t, token.createdAt)}</Td>
<Td>
<Button
size="xs"

View File

@@ -25,7 +25,7 @@ import { isNotDefined } from '@typebot.io/lib'
import { ChangePlanModal } from '@/features/billing/components/ChangePlanModal'
import { isFreePlan } from '@/features/billing/helpers/isFreePlan'
import { parseTimeSince } from '@/helpers/parseTimeSince'
import { useTranslate } from '@tolgee/react'
import { T, useTranslate } from '@tolgee/react'
import { trpc } from '@/lib/trpc'
import { useToast } from '@/hooks/useToast'
import { parseDefaultPublicId } from '../helpers/parseDefaultPublicId'
@@ -156,16 +156,19 @@ export const PublishButton = ({
{t('publish.versionWarning.message.aboutToDeploy.label')}
</Text>
<Text fontWeight="bold">
{t('publish.versionWarning.message.check.label')}{' '}
<TextLink
href="https://docs.typebot.io/breaking-changes#typebot-v6"
isExternal
>
{t('publish.versionWarning.message.breakingChanges.label')}
</TextLink>
<T
keyName="publish.versionWarning.checkBreakingChanges"
params={{
link: (
<TextLink
href="https://docs.typebot.io/breaking-changes#typebot-v6"
isExternal
/>
),
}}
/>
</Text>
<Text>
{' '}
{t('publish.versionWarning.message.testInPreviewMode.label')}
</Text>
</Stack>
@@ -178,12 +181,16 @@ export const PublishButton = ({
label={
<Stack>
<Text>{t('publishButton.tooltip.nonPublishedChanges.label')}</Text>
<Text fontStyle="italic">
{t('publishButton.tooltip.publishedVersion.from.label')}{' '}
{publishedTypebot &&
parseTimeSince(publishedTypebot.updatedAt.toString())}{' '}
{t('publishButton.tooltip.publishedVersion.ago.label')}
</Text>
{publishedTypebot ? (
<Text fontStyle="italic">
{t('publishButton.tooltip.publishedVersion.from.label', {
timeSince: parseTimeSince(
t,
publishedTypebot.updatedAt.toString()
),
})}
</Text>
) : null}
</Stack>
}
isDisabled={isNotDefined(publishedTypebot) || isPublished}

View File

@@ -1,4 +1,6 @@
export const parseTimeSince = (date: string) => {
import { TFnType } from '@tolgee/react'
export const parseTimeSince = (t: TFnType, date: string) => {
const seconds = Math.floor(
(new Date().getTime() - new Date(date).getTime()) / 1000
)
@@ -6,23 +8,23 @@ export const parseTimeSince = (date: string) => {
let interval = seconds / 31536000
if (interval > 1) {
return Math.floor(interval) + ' years'
return t('timeSince.years', { count: Math.floor(interval) })
}
interval = seconds / 2592000
if (interval > 1) {
return Math.floor(interval) + ' months'
return t('timeSince.months', { count: Math.floor(interval) })
}
interval = seconds / 86400
if (interval > 1) {
return Math.floor(interval) + 'd'
return t('timeSince.days', { count: Math.floor(interval) })
}
interval = seconds / 3600
if (interval > 1) {
return Math.floor(interval) + 'h'
return t('timeSince.hours', { count: Math.floor(interval) })
}
interval = seconds / 60
if (interval > 1) {
return Math.floor(interval) + 'm'
return t('timeSince.minutes', { count: Math.floor(interval) })
}
return Math.floor(seconds) + 's'
return t('timeSince.seconds', { count: Math.floor(interval) })
}