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 Jan 12, 2024
1 parent 5281b42 commit c558040
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 @@ -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}}',
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

2 comments on commit c558040

@vercel
Copy link

@vercel vercel bot commented on c558040 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on c558040 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.