This would need to happen at the patch level, and would need to be deferred until after translations load. Where we currently patch the select component's customOptions object, we could do this:
const prefix = `${component.key}.choices` // e.g. "yourJob.choices"
component.customOptions = Object.assign({
noResultsText: form.t(`${prefix}.noResultsText`, 'No results found'),
noChoicesText: form.t(`${prefix}.noChoicesText`, 'No choices to choose from'),
itemSelectText: form.t(`${prefix}.itemSelectText`, 'Press to select'),
addItemText (value) {
return form.t(`${prefix}.addItemText`, 'Press Enter to add <b>"{{value}}"</b>', { value })
},
maxItemText (count) {
// using {{count}} here enables pluralization in i18next:
// <https://www.i18next.com/translation-function/plurals>
return form.t(`${prefix}.maxItemText`, 'Only {{count}} values can be added', { count })
}
}, component.customOptions)
This would need to happen at the patch level, and would need to be deferred until after translations load. Where we currently patch the select component's
customOptions
object, we could do this: