Closed Rvdmaas closed 8 months ago
You can use computed
values to compute the labels or other props when your app locale changes:
Assume you have a store.locale
observable
which changes when the user switches language:
const $label = (id: string) => store.locale && t(`form.contact.labels.${id}`)
const $placeholder = (id: string) => store.locale && t(`form.contact.placeholders.${id}`)
export const Form = new Form({
fields: [
'email',
],
labels: {
email: () => $label('email'),
},
placeholders: {
email: () => $placeholder('email'),
},
})
I'm trying to translate the form labels with the i18n(v9) t function, however when i try to export my file like this:
export default withNamespaces()(UploadForm);
I get an error saying:
TypeError: form.values is not a function
Is there a valid way to export and translate labels with the t function like this?label: t('test'),