1

Topic: Google Translation PLUGIN

Google Translation PLUGIN

what does this plugin do?

This plugin adds Googles website translator to Wolf CMS.


to do:

1. Go to settings, set your language and check "multilingual", if you have a multilingual website.
2. Implement the following code wheresoever you want (for example in your sidebar or your layout):

<?php google_translation(); ?>

3. That's it!


example:

http://www.marozi.de/?google_translation.html


version history:

1.0.0:
* see description
http://dl.dropbox.com/u/3561648/WolfCMS … /1.0.0.zip


get the latest version:

http://dl.dropbox.com/u/3561648/WolfCMS … latest.zip

Last edited by razon (2010-10-25 08:25)

Thumbs up

2

Re: Google Translation PLUGIN

That's kind of funky, razon! Thanks!

Using Wolf CMS professionally and for profit? Please consider supporting Wolf financially. Thanks!

Re: Google Translation PLUGIN

Very nice indeed!

4

Re: Google Translation PLUGIN

I'm currently working on another version of this plugin.
In the new version the plugin will use Googles AJAX Translation API... but I'm still having problems to translate more than the allowed number of chars...
This new version will also save the choosen language in users cookies.

If you'd like to help, the following function shall translate a given id (e.g. <div id="x">Hello World</div>):

        echo "function translate_id(elemid) {
            var source=document.getElementById(elemid).innerHTML;
            document.getElementById(elemid).innerHTML=\"\";
            for(i=0;i<source.length;i+=500) {
                google.language.translate(source.substr(i, 500), \"".$mainlang."\", \"".$_COOKIE["lang"]."\", function(result) {
                    var translated = document.getElementById(elemid);
                    if(!result.error) translated.innerHTML+=result.translation;
                });
            }
        }";

To do:
Splitting "source" in an array, so that you'll get the following array for the given example:
array('<div id="x">','Hello World','</div>')
This has to be applicable for every HTML-Code.

Last edited by razon (2010-10-25 17:29)

Thumbs up