Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/README.txt,v retrieving revision 1.4.4.1 diff -u -r1.4.4.1 README.txt --- README.txt 4 Aug 2010 10:07:52 -0000 1.4.4.1 +++ README.txt 30 Nov 2010 11:38:04 -0000 @@ -8,6 +8,7 @@ * On-page translation * Sharing translations * Re-importing translation packages + * Google translate interface * Contributors & sponsors ABOUT @@ -99,11 +100,20 @@ See also http://drupal.org/project/l10n_update. +GOOGLE TRANSLATE +-------------------------------------------------------------------------------- + +Using http://code.google.com/p/jquery-translate/ jquery-translate plugin added interface +for online suggestion of a source string via Google Translate + CONTRIBUTORS & SPONSORS -------------------------------------------------------------------------------- * G‡bor Hojtsy http://drupal.org/user/4166 (original author) * Young Hahn / Development Seed - http://developmentseed.org/ (friendly user interface) + * Andriy Podanenko http://drupal.org/user/116002 (Google Translate integration) Initial development was sponsored by Google Summer of Code 2007, user interface sponsored by Development Seed / Young Hahn. + + Index: l10n_client.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/Attic/l10n_client.js,v retrieving revision 1.10.4.8 diff -u -r1.10.4.8 l10n_client.js --- l10n_client.js 13 Oct 2010 11:42:47 -0000 1.10.4.8 +++ l10n_client.js 30 Nov 2010 11:38:03 -0000 @@ -114,6 +114,10 @@ $('#l10n-client-string-editor .source-text').text(Drupal.l10nClient.getString(index, 'source')); $('#l10n-client-form .translation-target').val(Drupal.l10nClient.getString(index, 'target')); + if (l10n_fast>0) { + $('#l10n-client-form .translation-target').val($('#l10n-client-string-editor .source-text').text()).translate('en',l10n_lang, {alwaysReplace:true, toggle: false, fromOriginal:false}); + } + Drupal.l10nClient.selected = index; $('#l10n-client-form .form-submit').removeAttr("disabled"); @@ -133,7 +137,14 @@ $('#l10n-client-form .translation-target').val($('#l10n-client-string-editor .source-text').text()); return false; }); - + + // Google translate API v1 via jquery-translate module + + $('#l10n-client-form .google-button').click(function() { + $('#l10n-client-form .translation-target').val($('#l10n-client-string-editor .source-text').text()).translate('en',l10n_lang, {alwaysReplace:true, toggle: false, fromOriginal:false}); + return false; + }); + // Clear translation field on button click. $('#l10n-client-form .edit-clear').click(function() { $('#l10n-client-form .translation-target').val(''); Index: l10n_client.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/Attic/l10n_client.module,v retrieving revision 1.22.4.13 diff -u -r1.22.4.13 l10n_client.module --- l10n_client.module 27 Oct 2010 08:54:21 -0000 1.22.4.13 +++ l10n_client.module 30 Nov 2010 11:38:03 -0000 @@ -89,6 +89,8 @@ locale(NULL, NULL, NULL, TRUE); drupal_add_css(drupal_get_path('module', 'l10n_client') .'/l10n_client.css'); drupal_add_js(drupal_get_path('module', 'l10n_client') .'/jquery.hotkeys.js'); + drupal_add_js(drupal_get_path('module', 'l10n_client') .'/jquery.translate.js'); + drupal_add_js('var l10n_lang="'.$language->language.'";'.'var l10n_fast="'.variable_get('l10n_client_use_always_gtranslate').'";', 'inline'); drupal_add_js('misc/jquery.cookie.js'); drupal_add_js(drupal_get_path('module', 'l10n_client') .'/l10n_client.js'); // We use textareas to be able to edit long text, which need resizing. @@ -380,6 +382,12 @@ '#attributes' => array('class' => array('edit-copy')), '#value' => t('Copy source'), ); + $form['google'] = array( + '#type' => 'button', + '#id' => 'l10n-client-google', + '#attributes' => array('class' => array('google-button')), + '#value' => t('Google translate'), + ); $form['clear'] = array( '#type' => 'button', '#id' => 'l10n-client-edit-clear', @@ -446,6 +454,11 @@ '#type' => 'checkbox', '#default_value' => variable_get('l10n_client_use_server', FALSE), ); + $form['l10n_client_use_always_gtranslate'] = array( + '#title' => t('Fast translate with Google when selecting string'), + '#type' => 'checkbox', + '#default_value' => variable_get('l10n_client_use_always_gtranslate', FALSE), + ); $form['l10n_client_server'] = array( '#title' => t('Address of localization server to use'), '#type' => 'textfield',