--- l10n_client.js 2007-12-04 11:58:47.000000000 +0100 +++ l10n_client.js_patched 2008-03-23 13:00:33.000000000 +0100 @@ -90,7 +90,24 @@ Drupal.l10nEditorAttach = function () { $('#l10n-client-string-select li').removeClass('active'); $(this).addClass('active'); var index = $('#l10n-client-string-select li').index(this); - $('#l10n-client-string-editor .source-text').empty().append(Drupal.l10nClientGetString(index, 'source')); + //$('#l10n-client-string-editor .source-text').empty().append(Drupal.l10nClientGetString(index, 'source')); + $('#l10n-client-string-editor .source-text') + .empty() + .append("
" + Drupal.l10nClientGetString(index, 'source') + "
"); + + // Fetch a stranslation suggestion + if (Drupal.settings.i18n_client_suggestTranslations){ + google.language.translate(Drupal.l10nClientGetString(index, 'source'), 'en', Drupal.settings.locale, function(result) { + if (!result.error){ + $('#l10n-client-string-editor .source-text').append( + "
" + + Drupal.settings.locale.toUpperCase() + " : " + + "" + result.translation + "" + + "
" + ); + } + }); + } $('#l10n-client-form #edit-target').val(Drupal.l10nClientGetString(index, 'target')); Drupal.l10nClientSelected = index; }); @@ -114,8 +131,13 @@ Drupal.l10nEditorAttach = function () { // Copy source text to translation field on button click. $('#l10n-client-form #edit-copy').click(function() { - $('#l10n-client-form #edit-target').val($('#l10n-client-string-editor .source-text').html()); + $('#l10n-client-form #edit-target').val($('#l10n-client-string-editor .source-text #l10n-client-trans-orig').html()); }); + + // Copy suggested translation text to translation field on button click. + $('#l10n-client-form #edit-copy-trans').click(function() { + $('#l10n-client-form #edit-target').val($('#l10n-client-string-editor .source-text #l10n-client-trans-result').html()); + }); // Clear translation field on button click. $('#l10n-client-form #edit-clear').click(function() {