Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is unable to translate a contact form created with the Metform plugin and Elementor widgets on their multilingual site.
Solution:
A. Translate the form content:
1. Navigate to WPML > Settings > Post Types Translation and set the post type "metform-form" to Translatable.
2. Go to WPML > Settings > Custom XML Configuration and add the following code to translate the form fields:


<wpml-config>
  <elementor-widgets>
    <widget name="mf-text">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-email">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-telephone">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-textarea">
      <fields>
        <field>mf_input_label</field>
      </fields>
    </widget>
    <widget name="mf-button">
      <fields>
        <field>mf_btn_text</field>
      </fields>
    </widget>
  </elementor-widgets>
</wpml-config>

3. Visit Metform > Forms and translate the form titled "New Form # 1693676945".
B. Translate the widget form on the contact page:
1. Follow step 2 above to add a custom XML code to translate the form ID:


<widget name="metform">
  <fields>
    <field type="Metform ID">mf_form_id</field>
  </fields>
</widget>

2. Switch to the English language in Metform to retrieve the form ID from the URL, which is 2710.
3. Add the following PHP code to the file functions.php in the theme folder to make the number translatable in the Advanced Translation Editor:

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

4. Update the contact page and its translation.
5. In the Advanced Translation Editor, search for the form ID and translate it.
Now, the form should appear translated on the frontend.
Refer to the documentation for further details:

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

No supporters are available to work today on this forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Long Nguyen 4 months, 1 week ago.

Assisted by: Long Nguyen.

Author Posts
May 10, 2024 at 8:19 am #15613137

aliK-22

I am trying to:
Translate but I'm failed can you help me please?

Link to a page where the issue can be seen:
hidden link

May 10, 2024 at 8:34 am #15613459

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Here is the new ticket. The contact form on the contact page is created by the plugin Metform. There is a workaround to translate this form, please follow steps below:

A. Translate the form content: the form is created with Elementor widgets.
1. Go to WPML > Settings > Post Types Translation > Set the post type "metform-form" preference to Translatable.

2. Go to WPML > Settings > Custom XML Configuration > Add the code below to translate the form fields:

<wpml-config>
  <elementor-widgets>
    <widget name="mf-text">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-email">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-telephone">
      <fields>
        <field>mf_input_label</field>
        <field>mf_input_validation_warning_message</field>
      </fields>
    </widget>
    <widget name="mf-textarea">
      <fields>
        <field>mf_input_label</field>
      </fields>
    </widget>
    <widget name="mf-button">
      <fields>
        <field>mf_btn_text</field>
      </fields>
    </widget>
  </elementor-widgets>
</wpml-config>

3. Go to Metform > Forms > Translate the form "New Form # 1693676945".

B. Translate the widget form on the contact page: It is created by the Elementor widget Metform.
1. I follow step 2 above to add a custom XML code to translate the form ID

<widget name="metform">
  <fields>
    <field type="Metform ID">mf_form_id</field>
  </fields>
</widget>

2. Edit the Metform > Switch to English language to get the form ID in the URL: 2710
3. Add the PHP code below to the file functions.php in the theme folder to translate the number in the Advanced Translation Editor

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

4. Edit the contact page > Click on Update > Update the translation.
5. In the Advanced Translation Editor > Search for the form ID and translate it.

Now you can see the form is translated in the frontend.

Refer documentation
https://wpml.org/documentation/support/language-configuration-files/how-to-register-page-builder-widgets-for-translation/
https://wpml.org/documentation/getting-started-guide/translating-custom-posts/

Looking forward to your reply.
Thanks

Contact - Prof. Dr. Selami Çakmak 2024-05-10 15-32-25.png
Forms ‹ Prof. Dr. Selami Çakmak — WordPress 2024-05-10 15-29-25.png
Advanced Translation Editor - WPML 2024-05-10 15-09-13.png
May 10, 2024 at 1:51 pm #15615174

aliK-22

Thank you very much. Even if the support ticket is closed, can I still reach out at any time?

May 13, 2024 at 1:08 am #15618254

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Yes, sure. Feel free to contact us again if you have any questions.

Have a nice day.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.