Open GoogleCodeExporter opened 9 years ago
Currently you have to add a "notranslate" class manually for those elements:
http://googlewebmastercentral.blogspot.com/2008/10/helping-you-break-language-ba
rrier.html
either in the html or like this:
//add "notranslate" classes only once
var $toTranslate =
$(".toTranslate").find("exlude_these").addClass("notranslate").end();
//then translate it without the `not` option:
$toTranslate.translate(...)
Sure, it would be easier if this happened automatically, but that might impact
performance unnecessarily.
Original comment by balazs.endresz
on 8 Jul 2010 at 3:47
Unfortunately, it does not seem to work.
I have element:
<span class = "notranslate">raz dwa trzy</span>
and it gets translated to:
<span class="notranslate">one two three</span>
regardless of walk setting. It works only with walk: true and not:
".notranslate".
My code:
function translateTo(destLang)
{
$.cookie('trans', destLang);
$('#language img').removeClass('hover');
$('#'+destLang+' img').addClass('hover');
$('body').translate( 'pl', destLang,
{
//not:".notranslate",
toggle: true,
walk: false,
complete: function()
{
}
});
}
Original comment by b.d.abko...@gmail.com
on 9 Jul 2010 at 7:15
Are you sure? Could you send a link to the page? It works for me.
Original comment by balazs.endresz
on 9 Jul 2010 at 11:57
The site is http://panoramy.pl/index_tr4.php
Please note the flag titles. The idea is to keep them in English. They are in a
div with class="notranslate", but still get translated on language change. I
also tried giving each img class="notranslate" but it didn't work either.
Don't get confused by the dropdown on the top staying in English. It's just a
nasty hack forcing it to reload each time.
Thanks for your help.
Original comment by b.d.abko...@gmail.com
on 9 Jul 2010 at 12:54
It's a bug in the language API: it translates all attributes anyway:
google.language.translate('<span class="notranslate"><span title="raz dwa
trzy"></span></span>', 'en', 'pl', function(r){alert(r.translation)});
Here you can file a bug: http://code.google.com/p/google-ajax-apis/issues/list
Also, this works as expected:
google.language.translate('<span class="notranslate">raz dwa trzy</span>',
'pl', 'en', function(r){alert(r.translation)});
Original comment by balazs.endresz
on 9 Jul 2010 at 3:06
Original comment by balazs.endresz
on 9 Jul 2010 at 3:06
Original comment by balazs.endresz
on 9 Jul 2010 at 3:07
In my last comment languages are in the wrong order, correctly:
the title here translates though it shouldn't:
google.language.translate('<span class="notranslate"><span title="raz dwa
trzy"></span></span>', 'pl', 'en', function(r){alert(r.translation)});
this works as expected, the text is not translated:
google.language.translate('<span class="notranslate">raz dwa trzy</span>',
'pl', 'en', function(r){alert(r.translation)});
Original comment by balazs.endresz
on 13 Jan 2011 at 10:09
Original issue reported on code.google.com by
b.d.abko...@gmail.com
on 8 Jul 2010 at 11:44