Skip to main content
Version: Current (v7.0.0-beta.3)

A translateString that maps every key needs the new TranslatableString keys

Detect​

  • In your code, a translateString passed to Form that looks each key up in a table or switch of your own, with no fallback to englishStringTranslator() for keys it doesn't know.
  • On the rendered page, an empty or undefined date part name, picker button, placeholder, group name or tooltip in a translated form.
  • If your table is typed Record<TranslatableString, string>, the type checker reports the keys it is missing.

Change​

These keys are new in v7. Each English default is what englishStringTranslator() returns, with %1 and %2 replaced by the parameters.

KeyEnglish defaultUsed for
YearLabel, MonthLabel, DayLabelyear, month, dayAltDateWidget part names and placeholders; see AltDateWidget date parts are named by the field's label and the part
HourLabel, MinuteLabel, SecondLabelhour, minute, secondAltDateTimeWidget part names and placeholders
DateElementAriaLabel%1, %2how a date part's name combines the field's label and the part
SelectPlaceholderSelect ...the name and placeholder of a select no label names; see shadcn's SelectWidget names its combobox and fills an empty placeholder
RadioGroupNameChoose an optionthe name of a radio group no label names; see A SelectWidget or RadioWidget of your own applies the names rjsf hands it
RequiredGroupCuerequiredthe end of a required checkbox group's accessible name; see A required checkbox group, multiple select, file input or array widget needs minItems
DoneLabel, TimeLabelDone, Time@rjsf/daisyui's date picker Done button and time input label; see daisyUI's date pickers open from a combobox button into one popup element
NumberInputTitle, IntegerInputTitleEnter a number, Enter a whole numberthe title of a numeric input; see Numeric inputs carry a title shown as a tooltip and used as a fallback name
AdditionalPropertyKeyNotAllowedThe key "%1" is not allowed herethe error on a row for a forbidden extra key; see A row for a forbidden extra key shows an error from the first render
CopyItemButton, MoveUpItemButton, MoveDownItemButton, RemoveItemButtonCopy %1, Move %1 up, Move %1 down, Remove %1the buttons of an array item named through ui:options.itemLabel; RemoveItemButton also names the remove button of a selected item in @rjsf/shadcn's multiple select
ItemNameWithNumber%1 (%2)an array item named through ui:options.itemLabel that shares its name with another, and each thumb of a @rjsf/mui range of several values

Add each to your table, or fall back to the English translator for keys you don't translate:

+import { englishStringTranslator } from '@rjsf/utils';
+
function translateString(key: TranslatableString, params?: string[]) {
- return myTranslator(key, params);
+ return key in myTable ? myTranslator(key, params) : englishStringTranslator(key, params);
}

A TranslatableString key is its English text, so a table keyed by TranslatableString.X follows a changed default on its own, and one keyed by literal strings does not. The English UnsupportedField* and FilesInfo strings no longer use markdown syntax; see Markdown is an opt-in template. InvalidObjectField is removed, since an incomplete ui:order now renders the object instead of an error; see TranslatableString.InvalidObjectField is removed. TranslatableString is also an as const object now; see TranslatableString is an as const object instead of an enum.

Verify​

In a form rendered with your translateString, date parts, daisyUI's pickers, untitled selects and radio groups, required checkbox groups, numeric input tooltips, forbidden extra keys and array item buttons all show translated text.

Also read: