From b720e4a236b7e65d5c79bc74b6dd4fa6fc9ce89c Mon Sep 17 00:00:00 2001 From: Robin Pyon Date: Sun, 3 Dec 2023 19:24:48 +0000 Subject: [PATCH] fix: localize create new document button --- packages/sanity/src/core/i18n/bundles/studio.ts | 2 ++ .../components/navbar/new-document/NewDocumentButton.tsx | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/sanity/src/core/i18n/bundles/studio.ts b/packages/sanity/src/core/i18n/bundles/studio.ts index ca1a045b8a8..1329ba35eb1 100644 --- a/packages/sanity/src/core/i18n/bundles/studio.ts +++ b/packages/sanity/src/core/i18n/bundles/studio.ts @@ -969,6 +969,8 @@ export const studioLocaleStrings = defineLocalesResources('studio', { /** Unexpected error: `{{error}}` */ 'member-field-error.unexpected-error': 'Unexpected error: {{error}}', + /** Button label for "Create new document" button */ + 'new-document.button': 'Create new', /** * Tooltip message displayed when hovering/activating the "Create new document" action, * when there are templates/types available for creation diff --git a/packages/sanity/src/core/studio/components/navbar/new-document/NewDocumentButton.tsx b/packages/sanity/src/core/studio/components/navbar/new-document/NewDocumentButton.tsx index 70cead73317..55cdf8bb48e 100644 --- a/packages/sanity/src/core/studio/components/navbar/new-document/NewDocumentButton.tsx +++ b/packages/sanity/src/core/studio/components/navbar/new-document/NewDocumentButton.tsx @@ -141,14 +141,13 @@ export function NewDocumentButton(props: NewDocumentButtonProps) { 'data-testid': 'new-document-button', disabled: disabled || loading, icon: AddIcon, - // @todo: localize text - text: 'Create', + text: t('new-document.button'), mode: 'ghost', onClick: handleToggleOpen, ref: setButtonElement, selected: open, }), - [disabled, handleToggleOpen, loading, open, openDialogAriaLabel], + [disabled, handleToggleOpen, loading, open, openDialogAriaLabel, t], ) // Tooltip content for the open button