fbpx
Skip to content
Questions & AnswersHow to translate "From" or "Back to" or in the form "First Name", "Last Name" in Squarespace?
Martynas asked 8 years ago
Here is my website http://www.marlione.com/werbegeschenke/geschenksets/tee-geschenk-set and I want to translae it to German language. There are words which I can not translate in to German, there is not possibility to do that in Squarespace. I guees I have to put some kind of code there for that? Could you help me please with this issue. Thank you.  
Martynas replied 8 years ago

Can someone reply to my question?

3 Answers
Dave Hilditch Staff answered 8 years ago

Yes – if you visit the support page there is an extra script for translating the hard-coded texts in your SquareSpace template.
If there are any texts missing, you can duplicate the final line of the code – read the comments in the code – it explains what to do – and then you can translate any template text.

Martynas replied 8 years ago

Thanks, I will look in to it.

Martynas replied 8 years ago

Dave, I did everything what was written and nothing is translated. Could you please check where the problem is?

Martynas replied 8 years ago

My 0 language is english and 1 language is german. Did I missed something here? I do not getting translations from english to german.

function replaceSquarespaceText() {
if (readCookie(‘language’) != ”) {
currentlanguage=readCookie(‘language’);
} else {
currentlanguage = 0;
}
// depending on which language is your default language, you need to make an adjustment here
if (currentlanguage == 1) { // **** If the default language is not English, change this number to reflect the position where English occurs in your Language selector. This is zero-based – that means start counting from zero. E.g. if you have 3 languages in this order: German, English, French then change German is 0, English is 1 and French is 2 so change the 0 to 1
console.log(‘nothing to translate because language 0 chosen – change to language 1 and this will do something’);
return;
}

if (currentlanguage == 1) { // in the language selector, language 0 = first language, language 1 = second language – with this default example, language 1 is French. Copy this entire code block and repeat with language == 2 or language == 3 if you have more than 2 languages

Martynas replied 8 years ago

Hi, Dave, what do I have to do to get a reply to my question? I have launched a website which is not properly translated in to german language and how I will impress now german customers with the “almost finished” website?

Dave Hilditch replied 8 years ago

Hi – I’m not clear on what is going wrong here? Did you enter the german text into the squarespace translations file and then paste it into code injection?

Martynas replied 8 years ago

Yes, I did this. I didn’t translate everything, because there are words that I am not using. But at the end I put a translation of ‘from’ to ‘ab’ and nothing happened. Same with ‘First name’ and ‘Last name’. I am not a programmer so maybe I did something wrong there. Here is all code:



function replaceSquarespaceText() {
if (readCookie(‘language’) != ”) {
currentlanguage=readCookie(‘language’);
} else {
currentlanguage = 0;
}
// depending on which language is your default language, you need to make an adjustment here
if (currentlanguage == 1) { // **** If the default language is not English, change this number to reflect the position where English occurs in your Language selector. This is zero-based – that means start counting from zero. E.g. if you have 3 languages in this order: German, English, French then change German is 0, English is 1 and French is 2 so change the 0 to 1
console.log(‘nothing to translate because language 0 chosen – change to language 1 and this will do something’);
return;
}

if (currentlanguage == 1) { // in the language selector, language 0 = first language, language 1 = second language – with this default example, language 1 is French. Copy this entire code block and repeat with language == 2 or language == 3 if you have more than 2 languages
jQuery(“li a”).filter(
function(index) {
if(jQuery(this).text() == ‘All’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘All’, ‘Alle’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“div.sale”).filter(
function(index) {
if(jQuery(this).text() == ‘sale’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘sale’, ‘Verkauf’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“div.custom-cart a”).filter(
function(index) {
if(jQuery(this).text().substring(0,4) == ‘Cart’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Cart’, ‘Panier’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“h2”).filter(
function(index) {
if(jQuery(this).text() == ‘Shopping Cart’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Shopping Cart’, ‘Votre Panier’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“div.checkout-button”).filter(
function(index) {
if(jQuery(this).text() == ‘CHECKOUT’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘CHECKOUT’, ‘VALIDER’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});

jQuery(“td”).filter(
function(index) {
if(jQuery(this).text() == ‘Item’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Item’, ‘Produit’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“td”).filter(
function(index) {
if(jQuery(this).text() == ‘Quantity’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Quantity’, ‘Quantité’)); // ****
TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“td”).filter(
function(index) {
if(jQuery(this).text() == ‘Price’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Price’, ‘Prix’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“div.quantity-label”).filter(
function(index) {
if(jQuery(this).text() == ‘Quantity:’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Quantity’, ‘Quantité’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});

jQuery(“div.sqs-add-to-cart-button-inner”).filter(
function(index) {
if(jQuery(this).text() == ‘Add To Cart’)
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Add To Cart’, ‘Ajouter Au Panier’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});

jQuery(“div.ss-social-button”).filter(
function(index) {
if(jQuery(this).text().indexOf(‘Share’) >= 0 )
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Share’, ‘Partager’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});

jQuery(“span.summary-header-text”).filter(
function(index) {
if(jQuery(this).text() == ‘Featured’ )
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Featured’, ‘Featured’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});
jQuery(“span.label”).filter(
function(index) {
if(jQuery(this).text() == ‘Subtotal’ )
return true;
else
return false;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(‘Subtotal’, ‘Total’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
});

jQuery(“input.search-input”).each(function() {
jQuery(this).attr(‘placeholder’, ‘Rechercher’);
});

jQuery(“.caption,.pagination,.tags-cats,.excerpt,.sqs-comment-link.sqs-disqus-comment-link,.post-meta.author-date,label”).filter(
function(index) {
if(String(jQuery(this).text()).indexOf(‘///’) > -1 ) {
return false;
}
if (String(jQuery(this).html()).indexOf(‘[[‘) > -1 ) {
return false;
}
if (String(jQuery(this).html()).indexOf(‘]]’) > -1 ) {
return false;
}
if (String(jQuery(this).html()).indexOf(‘ -1) {
return false;
}
if (String(jQuery(this).html()).indexOf(‘ -1) {
return false;
}
if (String(jQuery(this).html()).indexOf(‘sqs-gallery’) > -1) {
return false;
}
return true;
}
).each(function() {
jQuery(this).html(jQuery(this).html().replace(/First Name/ig, “Vorname”)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(this).html(jQuery(this).html().replace(/Last Name/ig, “Nachname”)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(this).html(jQuery(this).html().replace(/Newer/ig, “Neu”)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(this).html(jQuery(this).html().replace(/Older/ig, “Älter); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(this).html(jQuery(this).html().replace(/tags/ig, “tags”)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****

});
jQuery(‘.newsletter-form-field-element.field-control input[type=text]’).attr(‘placeholder’, ‘imiex’); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/January/ig, “Janvier”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/February/ig, “Fevrier”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/March/ig, “Mars”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/April/ig, “Avril”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/May/ig, “Mai”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/June/ig, “Juin”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/July/ig, “Juillet”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/August/ig, “Août”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/September/ig, “Septembre”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/October/ig, “Octobre”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/November/ig, “Novembre”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/December/ig, “Decembre”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Monday/ig, “Lundi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Tuesday/ig, “Mardi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Wednesday/ig, “Mercredi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Thursday/ig, “Jeudi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Friday/ig, “Vendredi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Saturday/ig, “Samedi”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘a,time’).replaceText(/Sunday/ig, “Dimanche”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/jan/gi, “Janv”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/feb/gi, “Févr”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/mar/gi, “Mars”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/apr/gi, “Avr”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/may/gi, “Mai”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/jun/gi, “Juin”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/jul/gi, “Juil”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/aug/gi, “Aout”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/sep/gi, “Sept”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/oct/gi, “Oct”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/nov/gi, “Nov”);
jQuery(‘div.eventlist-datetag-startdate–month’).replaceText(/dec/gi, “Déc”);
jQuery(‘span’).replaceText(/Share/gi, “Teilen”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/Preview/gi, “Vorschau”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/Likes/gi, “Likes”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/item/gi, “Artikel”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/Comments /gi, “Les commentaires “); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ***
jQuery(‘span’).replaceText(/Newest First/gi, “Sujet plus récent”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/back to /gi, “Zurück zu”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span’).replaceText(/Post Comment/g, “Poster un commentaire”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘.sqs-widgets-confirmation-content .title’).replaceText(/Enter Comment Text/g, “Ecrire un commentaire texte”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘.sqs-widgets-confirmation-content .message’).replaceText(/Enter text in the field above to post a comment./g, “Entrez le texte dans le champ ci-dessus pour poster un commentaire.”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘.form-inner-wrapper .field-error’).replaceText(/Your form has encountered a problem. Please scroll down to review./g, “Votre forme a rencontré un problème . S’il vous plaît faites défiler à commenter .”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘.field-error’).replaceText(/ is required./gi, ‘ est requis.’); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘form-item field email required error’).replaceText(/Email is not valid. Email addresses should follow the format [email protected]./gi, “Email ist ungültig. E-Mail -Adressen sollten das Format folgen [email protected].”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘.form-inner-wrapper:last-child .field-error’).replaceText(/Your form has encountered a problem. Please scroll up to review./gi, “Votre forme a rencontré un problème . S’il vous plaît faites défiler jusqu’à examiner .”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
jQuery(‘span.subscribe’).replaceText(/subscribe via e\-mail/gi, “abonner via email”); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****

jQuery(‘*’).replaceText(/Back to all events/gi, “Zurück zu allen Veranstaltungen”);
jQuery(‘*’).replaceText(/Earlier event/gi, “Frühere Veranstaltung”);
jQuery(‘*’).replaceText(/Back to all events/gi, “Zurück zu allen Veranstaltungen”);
jQuery(‘*’).replaceText(/Back to top/gi, ”
Zurück nach oben”);

// document.write(‘.entry-more-link a:before { content:”Poursuivre la lecture”!important;}’);
// document.write(‘.summary-read-more-link:after { content:”Poursuivre la lecture \2192″!important;}’);

//if you need to translate more hard-coded text from your specific theme, copy the following line as many times as you like:jQuery(‘*’).replaceText(escapeRegExp(“Enter hardcoded text to translate here”), “Enter translation here”);

jQuery(‘*’).replaceText(escapeRegExp(“from”), “ab”);

answered 8 years ago

Hello Martynas, 
I’ll turn Dave’s attention to this asap and make sure your issue is resolved within a day. I’ll get back to you very soon.

Dave Hilditch Staff answered 8 years ago

Hi – I’m seeing an error in your code.
The line which runs as follows:
jQuery(this).html(jQuery(this).html().replace(‘Quantity’, ‘Quantité’));
At the end of this line is a comment, but that comment has been moved to the next line somehow so in your case it reads:
 
jQuery(this).html(jQuery(this).html().replace(‘Quantity’, ‘Quantité’)); // ****
TRANSLATE THIS TEXT TO YOUR LANGUAGE ****
Please amend this so it is on one line as follows:
jQuery(this).html(jQuery(this).html().replace(‘Quantity’, ‘Quantité’)); // **** TRANSLATE THIS TEXT TO YOUR LANGUAGE ****

Martynas replied 8 years ago

I did that but nothing has changed.

We use cookies

We use cookies for various things on our site, including our on-site chat bubble (if you use it), our comment forms (if you use them) and for session handling (if you log in).

Other than that, we use cookies to identify where traffic came from to help us understand which traffic turns into sales, we use a cookie for Google Analytics traffic analysis and we use a cookie to customise adverts for our own products we think you'll be interested in.

You can read more detail in our privacy policy page. Please click 'Accept' or 'Decline' to continue.