WordPress.org

Ready to get started?Download WordPress

Forums

GTranslate CODE in HEADER (2 posts)

  1. nis4
    Member
    Posted 2 years ago #

    Hi.

    What .php code should i include in header.php to add GTRANSLATE in header?

    I don't have good widget places for gtranslate on frontpage, so i would like to integrate it in the header.

    I know css and html, but don't know what .php code should i include.

    Let's say languages , english and italian.

    Hope that somone can help me out.

    Big thanks.

  2. junedvandersar
    Member
    Posted 2 years ago #

    Try the code below
    first change YOUR-DOMAIN in src parameter with your domain.

    <!-- start #gtranslate -->
    <a class="gflag" style="background-position:-0px -0px;" title="English" href="javascript:doGTranslate('en|en')">
    <img width="16" height="16" alt="English" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-200px -100px;" title="French" href="javascript:doGTranslate('en|fr')">
    <img width="16" height="16" alt="French" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-300px -100px;" title="German" href="javascript:doGTranslate('en|de')">
    <img width="16" height="16" alt="German" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-600px -100px;" title="Italian" href="javascript:doGTranslate('en|it')">
    <img width="16" height="16" alt="Italian" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-300px -200px;" title="Portuguese" href="javascript:doGTranslate('en|pt')">
    <img width="16" height="16" alt="Portuguese" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-500px -200px;" title="Russian" href="javascript:doGTranslate('en|ru')">
    <img width="16" height="16" alt="Russian" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <a class="gflag" style="background-position:-600px -200px;" title="Spanish" href="javascript:doGTranslate('en|es')">
    <img width="16" height="16" alt="Spanish" src="http://YOUR-DOMAIN/wp-content/plugins/gtranslate/blank.png">
    </a>
    <br>
    <select onchange="doGTranslate(this);">
    <option value="">Select Language</option>
    <option value="en|af">Afrikaans</option>
    <option value="en|sq">Albanian</option>
    <option value="en|ar">Arabic</option>
    <option value="en|hy">Armenian</option>
    <option value="en|az">Azerbaijani</option>
    <option value="en|eu">Basque</option>
    <option value="en|be">Belarusian</option>
    <option value="en|bg">Bulgarian</option>
    <option value="en|ca">Catalan</option>
    <option value="en|zh-CN">Chinese (Simplified)</option>
    <option value="en|zh-TW">Chinese (Traditional)</option>
    <option value="en|hr">Croatian</option>
    <option value="en|cs">Czech</option>
    <option value="en|da">Danish</option>
    <option value="en|nl">Dutch</option>
    <option value="en|en">English</option>
    <option value="en|et">Estonian</option>
    <option value="en|tl">Filipino</option>
    <option value="en|fi">Finnish</option>
    <option value="en|fr">French</option>
    <option value="en|gl">Galician</option>
    <option value="en|ka">Georgian</option>
    <option value="en|de">German</option>
    <option value="en|el">Greek</option>
    <option value="en|ht">Haitian Creole</option>
    <option value="en|iw">Hebrew</option>
    <option value="en|hi">Hindi</option>
    <option value="en|hu">Hungarian</option>
    <option value="en|is">Icelandic</option>
    <option value="en|id">Indonesian</option>
    <option value="en|ga">Irish</option>
    <option value="en|it">Italian</option>
    <option value="en|ja">Japanese</option>
    <option value="en|ko">Korean</option>
    <option value="en|lv">Latvian</option>
    <option value="en|lt">Lithuanian</option>
    <option value="en|mk">Macedonian</option>
    <option value="en|ms">Malay</option>
    <option value="en|mt">Maltese</option>
    <option value="en|no">Norwegian</option>
    <option value="en|fa">Persian</option>
    <option value="en|pl">Polish</option>
    <option value="en|pt">Portuguese</option>
    <option value="en|ro">Romanian</option>
    <option value="en|ru">Russian</option>
    <option value="en|sr">Serbian</option>
    <option value="en|sk">Slovak</option>
    <option value="en|sl">Slovenian</option>
    <option value="en|es">Spanish</option>
    <option value="en|sw">Swahili</option>
    <option value="en|sv">Swedish</option>
    <option value="en|th">Thai</option>
    <option value="en|tr">Turkish</option>
    <option value="en|uk">Ukrainian</option>
    <option value="en|ur">Urdu</option>
    <option value="en|vi">Vietnamese</option>
    <option value="en|cy">Welsh</option>
    <option value="en|yi">Yiddish</option>
    </select>
    <script type="text/javascript">
    //<![CDATA[
    if(jQuery.cookie('glang') && jQuery.cookie('glang') != 'en') jQuery(function($){$('body').translate('en', $.cookie('glang'), {toggle:true, not:'.notranslate'});});
    function doGTranslate(lang_pair) {if(lang_pair.value)lang_pair=lang_pair.value;var lang=lang_pair.split('|')[1];jQuery.cookie('glang', lang, {path: '/'});jQuery(function($){$('body').translate('en', lang, {toggle:true, not:'.notranslate'});});}
    //]]>
    </script>
    <noscript>Javascript is required to use this <a href="http://edo.webmaster.am/gtranslate">website translator</a>, <a href="http://edo.webmaster.am/gtranslate">site translator</a>, <a href="http://edo.webmaster.am/gtranslate">automatic translation</a>, <a href="http://edo.webmaster.am/gtranslate">free translation</a></noscript>
    <!-- end #gtranslate -->

Topic Closed

This topic has been closed to new replies.

About this Topic