Skip to content

Commit

Permalink
refactor(comments): colocate more compose resources
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Feb 6, 2024
1 parent 67f3573 commit 7492d72
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packages/sanity/src/structure/comments/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ const commentsLocaleStrings = defineLocalesResources('comments', {
/** The text for the button to go to the correct field */
'button-go-to-field-aria-label': 'Go to field',

/** When composing a comment, the placeholder text shown when adding a comment to a field with no current comments */
'compose.add-comment-input-placeholder': 'Add comment to <strong>{{field}}</strong>',
/** When composing a comment, the placeholder text shown when the input is empty */
'compose.create-comment-placeholder': 'Create a new comment',
/** When composing a comment, the aria label for the button to mention a user */
'compose.mention-user-aria-label': 'Mention user',
/** When composing a comment, the tooltip text for the button to mention a user */
'compose.mention-user-tooltip': 'Mention user',
/** When composing a reply, the placeholder text shown when the input is empty */
'compose.reply-placeholder': 'Reply',
/** When composing a comment, the aria label for the button to send a comment */
'compose.send-comment-aria-label': 'Send comment',
/** When composing a comment, the tooltip text for the button to send a comment */
Expand Down Expand Up @@ -139,11 +143,6 @@ const commentsLocaleStrings = defineLocalesResources('comments', {
/** The comments onboarding popover header text */
'onboarding-popover-header': 'Document fields now have comments',

/** The placeholder for creating a new comment thread for a given field */
'placeholder-add-comment-to-field': 'Add comment to <strong>{{field}}</strong>',
/** The placeholder for replying to a comment */
'placeholder-reply': 'Reply',

/** Tooltip for the button to add a reaction to a comment */
'reactions.add-reaction-tooltip': 'Add reaction',
/** Aria label for the individual reactions you can choose from when reacting to a comment */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ export function CommentsFieldButton(props: CommentsFieldButtonProps) {

if (!hasComments) {
const placeholder = (
<Translate t={t} i18nKey="placeholder-add-comment-to-field" values={{field: fieldTitle}} />
<Translate
t={t}
i18nKey="compose.add-comment-input-placeholder"
values={{field: fieldTitle}}
/>
)

const content = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export const CommentsListItem = React.memo(function CommentsListItem(props: Comm
onDiscardConfirm={confirmDiscard}
onKeyDown={handleInputKeyDown}
onSubmit={handleReplySubmit}
placeholder={t('placeholder-reply')}
placeholder={t('compose.reply-placeholder')}
readOnly={readOnly}
ref={replyInputRef}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function CreateNewThreadInput(props: CreateNewThreadInputProps) {
}, [])

const placeholder = (
<Translate t={t} i18nKey="placeholder-add-comment-to-field" values={{field: fieldTitle}} />
<Translate t={t} i18nKey="compose.add-comment-input-placeholder" values={{field: fieldTitle}} />
)

return (
Expand Down

0 comments on commit 7492d72

Please sign in to comment.