balazs-endresz / jquery-translate

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

Async parameter isn't working correctly #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
var traduction = 'test';
$j.translate( 'car', 'en', 'fr', {
              async: false,
              complete: function(translation){ 
                  traduction = translation;
                  alert('1'+traduction);
    }
});
alert('2'+traduction);

We should have "1 Voiture" first and than "2 voiture" if it was realy not 
async. The result at the moment is "2 test" and than "1 voiture". I'm using 
jquery.translate-NCT,core,NCT-adapter,progress.min.js (1.4.6). I'm under last 
version of ubuntu 64 bit.

Thanks

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

Please provide any additional information below.

Original issue reported on code.google.com by mrobilla...@gmail.com on 12 Jul 2010 at 5:20

GoogleCodeExporter commented 9 years ago
I know async: false is the default parameter but it is just to show you it 
doesn't work.

Original comment by mrobilla...@gmail.com on 12 Jul 2010 at 5:21

GoogleCodeExporter commented 9 years ago
Well, the naming is a bit unfortunate, but I think the documentation is clear 
on this: http://code.google.com/p/jquery-translate/wiki/TranslateMethod

async: false
 this prevents the browser from freezing on larger sites by executing each DOM  
 filtering iteration with a delay (it doesn't affect the requests sent to Google)
 you can set the length of the delay in ms, setting it true means 2 ms
 the returnAll option won't work, it will return the jQuery object immediately

Also, this option is not present on the TranslateFunction wiki page.

Original comment by balazs.endresz on 12 Jul 2010 at 6:55