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 1 Dec 2010 09:27:43 -0000 @@ -8,6 +8,7 @@ * On-page translation * Sharing translations * Re-importing translation packages + * Google translate interface * Contributors & sponsors ABOUT @@ -99,11 +100,18 @@ 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 and andypost http://drupal.org/user/118908 (Google Translate integration) Initial development was sponsored by Google Summer of Code 2007, user interface sponsored by Development Seed / Young Hahn. Index: l10n_client.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/Attic/l10n_client.css,v retrieving revision 1.6.4.2 diff -u -r1.6.4.2 l10n_client.css --- l10n_client.css 4 Aug 2010 11:37:14 -0000 1.6.4.2 +++ l10n_client.css 1 Dec 2010 09:26:34 -0000 @@ -165,12 +165,21 @@ padding:0em;} #l10n-client-form .form-textarea { - height:13em; + height:12em; font-size:1em; line-height:1.25em; width:95%;} - #l10n-client-form .form-submit { - margin-top: 0em;} + + #l10n-client-form .form-submit { + font-size: 85%; + margin-bottom: 2px; + margin-left: 2px; + margin-right: 2px; + margin-top: 2px; + padding-bottom: 2px; + padding-left: 2px; + padding-right: 2px; + padding-top: 2px;} #l10n-client-data { 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 1 Dec 2010 09:24:35 -0000 @@ -115,6 +115,11 @@ $('#l10n-client-string-editor .source-text').text(Drupal.l10nClient.getString(index, 'source')); $('#l10n-client-form .translation-target').val(Drupal.l10nClient.getString(index, 'target')); + // Use Google auto-translation if enabled. + if (Drupal.settings.l10n_client.auto_gt) { + $('#l10n-client-form .translation-target').val($('#l10n-client-string-editor .source-text').text()).translate('en', Drupal.settings.l10n_client.language, {alwaysReplace: true, toggle: false, fromOriginal: false}); + } + Drupal.l10nClient.selected = index; $('#l10n-client-form .form-submit').removeAttr("disabled"); }); @@ -134,6 +139,12 @@ return false; }); + // Google translate API 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', Drupal.settings.l10n_client.language, {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 1 Dec 2010 09:24:44 -0000 @@ -93,6 +93,14 @@ 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. drupal_add_js('misc/textarea.js'); + + if (variable_get('l10n_client_use_gtranslate', FALSE) && $language->language != 'en') { + drupal_add_js('http://jquery-translate.googlecode.com/files/jquery.translate-1.3.9.min.js', 'external'); + drupal_add_js(array('l10n_client' => array( + 'language' => $language->language, + 'auto_gt' => variable_get('l10n_client_auto_gtranslate', FALSE), + )), 'setting'); + } } } @@ -386,6 +394,14 @@ '#attributes' => array('class' => array('edit-clear')), '#value' => t('Clear'), ); + if (variable_get('l10n_client_use_gtranslate', FALSE) && $language->language != 'en') { + $form['google'] = array( + '#type' => 'button', + '#id' => 'l10n-client-google', + '#attributes' => array('class' => array('google-button')), + '#value' => t('Google translate'), + ); + } return $form; } @@ -452,6 +468,21 @@ '#description' => t('Each translation submission will also be submitted to the server, if the personal key is set up for the submitter in their user profile. We suggest you set this to http://localize.drupal.org to share with the greater Drupal community.', array('@localize' => 'http://localize.drupal.org')), '#default_value' => variable_get('l10n_client_server', ''), ); + $form['l10n_client_use_gtranslate'] = array( + '#title' => t('Enable Google translate helper'), + '#type' => 'checkbox', + '#default_value' => variable_get('l10n_client_use_gtranslate', FALSE), + ); + $form['l10n_client_auto_gtranslate'] = array( + '#title' => t('Auto translate with Google when selecting string'), + '#type' => 'checkbox', + '#default_value' => variable_get('l10n_client_auto_gtranslate', FALSE), + '#states' => array( + 'visible' => array( + ':input[name="l10n_client_use_gtranslate"]' => array('checked' => TRUE), + ), + ), + ); return system_settings_form($form); }