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.

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by Radu 1 month, 1 week ago.

Assigned support staff: Radu.

Author Posts
August 10, 2019 at 5:03 pm #4375841

alejandroM-32

Hi,

I am experiencing exactly the same problem reported here, https://wpml.org/forums/topic/wpml-removes-backslashes-2/ and I can't find the way to solve it following what you advised there.

Original:
return datestring.replace(/(\d{2})(\/)(\d{2})/, "$3$2$1");

After translation:
return datestring.replace(/(d{2})(/)(d{2})/, "$3$2$1");

In my case, the string is part of jQuery code inserted in a Code Module from a DIVI Theme, which once trasnlated form SPANISH to ENGLISH the backslashes are removed turning the code useless.

Also, before finding this issue, I had to add again the <script></script> tags to jQuery code because they were removed once the page was translated, converting the code into text showed in the page.

I look forward to your instructions to solve this problem.

Thanks

August 12, 2019 at 9:32 am #4379687

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

Thank you for reaching out the WPML support!

Since you want to have the same code inside this module, I think that we can try to make the content to be copied to the translation and see how things work this time. In order to do this, I'll need access to the dashboard area of the website so I can check the structure of the module and create a custom XML configuration. Could you provide me the username and password, please?

The next reply is set to be private so you can safely send me the credentials.

Thanks,
Radu

August 13, 2019 at 8:59 pm #4390769

alejandroM-32

Hi Radu,

I need to ask you for an email address in order to configure a new user to give you temporary access to the site.

Thanks.

August 14, 2019 at 6:20 am #4392607

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

I set the next reply to be private so you can safely send me the credentials. This way, only you and I will be able to see them.

Thanks,
Radu

August 19, 2019 at 11:24 am #4415537

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

Thank you for sending me the credentials for the admin area.

Can you send me a link to the page where I can see the Code Module, please? I edited a few pages but I couldn't see the code mentioned in your first message.

Thanks,
Radu

August 19, 2019 at 8:44 pm #4419123

alejandroM-32

Hi Radu,

The Code Module is in hidden link (Spanish page), hidden link (English translated page). The module class is et_pb_module et_pb_code et_pb_code_1.

Actually it is not show when you are editing/translating the page but it is being modified in the process.

Attached you can find two images of the part of code that is being modified (before an after tanslating) obtained through pages inspection.

Regards.

August 21, 2019 at 7:34 am #4428597

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

I tried to have a look at the English version of the homepage (hidden link) but I'm getting redirected to the Spanish version. Also, I could see that the translation in English was done using the classic editor of WordPress. In this case, you should be able to edit the code module as you did in the original language. Can you tell me if this is a change you made lately on your website, please?

Also, how can I have a look at the code module? I tried to edit the homepage using Divi editor (hidden link) but I cannot see the code module.

Thanks,
Radu

August 21, 2019 at 3:39 pm #4433323

alejandroM-32

Hi Radu,

The URL of the English version of the page is (hidden link) and the Spanish one is (hidden link). There shouldn't be applied any redirections.
Please note that your're trying (hidden link) instead.

Once logged in, you can access to DIVI's editor in each page through the following links:

Spanish page: hidden link

English page: hidden link

Attahched you can find images from the code modules in each page and the code scripts.

Please let me know if anything else is needed.

Regards.

Code Module Scripts

Spanish page:


<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="<em><u>hidden link</u></em>"></script>
<script src="<em><u>hidden link</u></em>"></script>

<script>
jQuery(document).ready(function(){
  jQuery(".eventos_modulo li").show();
  jQuery(".inputbox").val('').blur();
  function toValidDate(datestring){
  return datestring.replace(/(\\d{2})(\\/)(\\d{2})/, "$3$2$1");
  };
 
  jQuery("#fechaInicio").datepicker({dateFormat: 'dd/mm/yy'});
  jQuery("#fechaFin").datepicker({dateFormat: 'dd/mm/yy'});  

  var idModulo = ["#training-proximos-modulo.eventos_modulo li","#training-anteriores-modulo.eventos_modulo li"];
  var idSinRes = ["#sin-resultados-prox","#sin-resultados-ant"];

  var pos = [0,1];


  jQuery(".boton_buscar").on("click", function() {  

    var buscarMarca = jQuery("#inputMarca").val().toLowerCase();
    var buscarTitulo = jQuery("#inputTitulo").val().toLowerCase();    
    var buscarPais = jQuery("#inputPais").val().toLowerCase();

    var buscarFechaInicioStr = jQuery("#fechaInicio").datepicker({dateFormat: 'dd/mm/yy'}).val();   
    var buscarFechaFinStr = jQuery("#fechaFin").datepicker({dateFormat: 'dd/mm/yy'}).val();
    
    var hayFechaInicio = jQuery("#fechaInicio").val().length;
    var hayFechaFin = jQuery("#fechaFin").val().length;
 
    var buscarFechaInicio = new Date(toValidDate(buscarFechaInicioStr)); 
    var buscarFechaFin = new Date(toValidDate(buscarFechaFinStr));
    
    if (buscarFechaFin < buscarFechaInicio){
      alert("¡La fecha de FIN no puede anterior a la de INICIO!");
      return;
    }

    var hayRespuestas = 0;
    jQuery(".sin_resultados").hide();
    
    jQuery(pos).each(function(i, val) {

    var hayRespuestas = 0;  


    if ((hayFechaInicio == 0 && hayFechaFin == 0) || buscarFechaFin >= buscarFechaInicio){

      jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && hayFechaInicio == 0 && hayFechaFin == 0){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha >= buscarFechaInicio && valorFecha <= buscarFechaFin){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });      
    }
    
    else if (hayFechaInicio > 0 && hayFechaFin == 0){
        
        jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha >= buscarFechaInicio){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });

    }

    else if (hayFechaInicio == 0 && hayFechaFin > 0){

      jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if(valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha <= buscarFechaFin) {

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });
    }

    else if (buscarFechaFin < buscarFechaInicio){

    }
   
    if (hayRespuestas == 0){
      jQuery(idSinRes[pos[i]]).show();
    }
    }); 
  });
  
  jQuery(".boton_limpiar").on("click", function() {
    jQuery(".eventos_modulo li").show();
    jQuery(".inputbox").val('').blur();
    jQuery(".sin_resultados").hide();    
  });
});

</script>

English page:


<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="<em><u>hidden link</u></em>"></script>
<script src="<em><u>hidden link</u></em>"></script>

<script>
jQuery(document).ready(function(){
  jQuery(".eventos_modulo li").show();
  jQuery(".inputbox").val('').blur();
  function toValidDate(datestring){
  return datestring.replace(/(d{2})(/)(d{2})/, "$3$2$1");
  };
 
  jQuery("#fechaInicio").datepicker({dateFormat: 'dd/mm/yy'});
  jQuery("#fechaFin").datepicker({dateFormat: 'dd/mm/yy'});  

  var idModulo = ["#training-proximos-modulo.eventos_modulo li","#training-anteriores-modulo.eventos_modulo li"];
  var idSinRes = ["#sin-resultados-prox","#sin-resultados-ant"];

  var pos = [0,1];


  jQuery(".boton_buscar").on("click", function() {  

    var buscarMarca = jQuery("#inputMarca").val().toLowerCase();
    var buscarTitulo = jQuery("#inputTitulo").val().toLowerCase();    
    var buscarPais = jQuery("#inputPais").val().toLowerCase();

    var buscarFechaInicioStr = jQuery("#fechaInicio").datepicker({dateFormat: 'dd/mm/yy'}).val();   
    var buscarFechaFinStr = jQuery("#fechaFin").datepicker({dateFormat: 'dd/mm/yy'}).val();
    
    var hayFechaInicio = jQuery("#fechaInicio").val().length;
    var hayFechaFin = jQuery("#fechaFin").val().length;
 
    var buscarFechaInicio = new Date(toValidDate(buscarFechaInicioStr)); 
    var buscarFechaFin = new Date(toValidDate(buscarFechaFinStr));
    
    if (buscarFechaFin < buscarFechaInicio){
      alert("¡La fecha de FIN no puede anterior a la de INICIO!");
      return;
    }

    var hayRespuestas = 0;
    jQuery(".sin_resultados").hide();
    
    jQuery(pos).each(function(i, val) {

    var hayRespuestas = 0;  


    if ((hayFechaInicio == 0 && hayFechaFin == 0) || buscarFechaFin >= buscarFechaInicio){

      jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && hayFechaInicio == 0 && hayFechaFin == 0){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha >= buscarFechaInicio && valorFecha <= buscarFechaFin){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });      
    }
    
    else if (hayFechaInicio > 0 && hayFechaFin == 0){
        
        jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if (valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha >= buscarFechaInicio){

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });

    }

    else if (hayFechaInicio == 0 && hayFechaFin > 0){

      jQuery(idModulo[pos[i]]).each(function() {  

        var valorMarca = jQuery(".evento_marca",this).text().toLowerCase().indexOf(buscarMarca);
        var valorTitulo = jQuery(".evento_titulo_nombre",this).text().toLowerCase().indexOf(buscarTitulo);
        var valorPais = jQuery(".evento_pais",this).text().toLowerCase().indexOf(buscarPais);

        var valorFechaStr = jQuery(".fecha_curso",this).text();
        var valorFecha = new Date(toValidDate(valorFechaStr));
      
        if(valorPais > -1 && valorTitulo > -1 && valorMarca > -1 && valorFecha <= buscarFechaFin) {

          jQuery(this).show();
          hayRespuestas = hayRespuestas + 1;
        }
        else{
          jQuery(this).hide();
        }
      
      });
    }

    else if (buscarFechaFin < buscarFechaInicio){

    }
   
    if (hayRespuestas == 0){
      jQuery(idSinRes[pos[i]]).show();
    }
    }); 
  });
  
  jQuery(".boton_limpiar").on("click", function() {
    jQuery(".eventos_modulo li").show();
    jQuery(".inputbox").val('').blur();
    jQuery(".sin_resultados").hide();    
  });
});

</script>

August 24, 2019 at 11:35 am #4451553

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

I made a test on a clean install and added the code to the English page (hidden link) and French one (hidden link). I added the same code to both pages and the backslashes are not removed from the translated page (French). Can you have a look and tell me if things are working as expected on the sandbox links I send to you, please?

Thanks,
Radu

August 26, 2019 at 2:19 pm #4459623

alejandroM-32

Hi,

It looks that that works ok in your sandbox.

Did you have debug it in our site, because there is not working.

After translating the page and detecting the problem we mannually add the backslashes in the code and saved the changes, but somehow they are not beeing implemeneted or are being reversed.

Please would you mind having a look on what may be happening there?

Regards.

August 27, 2019 at 11:44 am #4465973

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

Can you try to delete the translation of the homepage, set the Use WPML's Translation Editor option to Off, and create again the translation using the default editor, please? Just give this a try and tell me how things work this time. I'm thinking that maybe this will make a difference.

Thanks,
Rad

August 27, 2019 at 6:21 pm #4469015

alejandroM-32

You mean the Homepage or the page with the problem (Training)?

August 28, 2019 at 4:46 am #4471137

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Alejandro,

Sorry, I meant the Training page. That's the one where the code module is available, and that's the place where you can try to create the translation again as I explained in my previous message.

Thanks,
Radu

September 4, 2019 at 6:56 pm #4513733

alejandroM-32

Hi Radu,

I've deleted the translation of the Training page and made a new translation to English twice, turning off the WPML switch and using the default editor (+Divi Editor). The first time, I chose the option to copy the original (Spanish) content and the second time, I chose the option to replace with the original content.
Both times the backslashes where removed by the process of creating the English page carried out by WPML. Both times, after that I edited by myself the code adding the backslashes to it but no matter how many times I repeat it, after saving the page from DIVI's editor the added backslashes keep on disappearing...

Also, I found another proble, and this time not related with the Training Page but to the Global Footer Section (DIVI Global Layout), once this layout is translated to English it replaces the text of the Spanish version with the English translation.
Please would you mind also checking this issue.

We're very hurry to launch the site, so I would like to ask if you can give an expedited treatment.

Thanks

September 6, 2019 at 8:29 pm #4527295

alejandroM-32

Hi Radu,
I have to tell you that another issue was found. In this case it seems to be something related with css code that appeared on the hom page.

Home - USA - ES (hidden link) CSS Ok.

Home - USA - EN (hidden link) CSS modified.

Attached you can find the images shown the modification that appeared after WPML translation was made.

I expect hearing good news soon.

Regards

The topic ‘[Closed] WPML removes backslashes’ is closed to new replies.