Jump to content

Month in Calendar Not Translating When Language Changed

Go to solution Solved by paul2009,

Recommended Posts

Site URL: https://cahcal-fr.squarespace.com/

I'm having difficulty with translating the month in my calendar on my website. I've changed the language setting in the navigation, which translated majority of the website to French, however, it did not translate the month on my calendar page. Does anyone know how I can fix this? Any help would be greatly appreciated!

Calendar Page: https://cahcal-fr.squarespace.com/calendrier

Pass: cahcal

Link to comment
12 minutes ago, andysuchann said:

Site URL: https://cahcal-fr.squarespace.com/

I'm having difficulty with translating the month in my calendar on my website. I've changed the language setting in the navigation, which translated majority of the website to French, however, it did not translate the month on my calendar page. Does anyone know how I can fix this? Any help would be greatly appreciated!

Calendar Page: https://cahcal-fr.squarespace.com/calendrier

Pass: cahcal

Hi It's possible , will you please let us know on what plan of squares pace you are using personal or business? 

Link to comment
4 minutes ago, humxahafeex said:

Awesome let me try to do a code for it and post it here in a while. 

Thanks so much - really appreciate! I'm looking to translate the months to French so they would be:

  • janvier - January
  • février - February
  • mars - March
  • avril - April
  • mai - May
  • juin - June
  • juillet - July
  • aout - August
  • septembre -September
  • octobre - October
  • novembre - November
  • décembre - December
Link to comment

Hi Here's is the Code on how you can achieve this , Just copy and paste the code in Code Injection you , Simply go to Settings> Advanced> Code Injection

In HEADER part add the following code: 

<script src = "https://code.jquery.com/jquery-2.2.4.min.js" ></script>

In FOOTER part add the following code:

<script>
 function translate(){
   $(".yui3-calendar-header-label").text(function(){
            var month = $(this).text();
            month = month.toString();
            for (var i=0;i<12;i++) {
              if (month.includes(arr_month_english[i])){ return $(this).text().replace(arr_month_english[i], arr_month_trans[i]);}
            }
        });  }
 const arr_month_trans = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre"];
 const arr_month_english = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  $(document).ready(function() {
    setTimeout(translate, 2000);
     $(document).on('click','.yui3-calendarnav-prevmonth',function(){translate();}); 
    $(document).on('click','.yui3-calendarnav-nextmonth',function(){translate();}); 
  });

</script>

It's DONE, Enjoy , Do Mark it solved if it works for you 🙂

 

Hey, If my solution helped you don't hesitate to Buy me a coffee : https://www.buymeacoffee.com/hamxahafeex

Link to comment

tHIS

14 hours ago, humxahafeex said:

Hi Here's is the Code on how you can achieve this , Just copy and paste the code in Code Injection you , Simply go to Settings> Advanced> Code Injection

In HEADER part add the following code: 

<script src = "https://code.jquery.com/jquery-2.2.4.min.js" ></script>

In FOOTER part add the following code:

<script>
 function translate(){
   $(".yui3-calendar-header-label").text(function(){
            var month = $(this).text();
            month = month.toString();
            for (var i=0;i<12;i++) {
              if (month.includes(arr_month_english[i])){ return $(this).text().replace(arr_month_english[i], arr_month_trans[i]);}
            }
        });  }
 const arr_month_trans = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre"];
 const arr_month_english = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  $(document).ready(function() {
    setTimeout(translate, 2000);
     $(document).on('click','.yui3-calendarnav-prevmonth',function(){translate();}); 
    $(document).on('click','.yui3-calendarnav-nextmonth',function(){translate();}); 
  });

</script>

It's DONE, Enjoy , Do Mark it solved if it works for you 🙂

 

Hey, If my solution helped you don't hesitate to Buy me a coffee : https://www.buymeacoffee.com/hamxahafeex

This worked, you're the best - thanks so much!

Link to comment
  • Solution
23 hours ago, andysuchann said:

I've changed the language setting in the navigation, which translated majority of the website to French, however, it did not translate the month on my calendar page.

@andysuchann This should not happen and should not require custom code to fix. Squarespace have confirmed that this is caused by an issue with calendar dates on their end. It has been reported to their Engineering team, and they’re currently prioritizing the issue so that it can be fixed. 

 

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

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.