Closed lamemmv closed 6 years ago
Hey @lamemmv, in order to translate you must have the dictionary available somewhere; that is set as this.context.intl.dictionary
inside components. You can pass the dictionary from a Component to your action payload if you want to translate something outside a Component.
let uploadedText = action.payload.dictionary.common.uploaded;
Let me know if that solution works for you. I think this is a common use case so it would be good to have a written solution in the docs for it.
Closing for now. Let us know if you still have a question
I'm using preact-redux which use Epic pattern. In the Epic file I have the section like this:
const uploadFileSuccessEpic = action$ => action$.ofType(UPLOAD_FILE_SUCCESS) .flatMap(action => Observable.concat( Observable.of(getFiles(1)),
Observable.of(addNotification('Uploaded', 'success', 'Upload files'))) );
I want to translate the text 'Uploaded' and 'Upload files' here. How can I do that? Is there the way to do like this:
let uploadedText = (<Text id='common.uploaded'></Text>);
and we will use uploadedText inObservable.of(addNotification(uploadedText, 'success', 'Upload files'))
Thank in advance.