Skip Navigation

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

Problem:
I am trying to translate the strings in the WooCommerce Waitlist plugin but the translations don't display on the frontend.

Solution:
It seems like the translations are not showing up because the strings are loaded from the options table too early for WPML to translate them. The plugin should wait until plugins are loaded before reading options.

A possible workaround would be to reload these strings in the 'init' hook.
I have tried with these 2 strings and it worked.

add_action( 'init', 'waitlist_translate_options' );
function waitlist_translate_options() {
    global $xoo_wl_tx_hd_value;
    global $xoo_wl_gl_bntxt_value;
 
    $xoo_wl_tx_hd_value    = esc_attr( get_option( 'xoo-wl-tx-hd', 'Join Waitlist' ) );
    $xoo_wl_gl_bntxt_value = esc_attr( get_option( 'xoo-wl-gl-bntxt', 'Join Waitlist' ) );
}

You just need to add the rest of strings to the code.

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 topic contains 7 replies, has 2 voices.

Last updated by Lauren 2 years, 4 months ago.

Assigned support staff: Lauren.

Author Posts
March 30, 2018 at 4:32 pm

FilippoZ1

I am trying to:
I want to translate the WooCommerce Waitlist Premium plugin. This plugin do not have a wpml-config.xml file; I created that, following the WPML documentation. All the fields I want to translate are in wp_options. Once I added the xml file to the plugin root, the strings are being displayed correctly in String Translation extension. Then I customize the translations for the desired language and I save. In the screenshots you can see the fields added by the wpml-config.xml file I created.

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

I expected to see:
I expected to see the translated strings

Instead, I got:
when I switch language, I still see the values written in wp_options (not the translated versions by String Translation)

March 30, 2018 at 7:13 pm #1561183

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for contacting WPML support. I'll be happy to help you with this.

It looks like the WooCommerce Waitlist is not on our list of compatible plugins (https://wpml.org/documentation/plugins-compatibility/). It could be that these text strings are not properly wrapped in GetText Calls. Please see documentation here: https://wpml.org/faq/language-setup/

We can suggest the plugin's author to join our Go Global Program (https://wpml.org/documentation/theme-compatibility/go-global-program/). Then, our developers can work with the plugin developer to make the strings translatable.

April 3, 2018 at 11:07 am #1563243

FilippoZ1

Yes, it would be great if you can contact the author and make thi plugin compatible with WPML.
This is the support page of the plugin author.
hidden link
Thank you very much.

April 3, 2018 at 12:32 pm #1563351

FilippoZ1

Sorry, another question:
can you explain me exactly what went wrong with the procedure of the xml file?
I checked that the WooCommerce Waitlist plugin does use the get_option() function, so I expected the xml to work inside String Translation, and infact the strings were being displayed correctly, as I said before.
Thank you in advance!

April 3, 2018 at 3:15 pm #1563758

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for sharing the Support page. I sent them a message asking them to join the Go Global program so we can begin the process.

As for why it didn't work, I'm not sure. Did you double check that String Translation is enabled? Please go to WPML > Theme and plugin localization and make sure that either "Translate the theme and plugins using WPML's String Translation only (don't load .mo files)" or "Translate the theme and plugins using WPML's String Translation and load .mo files as backup is selected. Are other strings that you have translated showing up correctly on the frontend?

I can't access your site because it requires authentication. If you want to provide me access, I have marked the next reply as private.

April 3, 2018 at 4:14 pm
April 3, 2018 at 10:17 pm #1564153

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for sending access. I created a copy of your site for testing locally and I am able to reproduce the issue. I have escalated this to our compatibility team, but I have to warn you that we had reached out to the plugin author last year to work together to make the plugins compatible but we never received a response. We will need their cooperation in order to get everything working correctly.

I will report back here as soon as I have more information.

April 4, 2018 at 9:21 am #1564530

FilippoZ1

Thank you very much for your efforts and reports!
I guess we'll wait and see.
Thanks again

April 11, 2018 at 1:33 pm #1597127

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for your patience while our developers continued troubleshooting. It seems like the translations are not showing up because the strings are loaded from the options table too early for WPML to translate them. The plugin should wait until plugins are loaded before reading options.

A possible workaround would be to reload these strings in the 'init' hook.
I have tried with these 2 strings and it worked.

add_action( 'init', 'waitlist_translate_options' );
function waitlist_translate_options() {
    global $xoo_wl_tx_hd_value;
    global $xoo_wl_gl_bntxt_value;

    $xoo_wl_tx_hd_value    = esc_attr( get_option( 'xoo-wl-tx-hd', 'Join Waitlist' ) );
    $xoo_wl_gl_bntxt_value = esc_attr( get_option( 'xoo-wl-gl-bntxt', 'Join Waitlist' ) );
}

You just need to add the rest of strings to the code. I hope this helps - Please let me know if you need any further assistance and I will be happy to help.