My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 72: Only one request
1 person starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----


Sign in to add a comment
 
Reported by jacek.ko...@dyrygent.pl, Sep 24, 2011
jquery-translate version: trunk
jQuery version: 1.5
browser: FF5
OS: WinXP

I have quite a large page I am trying to translate.
The code I use:
  jQuery(document).ready(function() {
    jQuery.translate.load('XXXXXXX')
    jQuery('#content').translateTextNodes('pl','en', {async:true});
  });

The problem is, only one request to the translating service gets send each time I open the page, this means that translation doeas work, but it only translates one fragments, in my case header and first row of a table, not the rest of the page.

Tried both Google and Bing, read through wiki and issues but I can't seem to get the solution.

Am I missing something? How do I translate entire page, revursively, using multiple requests to the trasnlation service.

Thank you for your time, and for this great plugin, I just hope I'll get it work as I expect.



Sep 24, 2011
Project Member #1 balazs.endresz
Sorry, but without seeing the actual page I can't say too much. You can email it to me if it's not public.
Sep 24, 2011
#2 jacek.ko...@dyrygent.pl
Thank you for such a quick reply.

http://realcorp.pl/translate/

I made a static copy of an example page from the site. Stripped down all the CSS and JS.
The original site is Joomla! generated, but I don't think that has anything to do with the issue, since inside Joomla! the problem is exactly the same - only header of te table gets translated.
Sep 24, 2011
Project Member #3 balazs.endresz
This issue has already come up before, it looks like haven't fixed it yet. The < signs cause some problems because the plugin needs to detect if there's some broken html tags in the text because then it has to be cut before those, in order to stay below the per request character limit. Now that's actually more complicated than it sounds, and I couldn't find a way around it yet.

For your page something like this should work though:

jQuery(".auction_price_bold").each(function(){
  var $this = jQuery(this);
  $this.text( $this.text().replace("<","") );
});

jQuery("body").translateTextNodes("pl", "en", function(){
  jQuery(".auction_price_bold").each(function(){
    var $this = jQuery(this);
    $this.text( "<" + $this.text() );
  });
});


or maybe just this: 

jQuery("body").translate("pl", "en", {not:".auction_price_bold"});

But there's an exception thrown, and I don't why because the JavaScript is minified on the page!


Status: Accepted
Sep 26, 2011
#4 jacek.ko...@dyrygent.pl
Thank you very much! It's a lifesaver.
Sign in to add a comment

Powered by Google Project Hosting