balazs-endresz/jquery-translate

Subsequent translations not working properly in IE

GoogleCodeExporter opened this issue · 2 comments

jquery-translate version: 1.1.2
jQuery version:1.3.2
browser:IE
OS:Windows7


URL of the page, with non-minified JavaScript, 
http://www.keratinbrazilianhair.com/alex/
can be used too:

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


Please provide any additional information below.
    $(document).ready(function(){

        jQuery(function($){ //when DOM is ready
          $.translate(function(){
            function translateTo( destLang ){
                $('body').translate( 'english', destLang, {   //translate from english to the selected language
                  not: '.jq-translate-ui',  //by default the generated element has this className
                  fromOriginal:true   //always translate from english (even after the page has been translated)
                });
            }

            //you can generate other controls as well, not just a dropdown:
            $.translate().ui('select', 'option') 
              .appendTo('div#google_lang')    //insert the element to the page
              .css('background-color','white')
              .find('option')
              .attr('value', '#')   //to change the mouse pointer
              .click(function(){   //when selecting another language

                translateTo( $(this).text() );

                $.cookie('destLang', $(this).text() ); 
                // set a cookie to remember the selected language
                // see: http://plugins.jquery.com/project/Cookie

                return false; //prevent default browser action
              })

            var destLang = $.cookie('destLang'); //get previously translated language

            if( destLang )  //if it was set then
                translateTo( destLang );
          }); //end of Google Language API loaded
        }) //end of DOM ready

Original issue reported on code.google.com by alex240...@gmail.com on 24 Mar 2011 at 10:51

For me, about half the page stays randomly in another language, I haven't seen 
anything like that until now.

But using $('body').translateTextNode() instead of $('body').translate() is 
very likely to help here: 
http://code.google.com/p/jquery-translate/wiki/TextnodeTranslatorIntegration

Original comment by balazs.endresz on 25 Mar 2011 at 8:32

  • Changed title: Subsequent translations not working properly in IE
  • Changed state: Accepted
Correctly it's: $('body').translateTextNodes()

Original comment by balazs.endresz on 25 Mar 2011 at 8:33