detect language (solved)

Popular automatic website translation tool

detect language (solved)

Postby [email protected] » Sat Mar 19, 2011 8:44 pm

is there a way that i can use auto detect language in the first visit for some languages? in my case, i need it for the tr language.
[email protected]
 
Posts: 23
Joined: Fri Jan 28, 2011 4:31 am

Re: detect language

Postby Edvard » Sat Mar 19, 2011 8:48 pm

Auto detect is not implemented. However you can add a rewrite rule in .htaccess to do that depending on the browser defined language. You can search for a solution in Google.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: detect language

Postby [email protected] » Sat Mar 19, 2011 9:17 pm

i tried that and it didn't work good, but i just read that this is implemented in drupal 7 core locale.

do you think i can use gtranslate properly on drupal 7? or should i be waiting for a drupal 7 gtranslate module??

PS: this is kinda important for me, i'm working on a site to go online with quite many nodes, i use pressflow version 6.20 now, and i'm thinking about switching to drupal 7 instead, all my modules have 7.0 versions except gtranslate, that's why i ask about it.
[email protected]
 
Posts: 23
Joined: Fri Jan 28, 2011 4:31 am

Re: detect language

Postby Edvard » Sat Mar 19, 2011 9:26 pm

For now you can use http://edo.webmaster.am/gtranslate-widget for Drupal 7 until I'll implement it for Drupal 7.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: detect language

Postby [email protected] » Sun Mar 20, 2011 1:16 am

i just set up a test drupal 7, used the widget inside a block as you've mentioned, but unfortunately this doesn't work at all? i had some errors about filters and the neither the dropdown nor flags do not change the website at all? i even used the -literal- coding to see if it's related with the theme (acqua marina) but still literally nothing happens.

when i check the language sub folders, the gtranslate script works quite ok? is there anything i have done wrong with the widget? i copy and paste the code below:


<!-- GTranslate: http://edo.webmaster.am/gtranslate -->
<a href="javascript:doGTranslate('en|en')" title="English" class="gflag" style="background-position:-0px -0px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="English" /></a><a href="javascript:doGTranslate('en|fr')" title="French" class="gflag" style="background-position:-200px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="French" /></a><a href="javascript:doGTranslate('en|de')" title="German" class="gflag" style="background-position:-300px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="German" /></a><a href="javascript:doGTranslate('en|el')" title="Greek" class="gflag" style="background-position:-400px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Greek" /></a><a href="javascript:doGTranslate('en|it')" title="Italian" class="gflag" style="background-position:-600px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Italian" /></a><a href="javascript:doGTranslate('en|pt')" title="Portuguese" class="gflag" style="background-position:-300px -200px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Portuguese" /></a><a href="javascript:doGTranslate('en|ru')" title="Russian" class="gflag" style="background-position:-500px -200px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Russian" /></a><a href="javascript:doGTranslate('en|es')" title="Spanish" class="gflag" style="background-position:-600px -200px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Spanish" /></a><a href="javascript:doGTranslate('en|tr')" title="Turkish" class="gflag" style="background-position:-100px -500px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="16" width="16" alt="Turkish" /></a>

<style type="text/css">
<!--
a.gflag {font-size:16px;padding:1px 0;background-repeat:no-repeat;background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/16.png');}
a.gflag img {border:0;}
a.gflag:hover {background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/16a.png');}
-->
</style>

<br /><select onchange="doGTranslate(this);"><option value="">Select Language</option><option value="en|af">Afrikaans</option><option value="en|ar">Arabic</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|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[
function doGTranslate(lang_pair) {if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];var plang=location.pathname.split('/')[1];if(plang.length !=2 && plang != 'zh-CN' && plang != 'zh-TW')plang='en';if(lang == 'en')location.href=location.protocol+'//'+location.host+location.pathname.replace('/'+plang, '')+location.search;else location.href=location.protocol+'//'+location.host+'/'+lang+location.pathname.replace('/'+plang, '')+location.search;}
//]]>
</script>
[email protected]
 
Posts: 23
Joined: Fri Jan 28, 2011 4:31 am


Re: detect language

Postby [email protected] » Sun Mar 20, 2011 2:55 am

i just got out the "CDATA" stuff, and everything's allrgiht now, don't know if that CDATA wass important or not, but it seems to work for me.

the only problem i have is, it refuses to switch between english and turkish correctly...
[email protected]
 
Posts: 23
Joined: Fri Jan 28, 2011 4:31 am

Re: detect language (solved)

Postby [email protected] » Sun Mar 20, 2011 4:03 am

yes it was possible, now all the switchings work well, i had to change the widget a bit, here it is for you to check if there's something wrong (i just added the "lang" variable for the 'en' string):

function doGTranslate(lang_pair) {if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];var plang=location.pathname.split('/')[1];if(plang.length !=2 && plang != 'zh-CN' && plang != 'zh-TW')plang='en';if(lang == 'en')location.href=location.protocol+'//'+location.host+'/'+lang+location.pathname.replace('/'+plang, '')+location.search;else location.href=location.protocol+'//'+location.host+'/'+lang+location.pathname.replace('/'+plang, '')+location.search;}
[email protected]
 
Posts: 23
Joined: Fri Jan 28, 2011 4:31 am


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux
cron