Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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': 'Savedblarg',
/** Label for button when status is syncing */
'status-bar.document-status-pulse.status.syncing.text': 'Saving...blarg',
Copy link
Member

Choose a reason for hiding this comment

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

are these intentional? looks like some testing edits snuck into the commit :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops! I thought I hit save 😬 to remove those

/** 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
Loading