Todae

Todae

StringsProvider

StringsProvider sets the text Todae writes by itself for everything inside it: the default names of parts with no words of their own, such as an icon-only Dialog.Close, and screen reader messages, such as those of Field.Counter. Todae ships English only. Pass the keys you want to change; each key you leave out comes from the nearest StringsProvider above, else English. It renders no element.

On this page
const korean: Partial<Strings> = {
  close: '닫기',
  dismiss: '닫기',
  removeChip: (label) => `${label} 삭제`,
  moreChips: (count) => `${count}개 더 있음`,
  characterLimit: (max) => `최대 ${max}자`,
  charactersLeft: (remaining) => `${remaining}자 남음`,
  characterLimitReached: '글자 수 한도에 도달했습니다',
}

<StringsProvider strings={korean}>
  <App />
</StringsProvider>

A nested provider changes only the keys it passes:

<StringsProvider strings={korean}>
  <StringsProvider strings={{ close: '취소' }}>
    {/* close is 취소 here; every other key is still Korean. */}
  </StringsProvider>
</StringsProvider>

A part's own prop still wins over the provider: a non-empty aria-label on a close button, Attachment.Remove, Conversation.ScrollButton or landmark, removeLabel on Chip.Root, removeLabel, overflowLabel or panelLabel on ChipList.Root, chipRemoveLabel or overflowLabel on Field.ChipInput, a non-empty statusLabel on Steps.Item, and createLabel on useCombobox. useStrings() returns the strings in effect, for your own components.

Strings

A string that depends on a number or a label is a function.

KeyUsed byEnglish
closeDialog.Close, Drawer.Close, BottomSheet.Close without wordsClose
dismissAlert.Close, Toast.Close without wordsDismiss
notificationsToast.Region landmarkNotifications
breadcrumbsBreadcrumbs.Root landmarkBreadcrumb
paginationPagination.Root landmarkPagination
contentsContents.Root landmarkOn this page
resizeSheetBottomSheet.GrabberResize sheet
resizePanelSplitter.Handle with no aria-label or aria-labelledbyResize
optionsgetSheetProps() and getDialogProps() of useComboboxOptions
removeChip(label)Chip remove buttonsRemove {label}
removeAttachment(name)Attachment.Remove with no content, given Attachment.Name's text, or an empty string without oneRemove {name}, or Remove with no name
moreChips(count)+N chips{count} more
moreChipsPanel(count)ChipList popover of folded chips{count} more chips, or 1 more chip
characterLimit(max)Field.Counter, the input's descriptionUp to {max} characters
charactersLeft(remaining)Field.Counter, from 20 left{remaining} characters left, or 1 character left
characterLimitReachedField.Counter, at or past the limitCharacter limit reached
createOption(query)useCombobox's create row, without createLabelCreate "{query}"
suggestionsuseMentions' list, without a trigger labelSuggestions
suggestionCount(count)useMentions, when its list opens or its count changes3 suggestions, No suggestions
saturationColorPicker.Area, its left-to-right inputSaturation
brightnessColorPicker.Area, its bottom-to-top inputBrightness
hueColorPicker.Hue, without aria-labelHue
colorPickerA Field.Picker with swatch and no typed input beside it: its popover, and its button beside another controlColor picker
datePickerA Field.Picker beside a Field.DateInput: its popover and its buttonChoose date
timePickerA Field.Picker beside a Field.TimeInput: its popover and its buttonChoose time
dateTimePickerA Field.Picker beside a Field.DateTimeInput: its popover and its buttonChoose date and time
dateRangePickerA Field.Picker beside a Field.DateRangeInput: its popover and its buttonChoose dates
pickerA Field.Picker with no typed input beside it and no swatch: its popover, and its button beside another controlOpen picker
increment(field)Field.Increment, unless its own text names it, given the text of its Field.NumberInput's label, or an empty string without oneIncrease {field}, or Increase with no label
decrement(field)Field.Decrement, unless its own text names it, given the text of its Field.NumberInput's label, or an empty string without oneDecrease {field}, or Decrease with no label
previousMonthCalendar.Header's previous-month buttonPrevious month
nextMonthCalendar.Header's next-month buttonNext month
previousYearsCalendar.Header's button to the previous page of yearsPrevious years
nextYearsCalendar.Header's button to the next page of yearsNext years
pickEndDateCalendar in range mode, announced after the first pickChoose an end date
copieduseClipboard, after a copyCopied
copyFaileduseClipboard, when a copy failsCould not copy
sortedAscending(column)Table.SortButton, after its column becomes sorted in ascending orderSorted by {column}, ascending
sortedDescending(column)Table.SortButton, after its column becomes sorted in descending orderSorted by {column}, descending
sortCleared(column)Table.SortButton, after its column is no longer sorted{column}, not sorted
conversationConversation.Viewport's region, without aria-label or aria-labelledbyConversation
scrollToLatestConversation.ScrollButton with no contentScroll to latest message
messageStartedConversation, when a message starts arrivingNew message
messageFinishedConversation, when a message finishes arrivingMessage complete
stepDoneSteps.Item's hidden status word for a done stepDone
stepCurrentSteps.Item's hidden status word for the current stepIn progress
stepPendingSteps.Item's hidden status word for a pending stepNot started
stepErrorSteps.Item's hidden status word for a step with an errorFailed
backDrilldown.Back when its own text does not name it and the view below has no labelBack
backTo(label)Drilldown.Back when its own text does not name it, with the label of the view it goes back toBack to {label}
requiredWhat a required ChipInput's text box is described by, since the text box is not what aria-required says is requiredRequired
valueMissingA control the browser reports empty though it is required, shown by ErrorMessage.Root and Form.SummaryThis field is required
typeMismatchEmailAn email input whose value is not an email addressEnter an email address
typeMismatchUrlA url input whose value is not a URLEnter a URL
typeMismatchAn input whose value does not fit its type, other than email and urlEnter a value in the right format
badInputAn input whose entry the browser cannot turn into a valueEnter a valid value
patternMismatchAn input whose value does not match its patternMatch the requested format
tooShort(min)A value shorter than minLengthUse at least {min} characters
tooLong(max)A value longer than maxLengthUse at most {max} characters
rangeUnderflow(min)A value below min; min is the attribute's textEnter {min} or more
rangeOverflow(max)A value above max; max is the attribute's textEnter {max} or less
dateRangeUnderflow(min)A date, time, date and time, or range of dates before min; min is in the field's own formatEnter {min} or later
dateRangeOverflow(max)A date, time, date and time, or range of dates after max; max is in the field's own formatEnter {max} or earlier
stepMismatchA value that does not fit stepEnter a value that fits the allowed steps
formErrors(count)Form.Summary's title{count} problems to fix

Breadcrumbs and Pagination from the server entries, @tounsoo/todae/breadcrumbs and @tounsoo/todae/pagination, render on the server without context, so they always use English. Pass aria-label, or import them from @tounsoo/todae to use the provider.

Accessible composition

Todae handles: The text Todae writes by itself: default names of close buttons, landmarks, chip and attachment remove buttons, the +N chip and Conversation.ScrollButton, the sheet name from useCombobox, and the live messages of Field.Counter, useClipboard, Table.SortButton and Conversation, with the counter's description, and the status words of Steps.Item, and the validation text of ErrorMessage.Root and Form.Summary. A part's own prop wins, as listed above.

You supply: Every key your app shows, in the reader's language. The function keys get the label or the number, so place it where your language needs it and pick the plural form there. StringsProvider renders no element and sets no lang, so set lang on <html>, or on an element around a part in another language, so screen readers pronounce the words right. For Breadcrumbs and Pagination from the server entries, pass aria-label yourself, as above.

Watch for: An empty string. Unlike undefined, it replaces the string above it, so a close button with no words of its own loses the name Todae would have given it. Expecting close or dismiss to name a close button that shows words: the button is named by its own words, and the key is not used.

When to use

StringsProvider

When: Your app is not in English, or you want other wording for Todae's own text, across a whole app or one part of it.

When not: A name for one part → pass its prop, such as aria-label. Text you write yourself, such as a dialog title → it is yours to translate.

useStrings

When: A component of your own that writes text Todae's strings cover, such as a close button's name.

When not: Text only your component writes → your own translations.

Props

StringsProvider props
NameTypeDescription
strings RequiredPartial<Strings>

The strings to change. Each key left out comes from the nearest StringsProvider above, else English. A component prop such as aria-label still wins.

childrenReact.ReactNode

Subtree that uses these strings.