Streaming live at 10am (PST)

Translate placeholder text with Google Translate


#1

Hi there,

So I got a nice GTranslate widget on a site for a client of mine. But GTranslate is not translating the placeholder text of input fields. Who can help me with this?

I found this javascript code snippet. But i don’t know how to implement it on my website. https://stackoverflow.com/questions/20561611/google-translate-placeholder-text-in-input-type-text

This is the read only link: https://preview.webflow.com/preview/earz?preview=6428e9483a6f2eafc0638ffee257019a

The page with the input fields that need to be translated is: https://www.earz.eu/demo/docent

Who can help me with this?

Thanks in advance!


#2

As preceding answer, google translator does no longer translate placeholders
whilst googling, located this javascript answer and it does paintings
jsfiddle in here
// find all placeholders
var placeholders = report.querySelectorAll(‘input[placeholder]’);

if (placeholders.period) {
// convert to array
placeholders = Array.prototype.slice.name(placeholders);

// reproduction placeholder textual content to a hidden div
var div = $('');

placeholders.forEach(function(input){
  var text = input.placeholder;
  div.append('' + textual content + '');    
});

$('frame').append(div);

// save the primary placeholder in a closure
var originalPH = placeholders[0].placeholder;

// check for adjustments and update as needed
setInterval(feature(){
  if (isTranslated()) {
    updatePlaceholders();
    originalPH = placeholders[0].placeholder;
  }
}, 500);

// hoisted ---------------------------
characteristic isTranslated() { // actual if the textual content has been translated
   var currentPH = $($('#placeholders > div')[0]).textual content();
   return !(originalPH == currentPH);
}

feature updatePlaceholders() {
  $('#placeholders > div').every(characteristic(i, div){
    placeholders[i].placeholder = $(div).textual content();
  });
}

}

Also see this
best radr detector | Dolby atmos apk | TuTuApps | IPTV Kodi