Skip to content

Commit

Permalink
chore(i18n): fixed missing translations with document status pulse (#…
Browse files Browse the repository at this point in the history
…5498)

* chore(i18n): fixed missing translations with document status pulse

* chore(i18n): removed testing text
  • Loading branch information
jtpetty authored and juice49 committed Jan 15, 2024
1 parent 671cbce commit 9ad30cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/sanity/src/structure/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,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}}',
Expand Down
Original file line number Diff line number Diff line change
@@ -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<StatusType, {text: string; tone: ButtonTone}> = {
const STATUS_DICTIONARY: Record<StatusType, {i18nKey: string; tone: ButtonTone}> = {
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
Expand All @@ -35,7 +37,7 @@ export const DocumentStatusPulse = (props: ReviewChangesButtonProps) => {
</TextWithTone>

<Text muted size={1}>
{currentStatus.text}
{t(currentStatus.i18nKey)}
</Text>
</Flex>
)
Expand Down

0 comments on commit 9ad30cd

Please sign in to comment.