Jump to content

Translate blog post dates

Recommended Posts

Is this on the individual blog posts like https://www.mom-me.dk/blog/blog-post-title-four-r3kyz?

 

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
On 11/8/2021 at 4:28 PM, MomMe said:

It should be on all blog posts, also future ones.

Try adding to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
  const translate = {
    Jan: "New Jan",
    	Feb: "New Feb",
    	Mar: "New Mar",
    	Apr: "New Apr",
    	May: "New May",
    	Jun: "New Jun",
    	Jul: "New Jul",
    	Aug: "New Aug",
    	Sep: "New Sep",
    	Oct: "New Oct",
    	Nov: "New Nov",
    	Dec: "New Dec"
}
const translate1 = {
    	January: "New Januanry",
    	February: "New February",
    	March: "New March",
    	April: "New April",
    	May: "New May",
    	June: "New June",
    	July: "New July",
    	August: "New August",
    	September: "New September",
    	October: "New October",
    	November: "New November",
    	December: "New December"
}
const day = {
    
    Monday: "New Monday",
    Tuesday: "New Tuesday",
    Wednesday: "New Wednesday",
    Thursday: "New Thursday",
    Friday: "New Friday",
    Saturday: "New Saturday",
    Sunday: "New Sunday"
}
$(document).ready(function() {
 $('time.blog-meta-item--date span').each(function(i, e) {
     const text = $(e).html()
     $(e).html(translate[text])
 })
 
})
S.fn.init [document]
const translate = {
    Jan: "New Jan",
    	Feb: "New Feb",
    	Mar: "New Mar",
    	Apr: "New Apr",
    	May: "New May",
    	Jun: "New Jun",
    	Jul: "New Jul",
    	Aug: "New Aug",
    	Sep: "New Sep",
    	Oct: "New Oct",
    	Nov: "New Nov",
    	Dec: "New Dec"
}
const translate1 = {
    	January: "New Januanry",
    	February: "New February",
    	March: "New March",
    	April: "New April",
    	May: "New May",
    	June: "New June",
    	July: "New July",
    	August: "New August",
    	September: "New September",
    	October: "New October",
    	November: "New November",
    	December: "New December"
}
const day = {
    
    Monday: "New Monday",
    Tuesday: "New Tuesday",
    Wednesday: "New Wednesday",
    Thursday: "New Thursday",
    Friday: "New Friday",
    Saturday: "New Saturday",
    Sunday: "New Sunday"
}
$(document).ready(function() {
 $('time.blog-meta-item--date span').each(function(i, e) {
     const text = $(e).html()
     $(e).html(translate[text])
 })
 $('time.blog-meta-item--date span').each(function(i, e) {
     let text = $(e).html()
     for(let key in translate) {
         text = text.replace(key, translate[key])
     }
     for(let key in day) {
         text = text.replace(key, day[key])
     }
     console.log(text)
     $(e).html(text)
 })
})
</script>

 

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 weeks later...
7 hours ago, MomMe said:

If it can be solved, then yes. I will prefer the date to be there but not in english 😉

Try to enable again we can suggest using Intl API for dateformat

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
2 hours ago, MomMe said:

It's enabled again 😉 

What language and date format

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
4 hours ago, MomMe said:

It's enabled again 😉 

Is it correct

image.png.09c53416c0fc350bf5e91ba316f74186.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

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.