Jump to content

How to show the original language after translating?

Recommended Posts

Site URL: https://sepia-mouse-arn5.squarespace.com/

Hi all,

I used some code I found on Google to translate my Dutch website to English (through a Google Translate widget). It works perfectly and it does translate my Dutch content to English. However, I wish to add an option in the list to switch back to the original language.  Could somebody please help me with that? 

Password: soulistic123

Code I used:

Javascript:

<script>
  var GoogleLanguages = 'en'
</script>

<div id="google_translate_element"></div>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'nl', includedLanguages: GoogleLanguages, layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false}, 'google_translate_element');
}
</script>
<script src="https://storage.googleapis.com/squarestylist/translate-style.js"></script>

 

Screenshot 2022-01-16 at 14.48.20.png

Link to comment
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

1 hour ago, StudioSoulistic said:

However, I wish to add an option in the list to switch back to the original language. 

You can add any languages you like!

Simply edit the first script that you posted to include other language codes, for example for English, Dutch and French:

<script> var GoogleLanguages = 'en,nl,fr'; </script>

 

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
1 hour ago, paul2009 said:

You can add any languages you like!

Simply edit the first script that you posted to include other language codes, for example for English, Dutch and French:

<script> var GoogleLanguages = 'en,nl,fr'; </script>

 

Hi Paul,

Thank you for your reply! I tried this too but when I switch from English back to Dutch, it doesn't show the "original Dutch content" but it actually translates the English content to incorrect Dutch. I also included some titles in English on my Dutch website, and those will also get translated to Dutch and I would like to keep them in English. So I'm trying to find a way to return from English to my own written, Dutch content. I hope that makes sense, haha. Unfortunately, I haven't found a solution yet!

Link to comment
12 minutes ago, StudioSoulistic said:

it actually translates the English content to incorrect Dutch

LOL. That's not helpful!

To be honest, I was posting from memory about the original Google implementation. I haven't seen the version you are using, but it looks like someone has tried to re-style the original Google version and in doing so they have hidden the Google translate bar. That bar normally contains the 'Show Original' link which removes the translation and puts everything back into the native language. 

 

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
1 hour ago, paul2009 said:

LOL. That's not helpful!

To be honest, I was posting from memory about the original Google implementation. I haven't seen the version you are using, but it looks like someone has tried to re-style the original Google version and in doing so they have hidden the Google translate bar. That bar normally contains the 'Show Original' link which removes the translation and puts everything back into the native language. 

 

I think it's a re-styled version indeed! Do you perhaps know where I can find the original version?:) I'll give that a try!

Edited by StudioSoulistic
Link to comment
On 1/16/2022 at 6:26 PM, StudioSoulistic said:

Do you perhaps know where I can find the original version?

You may find older articles describing workarounds, but the Google Translate widget was discontinued by Google in 2019 for new sites.

no-googletranslate.png.457b9b35a9dffc63b0b15d1e637807a3.png

 

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.