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

Last updated by Lauren 12 months ago.

Assigned support staff: Lauren.

Author Posts
October 19, 2018 at 7:48 am #2830947

Apulia Vending s.r.l.

I am trying to:
the following items of the Tourmaster plugin do always appear translated Italian and are not in the current language. Could you take a look, please?

- Enquiry Form confirmation text "Your enquiry has been sent. Thank you!".
- Enquiry E-Mail subject.
- Enquiry E-Mail content.

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

I expected to see:
After filling the form on the top right of the page, the success message should say: "Your enquiry has been sent. Thank you!".

Instead, I got:
Instead it says: "La tua richiesta è stata inviata. Grazie!".

The same happens with the automatic e-mail subject and content.

October 20, 2018 at 11:05 pm #2834686

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.

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.

Also, please go to WPML -> Languages and scroll down to the Language Filtering for Ajax section. Check the box to enable "Store a language cookie to support language filtering for AJAX".

After these steps, does the translated message show correctly?

October 22, 2018 at 6:36 am #2836902

Apulia Vending s.r.l.

Hi,
sorry for the delay.

In PHP file I wrote the code you find below that creates the contact form at the top right of the page.

if (get_locale() == 'en_GB') { 
    $relang = 'en';
}
else if (get_locale() == 'it_IT') {
    $relang = 'it';
}
else if (get_locale() == 'pt_PT') {
    $relang = 'pt';
}
<script src=\'<em><u>hidden link</u></em>'.$relang.'\'></script>
<div class="g-recaptcha" data-sitekey="6LensiwUAAAAALtanbI2nxFqxVrkuaApwpesyvBi" data-callback="enableBtn" id="button1"></div><br>
<center><input type="checkbox" id="terms" onclick="checkTerms()"> I accept <a href="">term of use</a></center>
<input type="hidden" name="tour-id" value="' . get_the_ID() . '" />
<input type="submit" id="sendmsg" class="tourmaster-button" value="' . esc_html__('Submit Enquiry', 'tourmaster') . '" disabled/>

<script> 
  var chaptched = false;
  
  function enableBtn(){ 
    chaptched = true;
    if(document.getElementById("terms").checked){       
        document.getElementById("sendmsg").disabled = false;
    }
  }
    
  function checkTerms(){
    if(document.getElementById("terms").checked && chaptched)
        document.getElementById("sendmsg").disabled = false;
  }
</script>

I would like to translate "terms of use" page url with WPML.

In JS file I managed a redirect link of a ajax secces code, as below, to this page that I would manage with WPML:

$.ajax({
    type: 'POST',
    url: form.attr('data-ajax-url'),
    data: { action: form.attr('data-action'), data: tourmaster_get_booking_detail(form) },
    dataType: 'json',
    error: function( jqXHR, textStatus, errorThrown ){
      // print error message for debug purpose
      console.log(jqXHR, textStatus, errorThrown);
    },
    success: function( data ){
      form_button.removeClass('tourmaster-now-loading');

      if( typeof(data.message) != 'undefined' ){
        if( data.status == 'success' ){
          form.find('input[name], textarea[name], select[name]').val('');
          message_box.removeClass('tourmaster-failed').addClass('tourmaster-success');
        }else{
          message_box.removeClass('tourmaster-success').addClass('tourmaster-failed');
        }

        message_box.html(data.message);
        message_box.slideDown(300);
        
        window.location.href = '/thank-you';  <--- THIS LINE REDIRECT USER TO THANK-YOU PAGE
      }
      
    }
});

My code is hardcoded in the theme/plugin and I need to use the WordPress Built-in Function but I need some help for this purpose.

Best regards

October 22, 2018 at 10:39 am #2837676

Apulia Vending s.r.l.

Sorry I provided here the answer to another ticket.

October 22, 2018 at 1:11 pm #2838177

Apulia Vending s.r.l.

Hi,
it looks like it is correctly working now. I just had to make the second change you suggested.

Thanks for your help.

October 22, 2018 at 3:15 pm #2838620

Lauren
Supporter

Languages: English (English )

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

Thanks for letting me know this is resolved. Have a great day!