From b1103ec7a3be110b3440d85fdb2ef516af22330a Mon Sep 17 00:00:00 2001 From: Drew Lyton Date: Thu, 26 Sep 2024 10:15:26 -0400 Subject: [PATCH] feat: add i18n strings --- .../RequestPermissionDialog.tsx | 25 ++++++------------- .../sanity/src/structure/i18n/resources.ts | 18 +++++++++++++ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx index 30931efbc73..b69b78409c3 100644 --- a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx +++ b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx @@ -1,5 +1,3 @@ -/* eslint-disable i18next/no-literal-string */ - import {Box, Card, Flex, Stack, Text, TextInput, useToast} from '@sanity/ui' import {useEffect, useId, useMemo, useState} from 'react' import {type Role, useClient, useProjectId, useTranslation} from 'sanity' @@ -131,16 +129,16 @@ export function RequestPermissionDialog({ - - A request will be made to administrators asking to grant you increased permission to - this project. - - If you'd like, you can add a note + {t('request-permission-dialog.description.text')} + {t('request-permission-dialog.note-input.description.text')} {hasTooManyRequests || hasBeenDenied ? ( {hasTooManyRequests && ( - <> - {msgError ?? - `You've reached the limit for role requests across all projects. Please wait - before submitting more requests or contact an admin for assistance.`} - + <>{msgError ?? t('request-permission-dialog.warning.limit-reached.text')} )} {hasBeenDenied && ( - <>{msgError ?? `Your request to access this project has been declined.`} + <>{msgError ?? t('request-permission-dialog.warning.denied.text')} )} ) : ( { if (e.key === 'Enter') onConfirm() diff --git a/packages/sanity/src/structure/i18n/resources.ts b/packages/sanity/src/structure/i18n/resources.ts index 6001d69fc54..10c4e672164 100644 --- a/packages/sanity/src/structure/i18n/resources.ts +++ b/packages/sanity/src/structure/i18n/resources.ts @@ -411,6 +411,24 @@ const structureLocaleStrings = defineLocalesResources('structure', { /** The text for the "Open preview" action for a document */ 'production-preview.menu-item.title': 'Open preview', + /** The text for the confirm button in the request permission dialog used in the permissions banner */ + 'request-permission-dialog.confirm-button.text': 'Send request', + /** The description text for the request permission dialog used in the permissions banner */ + 'request-permission-dialog.description.text': + 'A request will be made to administrators asking to grant you increased permission to this project.', + /** The header/title for the request permission dialog used in the permissions banner */ + 'request-permission-dialog.header.text': 'Ask to edit', + /** The text describing the note input for the request permission dialog used in the permissions banner */ + 'request-permission-dialog.note-input.description.text': "If you'd like, you can add a note", + /** The placeholder for the note input in the request permission dialog used in the permissions banner */ + 'request-permission-dialog.note-input.placeholder.text': 'Add note...', + /** The error/warning text in the request permission dialog when the user's request has been declined */ + 'request-permission-dialog.warning.denied.text': + 'Your request to access this project has been declined.', + /** The error/warning text in the request permission dialog when the user's request has been denied due to too many outstanding requests */ + 'request-permission-dialog.warning.limit-reached.text': + "You've reached the limit for role requests across all projects. Please wait before submitting more requests or contact an admin for assistance.", + /** Label for button when status is saved */ 'status-bar.document-status-pulse.status.saved.text': 'Saved', /** Label for button when status is syncing */