From c558040a51adde41d79dfb5eb0dd91c1912f3c56 Mon Sep 17 00:00:00 2001 From: Tommy Petty Date: Fri, 12 Jan 2024 15:42:04 -0500 Subject: [PATCH] chore(i18n): fixed missing translations with document status pulse (#5498) * chore(i18n): fixed missing translations with document status pulse * chore(i18n): removed testing text --- packages/sanity/src/structure/i18n/resources.ts | 4 ++++ .../DocumentStatusPulse/DocumentStatusPulse.tsx | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/sanity/src/structure/i18n/resources.ts b/packages/sanity/src/structure/i18n/resources.ts index 8daa78153ea..dddfc2fac86 100644 --- a/packages/sanity/src/structure/i18n/resources.ts +++ b/packages/sanity/src/structure/i18n/resources.ts @@ -385,6 +385,10 @@ const structureLocaleStrings = defineLocalesResources('structure', { /** The text for the "Open preview" action for a document */ 'production-preview.menu-item.title': 'Open preview', + /** Label for button when status is saved */ + 'status-bar.document-status-pulse.status.saved.text': 'Saved', + /** Label for button when status is syncing */ + 'status-bar.document-status-pulse.status.syncing.text': 'Saving...', /** Accessibility label indicating when the document was last published, in relative time, eg "3 weeks ago" */ 'status-bar.publish-status-button.last-published-time.aria-label': 'Last published {{relativeTime}}', diff --git a/packages/sanity/src/structure/panes/document/statusBar/DocumentStatusPulse/DocumentStatusPulse.tsx b/packages/sanity/src/structure/panes/document/statusBar/DocumentStatusPulse/DocumentStatusPulse.tsx index c8b6e7c8a4c..1543b629237 100644 --- a/packages/sanity/src/structure/panes/document/statusBar/DocumentStatusPulse/DocumentStatusPulse.tsx +++ b/packages/sanity/src/structure/panes/document/statusBar/DocumentStatusPulse/DocumentStatusPulse.tsx @@ -1,26 +1,28 @@ import {ButtonTone, Flex, Text} from '@sanity/ui' import React from 'react' import {AnimatedStatusIcon} from './AnimatedStatusIcon' -import {TextWithTone} from 'sanity' +import {structureLocaleNamespace} from '../../../../i18n' +import {TextWithTone, useTranslation} from 'sanity' type StatusType = 'saved' | 'syncing' interface ReviewChangesButtonProps { status?: StatusType } -const STATUS_DICTIONARY: Record = { +const STATUS_DICTIONARY: Record = { saved: { - text: 'Saved', + i18nKey: 'status-bar.document-status-pulse.status.saved.text', tone: 'positive', }, syncing: { - text: 'Saving...', + i18nKey: 'status-bar.document-status-pulse.status.syncing.text', tone: 'default', }, } export const DocumentStatusPulse = (props: ReviewChangesButtonProps) => { const {status} = props + const {t} = useTranslation(structureLocaleNamespace) if (status !== 'saved' && status !== 'syncing') { return null @@ -35,7 +37,7 @@ export const DocumentStatusPulse = (props: ReviewChangesButtonProps) => { - {currentStatus.text} + {t(currentStatus.i18nKey)} )