Translation followup (#9735)

Address PR comments and more progress on translation
This commit is contained in:
Félix Malfait
2025-01-19 13:29:19 +01:00
committed by GitHub
parent 052331685f
commit 056cb7c66d
97 changed files with 3981 additions and 402 deletions

View File

@ -23,6 +23,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { TextInput } from '@/ui/input/components/TextInput';
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
import { Trans, useLingui } from '@lingui/react/macro';
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
@ -42,6 +43,7 @@ const StyledInputContainer = styled.div`
`;
export const SettingsDevelopersApiKeyDetail = () => {
const { t } = useLingui();
const { enqueueSnackBar } = useSnackBar();
const [isRegenerateKeyModalOpen, setIsRegenerateKeyModalOpen] =
useState(false);
@ -82,7 +84,7 @@ export const SettingsDevelopersApiKeyDetail = () => {
navigate(SettingsPath.Developers);
}
} catch (err) {
enqueueSnackBar(`Error deleting api key: ${err}`, {
enqueueSnackBar(t`Error deleting api key: ${err}`, {
variant: SnackBarVariant.Error,
});
} finally {
@ -134,7 +136,7 @@ export const SettingsDevelopersApiKeyDetail = () => {
}
}
} catch (err) {
enqueueSnackBar(`Error regenerating api key: ${err}`, {
enqueueSnackBar(t`Error regenerating api key: ${err}`, {
variant: SnackBarVariant.Error,
});
} finally {
@ -142,6 +144,8 @@ export const SettingsDevelopersApiKeyDetail = () => {
}
};
const confirmationValue = t`yes`;
return (
<>
{apiKeyData?.name && (
@ -149,14 +153,14 @@ export const SettingsDevelopersApiKeyDetail = () => {
title={apiKeyData?.name}
links={[
{
children: 'Workspace',
children: t`Workspace`,
href: getSettingsPath(SettingsPath.Workspace),
},
{
children: 'Developers',
children: t`Developers`,
href: getSettingsPath(SettingsPath.Developers),
},
{ children: `${apiKeyName} API Key` },
{ children: t`${apiKeyName} API Key` },
]}
>
<SettingsPageContainer>
@ -164,8 +168,8 @@ export const SettingsDevelopersApiKeyDetail = () => {
{apiKeyToken ? (
<>
<H2Title
title="API Key"
description="Copy this key as it will only be visible this one time"
title={t`API Key`}
description={t`Copy this key as it will only be visible this one time`}
/>
<ApiKeyInput apiKey={apiKeyToken} />
<StyledInfo>
@ -175,12 +179,12 @@ export const SettingsDevelopersApiKeyDetail = () => {
) : (
<>
<H2Title
title="API Key"
description="Regenerate an API key"
title={t`API Key`}
description={t`Regenerate an API key`}
/>
<StyledInputContainer>
<Button
title="Regenerate Key"
title={t`Regenerate Key`}
Icon={IconRepeat}
onClick={() => setIsRegenerateKeyModalOpen(true)}
/>
@ -196,7 +200,7 @@ export const SettingsDevelopersApiKeyDetail = () => {
)}
</Section>
<Section>
<H2Title title="Name" description="Name of your API key" />
<H2Title title={t`Name`} description={t`Name of your API key`} />
<ApiKeyNameInput
apiKeyName={apiKeyName}
apiKeyId={apiKeyData?.id}
@ -206,11 +210,11 @@ export const SettingsDevelopersApiKeyDetail = () => {
</Section>
<Section>
<H2Title
title="Expiration"
description="When the key will be disabled"
title={t`Expiration`}
description={t`When the key will be disabled`}
/>
<TextInput
placeholder="E.g. backoffice integration"
placeholder={t`E.g. backoffice integration`}
value={formatExpiration(
apiKeyData?.expiresAt || '',
true,
@ -222,13 +226,13 @@ export const SettingsDevelopersApiKeyDetail = () => {
</Section>
<Section>
<H2Title
title="Danger zone"
description="Delete this integration"
title={t`Danger zone`}
description={t`Delete this integration`}
/>
<Button
accent="danger"
variant="secondary"
title="Delete"
title={t`Delete`}
Icon={IconTrash}
onClick={() => setIsDeleteApiKeyModalOpen(true)}
/>
@ -237,36 +241,37 @@ export const SettingsDevelopersApiKeyDetail = () => {
</SubMenuTopBarContainer>
)}
<ConfirmationModal
confirmationPlaceholder="yes"
confirmationValue="yes"
confirmationPlaceholder={confirmationValue}
confirmationValue={confirmationValue}
isOpen={isDeleteApiKeyModalOpen}
setIsOpen={setIsDeleteApiKeyModalOpen}
title="Delete API key"
title={t`Delete API key`}
subtitle={
<>
Please type "yes" to confirm you want to delete this API Key. Be
aware that any script using this key will stop working.
</>
<Trans>
Please type {`"${confirmationValue}"`} to confirm you want to delete
this API Key. Be aware that any script using this key will stop
working.
</Trans>
}
onConfirmClick={deleteIntegration}
deleteButtonText="Delete"
loading={isLoading}
/>
<ConfirmationModal
confirmationPlaceholder="yes"
confirmationValue="yes"
confirmationPlaceholder={confirmationValue}
confirmationValue={confirmationValue}
isOpen={isRegenerateKeyModalOpen}
setIsOpen={setIsRegenerateKeyModalOpen}
title="Regenerate an API key"
title={t`Regenerate an API key`}
subtitle={
<>
<Trans>
If youve lost this key, you can regenerate it, but be aware that
any script using this key will need to be updated. Please type "yes"
to confirm.
</>
any script using this key will need to be updated. Please type
{`"${confirmationValue}"`} to confirm.
</Trans>
}
onConfirmClick={regenerateApiKey}
deleteButtonText="Regenerate key"
deleteButtonText={t`Regenerate key`}
loading={isLoading}
/>
</>