balazs-endresz / jquery-translate

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

text-node sibling causes Flash object to be translated #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. translate a section where a text-node sibling causes something excluded
with the "not" option to be overridden.
2. a Flash object deeper in the section will also be translated

What is the expected output? What do you see instead?
Flash objects should not be sent for translation but here they are.

What version of the product are you using? On what operating system?
jquery-translate 1.4.1
Firefox 3.5.6
IE 6

Please provide any additional information below.
I got a bug report for my WordPress plugin recently that after translation
a Flash movie wasn't working in Internet Explorer:
http://wordpress.org/support/topic/306760?replies=5#post-1330596

I tested it out and saw that Firefox was also translating the [Translate]
button which it shouldn't since it's excluded with the not option:
not:".translate_block"

I downloaded the page to my machine and stripped out all the extra
JavaScript and other things to isolate the problem. With the Firebug Net
monitor I saw that it was sending the <div class="translate_block"> and the
Flash object to be translated, which was breaking the Flash movie in IE.

After a lot of testing I saw that there was a text-node sibling to <div
class="translate_block">:
The Movie Poster, Cover, Description, Synopsis, Overview, Trailer, Genre, Cast

After isolating this text with <p></p> tags the [Translate] button and the
Flash movie were excluded from translation. I uploaded the two test cases
here for you to see:
http://noisychaos.com/external/gat_testcase/NotF.html
http://noisychaos.com/external/gat_testcase/NotF2.html

I don't know if this is how the not: option is supposed to work since the
code for your nodesContainingText plugin is hard to follow but it seems
like the Flash object shouldn't be sent for translation in either case.

Original issue reported on code.google.com by monodist...@gmail.com on 29 Dec 2009 at 3:50

GoogleCodeExporter commented 9 years ago
Yes, the plugin works this way intentionally to preserve the context when for 
example 
there are multiple tags present in one sentence. This however is the source of 
most of 
the bugs; that's why I started to implement an alternative method: 
http://code.google.com/p/jquery-translate/wiki/TextnodeTranslatorIntegration

This, unfortunately, doesn't have all the features yet, and I have 
accounting/bookkeeping exams this month, but later on I definitely want to 
improve it.

Original comment by balazs.endresz on 2 Jan 2010 at 11:17

GoogleCodeExporter commented 9 years ago
Now you can use translateTextNodes to translate from the original language 
after it
has been translated, and switching between languages works too. With
translateTextNodes only the text nodes are translated so issues like this never
happen. But in some cases the translation might be a bit different.

Original comment by balazs.endresz on 28 Jan 2010 at 6:20