react icon indicating copy to clipboard operation
react copied to clipboard

[BUG] Form does not change language when options change

Open madflow opened this issue 3 years ago • 8 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [] Form.io
    • [x] Local deployment
      • Version: Latest
  • Formio.js version: Latest
  • Frontend framework: React
  • Browser: Firefox latest
  • Browser version: latest

Steps to Reproduce

  1. Use React and Formio with i18next.
  2. Configure everything something like this:
  const options = {
    i18n: {
      [i18n.language]: i18n.getResourceBundle(i18n.language, 'translation'),
    },
    language: i18n.language,
    hooks: {},
  };

// https://help.form.io/developers/form-renderer#form-renderer-options
  return (
    <>
      <Form
        src={url}
        onSubmitDone={onSubmitDone}
        formReady={onFormReady}
        options={options}
      />
      {isReady ? null : <LoadingSpinner animation="border" />}
    </>
  );
  1. Change the language

Expected behavior

  • Language changes in the form

Kapture 2021-09-27 at 17 53 35

Observed behavior

  • Language does not change

Kapture 2021-09-27 at 17 56 29

This can be hack-fixed by amending Form.jsx , https://github.com/formio/react/blob/e9d61b0dc7ec45be966fd57b92c41e9b9f8483ab/src/components/Form.jsx#L62

  useEffect(() => {
    const { src } = props;
    if (src) {
      createWebformInstance(src).then(() => {
        if (formio) {
          formio.src = src;
        }
      });
      initializeFormio();
    }
  }, [props.src, props.options]);

madflow avatar Sep 27 '21 15:09 madflow

hi @madflow can you assign me here?

rijusougata13 avatar Oct 02 '21 22:10 rijusougata13

@rijusougata13 No, I cannot assign you.

madflow avatar Oct 04 '21 08:10 madflow

@madflow @rijusougata13 Is there a solution for this problem. I am facing the same issue. Thanks

rafapsm avatar Mar 02 '22 15:03 rafapsm

We added this for our Monday planning to get this prioritized. Thanks.

travist avatar Sep 02 '22 14:09 travist

Having the same issue.

PatrikWing avatar Feb 22 '23 13:02 PatrikWing