balazs-endresz / jquery-translate

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

not: '.classname' doesnt work for child elements when parent is to be translated #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
jquery-translate version: 1.4.7
jQuery version: 1.4.4
browser: Chrome
OS: Win7 32b

URL of the page, with non-minified JavaScript:
http://www.locationof.com/a-random-404-please/
The page specified is not currently in production.

What steps will reproduce the problem?
1. Create a container that holds text to be translated
2. Create a child container 'span' with class 'notrans'
3. Assign a whole lot of 'not' classes and id's; ex.
$('body').translate('en',$(this).val(),{not:'input,#ubrowse-x,#ubrowse,#unav,.co
py,#translatebar,.notrans',fromOriginal:true});

What is the expected output? What do you see instead?
The expected output would be a div translated, and their child elements 
assigned with the 'notrans' class to be left alone. Instead of expectations, 
all contents of the parent div get translated anyway.

Please provide any additional information below.
I will move the pages with these kinds of failures into production later this 
week, as soon as the new layout is done. You'd be welcome to reproduce by then. 
If you need an example sooner, do not hesitate to contact me.

Thanks for the great effort.

Original issue reported on code.google.com by JasperGoes on 30 Nov 2010 at 9:03

GoogleCodeExporter commented 9 years ago
If you are using .tranlsate() then the `not` option won't work for elements 
having textnode siblings, because the whole content of their parent node will 
be translated. However you can add a `notranslate` class to them, which tells 
the Language API that it should not translate the contents of the element.

But if you use the .translateTextNodes() method then it will only translate 
text nodes, so this won't be a problem at all.

Original comment by balazs.endresz on 30 Nov 2010 at 12:01

GoogleCodeExporter commented 9 years ago
I won't fix this, because it would add too much performance overhead but I 
updated the docs, so that it points out possible solutions.

Original comment by balazs.endresz on 11 Mar 2011 at 8:59