2

I have trouble to use the translation in admin on rest. I think i don't really understand how it's work

For example I cannot use translation in this case:

<FunctionField
    label="some.label"
    render={(record, translate) => translate('some.translation')}
/>

I have this error: uncaught at handleFetch TypeError: translate is not a function

Someone would be able to help me on this?

sebdec
  • 29
  • 1
  • 5
  • 1
    This is not how to use the translation feature please read the docs. https://marmelab.com/admin-on-rest/Translation.html – kunal pareek Jul 27 '17 at 10:46
  • thank your response but the doc doesn't really help in this point. finally works when I use props.translate – sebdec Jul 27 '17 at 14:16
  • @sebdec If you figured out how it works, considering [answering your own question](https://stackoverflow.blog/2011/07/01/its-ok-to-ask-and-answer-your-own-questions/) to help others. – Stijn de Witt Aug 09 '17 at 17:04

1 Answers1

1

You should return a component on the render function.

<FunctionField render={
   (record) =>
      <Component label={translate('record.to_translate')} /> 
} />
Miguel Araya
  • 404
  • 3
  • 10