[SOLVED] Add Google Translate to page?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am
Location: Georgia

[SOLVED] Add Google Translate to page?

Post by michaywood »

Hello CMSMSers,

I have seen there is a MLE version of CMSMS but I'm not totally comprehending how it functions (having to create duplicates of every page in every language you want?)

I simply want to use Google Translate, so I don't have to do any translating myself, but people can select what language is suitable for them.

IF SOMEONE HAS A BETTER/ SIMPLER IDEA, LET ME KNOW!!!

I know the translations won't be perfect, but it will be better than nothing. From using the Google Translate Tools & Resources page, Google gives me the code:

Code: Select all

<div id="google_translate_element"></div><__script__>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en',
    includedLanguages: 'es'
  }, 'google_translate_element');
}
</__script><__script__ src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></__script>
So, after my tag, I merely past that code into my template. For testing purposes, I didn't put ANYTHING within the of my document except for the above code from Google. After saving, I open up the URL to view the page, and this error message is the only thing that is displayed on the page:

string(113) "Smarty error: [in tpl_body:23 line 4]: syntax error: unrecognized tag 'new' (Smarty_Compiler.class.php, line 590)"

What is the best way to go about fixing this? Would be nice to have a simple way to translate from one language to the next in an instant without me, the english-only speaking american, having to do any translating.

Cheers!
Last edited by michaywood on Thu May 27, 2010 2:36 pm, edited 1 time in total.
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am
Location: Georgia

Re: Add Google Translate to page?

Post by michaywood »

OR... is the Translation Manager module the best module for this?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Add Google Translate to page?

Post by Rolf »

Hi michaywood

Try to put {literal}{/literal} around the

grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
velvet_grooves
Forum Members
Forum Members
Posts: 54
Joined: Mon Oct 18, 2010 1:33 am

Re: [SOLVED] Add Google Translate to page?

Post by velvet_grooves »

Hi,

It would be great if I could work out how to use the translate feature, but I can't work this out, even with the help documentation.

I see people with different language buttons on their pages. How do I apply to this different languages, or even with Google Translate?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: [SOLVED] Add Google Translate to page?

Post by Rolf »

velvet_grooves wrote:I see people with different language buttons on their pages. How do I apply to this different languages
This is my way: http://forum.cmsmadesimple.org/viewtopi ... =4&t=48112 >>

Or Gorans: http://www.i-do-this.com/blog/25/Anothe ... CMSMS-Page >>
But there is more to find in the forum and Forge.

grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
velvet_grooves
Forum Members
Forum Members
Posts: 54
Joined: Mon Oct 18, 2010 1:33 am

Re: [SOLVED] Add Google Translate to page?

Post by velvet_grooves »

You're a life saver! Thanks! :D

Isn't there a CMS Made Simple book coming out soon full of tutorials?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: [SOLVED] Add Google Translate to page?

Post by Rolf »

velvet_grooves wrote:Isn't there a CMS Made Simple book coming out soon full of tutorials?
As far as I know there are two (e)books for sale.
Read http://www.cmsmadesimple.org/2010/03/10 ... ers-guide/
and Duketown has written a book

®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
velvet_grooves
Forum Members
Forum Members
Posts: 54
Joined: Mon Oct 18, 2010 1:33 am

Re: [SOLVED] Add Google Translate to page?

Post by velvet_grooves »

Yeah I got the 1.6 one, however, it needs updating ;) Found a few bits which were either out of date or didn't work.

Sure I read about a new book being written for about May time...
velvet_grooves
Forum Members
Forum Members
Posts: 54
Joined: Mon Oct 18, 2010 1:33 am

Re: [SOLVED] Add Google Translate to page?

Post by velvet_grooves »

I can't seem to work out a way of translating products in the products pages. Any ideas how this might work? I managed to get your tutorial to work though.
Post Reply

Return to “Developers Discussion”