balazs-endresz / jquery-translate

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

jquery-translate translate() runs right only one time via click() #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
jquery-translate version: 1.4.7
jQuery version: 1.4.4
browser: Opera 11 + Firefox
OS: XP SP3

URL of the page, with non-minified JavaScript: http://drupal.org/node/237709 
additional info

What steps will reproduce the problem?
1. Install patched l10n_client
2. Try to translate something
3. The only one times code runned

What is the expected output? What do you see instead?
$.translate function runs only one time

Please provide any additional information below.

The code

 $('#l10n-client-form .google-button').click(function() {
  $('#l10n-client-form .translation-target').val($('#l10n-client-string-editor .source-text').text()).translate('en','uk', function(){ alert("complete"); });
    return false;
  });

#l10n-client-form .google-button - the button handles click function
#l10n-client-form .translation-target - input field for value from value from 
input field #l10n-client-string-editor .source-text
First time clicking translates text into uk language
second time - nope but callback runs good (alert complete 8) )

How-to write code for right translate() running?
When refresh page after translation we can push button again but one time only

in attachement - there is a network activity log first and second button click

Original issue reported on code.google.com by podaro...@gmail.com on 29 Nov 2010 at 2:26

Attachments:

GoogleCodeExporter commented 9 years ago
You just have to use the alwaysReplace option: 
http://code.google.com/p/jquery-translate/wiki/TranslateMethod#options_added_in_
v1.4

Original comment by balazs.endresz on 29 Nov 2010 at 4:06

GoogleCodeExporter commented 9 years ago
With this option the script always replace text with previously translated 
string 8((

Original comment by podaro...@gmail.com on 29 Nov 2010 at 4:14

GoogleCodeExporter commented 9 years ago
alwaysReplace:true, toggle: false, fromOriginal:false
fix as problem!
thanks!

Original comment by podaro...@gmail.com on 29 Nov 2010 at 4:31

GoogleCodeExporter commented 9 years ago
Oh... you're right, I added that to the docs, and opened a ticket (issue 59), 
so that it should change those two options as well, it's quite pointless 
otherwise.

Original comment by balazs.endresz on 29 Nov 2010 at 4:56

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r236.

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