feat: web i18n (#1286)

This commit is contained in:
David Nguyen
2024-08-27 20:34:39 +09:00
committed by GitHub
parent 0829311214
commit 75c8772a02
294 changed files with 14846 additions and 2229 deletions

View File

@@ -3,6 +3,8 @@
import type { HTMLAttributes } from 'react';
import { useState } from 'react';
import { Trans } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { Download } from 'lucide-react';
import { downloadPDF } from '@documenso/lib/client-only/download-pdf';
@@ -24,9 +26,11 @@ export const DocumentDownloadButton = ({
disabled,
...props
}: DownloadButtonProps) => {
const [isLoading, setIsLoading] = useState(false);
const { _ } = useLingui();
const { toast } = useToast();
const [isLoading, setIsLoading] = useState(false);
const onDownloadClick = async () => {
try {
setIsLoading(true);
@@ -43,8 +47,8 @@ export const DocumentDownloadButton = ({
setIsLoading(false);
toast({
title: 'Something went wrong',
description: 'An error occurred while downloading your document.',
title: _('Something went wrong'),
description: _('An error occurred while downloading your document.'),
variant: 'destructive',
});
}
@@ -61,7 +65,7 @@ export const DocumentDownloadButton = ({
{...props}
>
{!isLoading && <Download className="mr-2 h-5 w-5" />}
Download
<Trans>Download</Trans>
</Button>
);
};