Skip to content

Commit

Permalink
fix(comments): translate input placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Feb 6, 2024
1 parent 12d355e commit e93633c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/sanity/src/structure/comments/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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 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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import {isEqual} from 'lodash'
import React, {useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent} from 'react'
import styled, {css} from 'styled-components'
import {Popover, type PopoverProps} from '../../../../../../ui-components'
import {commentsLocaleNamespace} from '../../../../i18n'
import {MentionsMenu, type MentionsMenuHandle} from '../../mentions'
import {renderBlock, renderChild} from '../render'
import {useCommentInput} from './useCommentInput'
import {useCursorElement} from './useCursorElement'
import {useTranslation} from 'sanity'

const POPOVER_FALLBACK_PLACEMENTS: PopoverProps['fallbackPlacements'] = ['bottom', 'top']
const INLINE_STYLE: React.CSSProperties = {outline: 'none'}
Expand Down Expand Up @@ -65,9 +67,10 @@ export interface EditableHandle {
}

export function Editable(props: EditableProps) {
const {t} = useTranslation(commentsLocaleNamespace)
const {
focusLock,
placeholder = 'Create a new comment',
placeholder = t('compose.create-comment-placeholder'),
onFocus,
onBlur,
onKeyDown,
Expand Down

0 comments on commit e93633c

Please sign in to comment.