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

@@ -4,6 +4,9 @@ import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import { msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import {
DO_NOT_INVALIDATE_QUERY_ON_MUTATION,
SKIP_QUERY_BATCH_META,
@@ -42,7 +45,9 @@ export const EditTemplateForm = ({
isEnterprise,
templateRootPath,
}: EditTemplateFormProps) => {
const { _ } = useLingui();
const { toast } = useToast();
const router = useRouter();
const team = useOptionalCurrentTeam();
@@ -68,18 +73,18 @@ export const EditTemplateForm = ({
const documentFlow: Record<EditTemplateStep, DocumentFlowStep> = {
settings: {
title: 'General',
description: 'Configure general settings for the template.',
title: msg`General`,
description: msg`Configure general settings for the template.`,
stepIndex: 1,
},
signers: {
title: 'Add Placeholders',
description: 'Add all relevant placeholders for each recipient.',
title: msg`Add Placeholders`,
description: msg`Add all relevant placeholders for each recipient.`,
stepIndex: 2,
},
fields: {
title: 'Add Fields',
description: 'Add all relevant fields for each recipient.',
title: msg`Add Fields`,
description: msg`Add all relevant fields for each recipient.`,
stepIndex: 3,
},
};
@@ -144,8 +149,8 @@ export const EditTemplateForm = ({
console.error(err);
toast({
title: 'Error',
description: 'An error occurred while updating the document settings.',
title: _(msg`Error`),
description: _(msg`An error occurred while updating the document settings.`),
variant: 'destructive',
});
}
@@ -167,8 +172,8 @@ export const EditTemplateForm = ({
setStep('fields');
} catch (err) {
toast({
title: 'Error',
description: 'An error occurred while adding signers.',
title: _(msg`Error`),
description: _(msg`An error occurred while adding signers.`),
variant: 'destructive',
});
}
@@ -190,8 +195,8 @@ export const EditTemplateForm = ({
}
toast({
title: 'Template saved',
description: 'Your templates has been saved successfully.',
title: _(msg`Template saved`),
description: _(msg`Your templates has been saved successfully.`),
duration: 5000,
});
@@ -201,8 +206,8 @@ export const EditTemplateForm = ({
router.push(templateRootPath);
} catch (err) {
toast({
title: 'Error',
description: 'An error occurred while adding signers.',
title: _(msg`Error`),
description: _(msg`An error occurred while adding signers.`),
variant: 'destructive',
});
}