balazs-endresz / jquery-translate

Automatically exported from code.google.com/p/jquery-translate
5 stars 5 forks source link

translateTextNodes doesn't handle html entities properly #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Switch from a foreign language back to English with:
$('body').translateTextNodes('', 'en',{not: 'select'})

What is the expected output? What do you see instead?
  = space and & = & etc.

What version of the product are you using? On what operating system?
1.4.5

Original issue reported on code.google.com by internet...@prosurplusinc.com on 23 Mar 2010 at 9:20

GoogleCodeExporter commented 9 years ago
I re-read my issue and I omitted exactly what was wrong. Sorry about that.

When I use the above code when the page is produced, any "&" and spaces are 
converted
to & and   

You can see an example at http://asnew-com.ihostingcentral.com.  In the perfume
names, there should be no & but rather "&".  Translating to Spanish is pefect.

Thanks,
Dale

Original comment by internet...@prosurplusinc.com on 26 Mar 2010 at 4:05

GoogleCodeExporter commented 9 years ago
The problem is only with translateTextNodes. It's using 
document.createTextNode, which 
seems to work quite differently from innerHTML, it doesn't recognize html 
entities. 
I'll see what I can do with it.

Original comment by balazs.endresz on 26 Mar 2010 at 4:46

GoogleCodeExporter commented 9 years ago
Looks like there isn't any general solution to this, only to replace some html 
entities with 
their unicode equivalents. I think I'll just include this in the next release: 
http://blog.stevenlevithan.com/archives/multi-replace#comment-24937

Original comment by balazs.endresz on 26 Mar 2010 at 5:50

GoogleCodeExporter commented 9 years ago
It should be fixed in 1.4.6! Fortunately only just a few characters are 
converted to 
html entities, so the thing I posted above was not necessary.

Original comment by balazs.endresz on 27 Mar 2010 at 2:34

GoogleCodeExporter commented 9 years ago
Perfect!  Thank you for the super fast response to my problem.

Original comment by internet...@prosurplusinc.com on 27 Mar 2010 at 4:12