Open GoogleCodeExporter opened 9 years ago
It looks like the `<` and `>` characters at the bottom of the page are causing
this issue. Though I'm not yet sure why.
Original comment by balazs.endresz
on 23 Nov 2010 at 1:30
Thanks sir for your support. Ok i understand but when i try to do the
translation on google they translate the page. Can you suggest me some other
way to translate the complete page. Please
Original comment by mubbasha...@gmail.com
on 23 Nov 2010 at 1:38
The same issue was reported here:
http://code.google.com/p/jquery-translate/issues/detail?id=52
The problem is in the regexes in $.translate.trunctate function, which has to
parse some HTML too if one's using $("body").translate(). And AFAIK that's just
can't be done properly with regexes, though my code could be improved for sure.
But since you are using .translateTextNodes(), it doesn't have to deal with
html, so the following patch should make it work properly:
$.translate.truncate = function(text, limit){
var i, m1, m2, m3, m4, t, encoded = encodeURIComponent( text );
for(i = 0; i < 10; i++){
try {
t = decodeURIComponent( encoded.substr(0, limit - i) );
} catch(e){ continue; }
if(t) break;
}
return ( !( m1 = null && /<(?![^<]*>)/.exec(t) ) ) ? ( //if no broken tag present
( !( m2 = null && />\s*$/.exec(t) ) ) ? ( //if doesn't end with '>'
( m3 = this._m3.exec(t) ) ? ( //if broken sentence present
( m4 = null && />(?![^>]*<)/.exec(t) ) ? (
m3.index > m4.index ? t.substring(0, m3.index+1) : t.substring(0, m4.index+1)
) : t.substring(0, m3.index+1) ) : t ) : t ) : t.substring(0, m1.index);
}
Original comment by balazs.endresz
on 23 Nov 2010 at 1:56
thanks for your quick response.where i have to put this code.
Original comment by mubbasha...@gmail.com
on 23 Nov 2010 at 2:00
After you include the plugin.
Original comment by balazs.endresz
on 23 Nov 2010 at 2:03
[deleted comment]
so you mean that after
<script type="text/javascript"
src="jquery.translate-1.4.7-debug-all.js"></script>
i have to make a java script tag and have to put all the above code there.And
it will work fine.
Original comment by mubbasha...@gmail.com
on 23 Nov 2010 at 3:30
can you please provide a simple example of doing this. I tried this but this is
not working for me
Original comment by mubbasha...@gmail.com
on 23 Nov 2010 at 3:43
I tried it on the original page, and it worked there... I'll have a look at it
a bit later!
Original comment by balazs.endresz
on 23 Nov 2010 at 4:17
can you see my page ? Please have a look
Original comment by mubbasha...@gmail.com
on 23 Nov 2010 at 4:19
I looked at your page and it looks like it really can't be solved that easily.
I'll try to do something with it tomorrow!
Original comment by balazs.endresz
on 23 Nov 2010 at 7:35
Sir can you please look my page.
Me waiting
Original comment by mubbasha...@gmail.com
on 24 Nov 2010 at 6:37
Sir please help me i waiting for you for 2 days. Please help me
thanks in advance
Original comment by mubbasha...@gmail.com
on 26 Nov 2010 at 1:43
Issue 57 has been merged into this issue.
Original comment by balazs.endresz
on 11 Mar 2011 at 7:44
Issue 52 has been merged into this issue.
Original comment by balazs.endresz
on 11 Mar 2011 at 7:45
Original issue reported on code.google.com by
mubbasha...@gmail.com
on 22 Nov 2010 at 9:29