Jump to content

How can I change the language of hour & minute captions in forms?

Recommended Posts

Site URL: https://www.dlopezlaw.com/es/comunicacion

I am creating a multilingual site and have managed to do everything I need it to do except changing the time caption (Hour and Minute to Hora and Minuto) on the contact form on the Spanish version. I was able to follow a previous question to change the first name and last name caption but can't figure out how to do the same for the Hour and Minute (I am hiding the second option). 

Link to comment
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Add to Page Settings > Advanced > Header

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
jQuery(function($){
    $(".field.hour.two-digits input").html(function() { 
          return $(this).html().replace("Hour", "new hour text");  
    });
      $(".field.minute.two-digits input").html(function() { 
          return $(this).html().replace("Minute", "minute new text");  
    });
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Thank you! I tried to add it to the code I already had in there for the first name and last name translation and it is not working. Any thoughts? Here is what I currently have:

 

<script>
function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
   window.onload = func;
 } else {
   window.onload = function() {
     if (oldonload) {
       oldonload();
     }
     func();
   }
 }

addLoadEvent(function() {  
 sqsFirstName = document.getElementsByClassName("caption")[0].innerHTML;
 myFirstName = sqsFirstName.replace("First Name", "Primer nombre");
 document.getElementsByClassName("caption")[0].innerHTML = myFirstName;

 sqsLastName = document.getElementsByClassName("caption")[1].innerHTML;
 myLastName = sqsLastName.replace("Last Name", "Apellido");
 document.getElementsByClassName("caption")[1].innerHTML = myLastName;
  
});

</script>

Link to comment
1 hour ago, Rosie33 said:

Added it back and I still don't see a change. Thanks in advance for your help.

Remove code I sent and use this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
jQuery(function($){
    $(".field.hour.two-digits .caption").html(function() { 
          return $(this).html().replace("Hour", "new hour text");  
    });
      $(".field.minute.two-digits .caption").html(function() { 
          return $(this).html().replace("Minute", "minute new text");  
    });
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.