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.

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

Problem:

I use a global widget form that I translated with WPML string translation. It works fine, but I cannot translate the redirection URL.

Solution:

1. Add the following code to the functions.php file of your theme:

add_filter('wpml_elementor_widgets_to_translate', 'wpml_widgets_to_translate_filter');

function wpml_widgets_to_translate_filter($widgets)
{
    $widgets['form'] = [
        'conditions' => ['widgetType' => 'form'],
        'fields' => [
            [
                'field' => 'redirect_to',
                'type' => __('Form: Redirect to', 'wpml-string-translation'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'form_name',
                'type' => __('Form: name', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'button_text',
                'type' => __('Form: Button text', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_subject',
                'type' => __('Form: Email subject', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_from_name',
                'type' => __('Form: Email from name', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_content',
                'type' => __('Form: Email Content', 'sitepress'),
                'editor_type' => 'AREA'
            ],
            [
                'field' => 'email_subject_2',
                'type' => __('Form: Email subject', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_content_2',
                'type' => __('Form: Email Content', 'sitepress'),
                'editor_type' => 'AREA'
            ],
            [
                'field' => 'success_message',
                'type' => __('Form: Success message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'error_message',
                'type' => __('Form: Error message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'required_message',
                'type' => __('Form: Required message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'invalid_message',
                'type' => __('Form: Invalid message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
        ],
        'integration-class' => 'WPML_Elementor_Form',
    ];

    return $widgets;
}

2. Save the file.

3. Update the original global widget.

4. Translate the widget.

Now the redirect link should appear.

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by aurelienB-3 1 month, 2 weeks ago.

Assigned support staff: Itamar.

Author Posts
September 3, 2019 at 5:45 pm #4506727

aurelienB-3

I've got two page, in english and french :

hidden link
hidden link

I use a global widget form that I translated with WPML string translation. It works fine but I cannot translate the redirecition URL.
Screen 1 : hidden link
Screen 2 : hidden link

September 3, 2019 at 8:00 pm #4507185

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

The first step of debugging this issue would be to update all the relevant plugins. By looking at the debug information that you have attached to this ticket, I can see that WPML and its add-ons and Elementor (free and pro) are not updated to their latest versions.
Can you please update everything and see if the issue persists?

Thanks,
Itamar.

September 3, 2019 at 10:53 pm #4507439

aurelienB-3

Hello Itamar,

Thanks for your answer, I've made the update and the issue is still there.
I think it's the same issue has here : https://wpml.org/forums/topic/redirect-to-differents-pages-in-elementor-form-global-widget-after-submit/ but its not helping me.

Maybe you can assist me add the custom string translation for the field "redirect_to" on an elementor form as explained here : https://wpml.org/documentation/plugins-compatibility/elementor/how-to-add-wpml-support-to-custom-elementor-widgets/

Aurélien

September 4, 2019 at 10:30 am #4510063

aurelienB-3

Sorry to insist, but this issue is really blocking me for releasing a major update on my website so it will be great to have an answer or even better, chat with a developer.

Thanks

September 4, 2019 at 3:40 pm #4512553

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I've tested the redirect option of the Elementor form on my test site and could replicate the issue. Then I've searched our internal documentation and found that it is a known issue that has a workaround. I've tested this workaround on my local server and it works. Here is the workaround. Please try it on your site.

1. Add the following code to the functions.php file of your theme:

add_filter('wpml_elementor_widgets_to_translate', 'wpml_widgets_to_translate_filter');

function wpml_widgets_to_translate_filter($widgets)
{
    $widgets['form'] = [
        'conditions' => ['widgetType' => 'form'],
        'fields' => [
            [
                'field' => 'redirect_to',
                'type' => __('Form: Redirect to', 'wpml-string-translation'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'form_name',
                'type' => __('Form: name', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'button_text',
                'type' => __('Form: Button text', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_subject',
                'type' => __('Form: Email subject', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_from_name',
                'type' => __('Form: Email from name', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_content',
                'type' => __('Form: Email Content', 'sitepress'),
                'editor_type' => 'AREA'
            ],
            [
                'field' => 'email_subject_2',
                'type' => __('Form: Email subject', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'email_content_2',
                'type' => __('Form: Email Content', 'sitepress'),
                'editor_type' => 'AREA'
            ],
            [
                'field' => 'success_message',
                'type' => __('Form: Success message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'error_message',
                'type' => __('Form: Error message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'required_message',
                'type' => __('Form: Required message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
            [
                'field' => 'invalid_message',
                'type' => __('Form: Invalid message', 'sitepress'),
                'editor_type' => 'LINE'
            ],
        ],
        'integration-class' => 'WPML_Elementor_Form',
    ];

    return $widgets;
}

2. Save the file.

3. Update the original global widget.

4. Translate the widget.

Now the redirect link should appear.

Please let me know if it is working for you.

Regards,
Itamar.

September 4, 2019 at 3:46 pm #4512621

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi again.

Our compatibility developer tells me that this fix will be included in a future version of WPML.
I'll inform you when it is released here.

Regards,
Itamar.

September 5, 2019 at 7:24 am #4516093

aurelienB-3

My issue is resolved now. Thank you!