--- l10n_client.module 2008-01-04 14:38:29.000000000 +0100 +++ l10n_client.module_patched 2008-03-23 13:00:51.000000000 +0100 @@ -44,6 +44,16 @@ function l10n_client_menu($may_cache) { 'access' => $access, 'type' => MENU_CALLBACK, ); + // configuration settings + $items[] = array( + 'path' => 'admin/settings/l10n_client', + 'title' => t('Localization client'), + 'description' => t('Allow or disallow Google translation suggestions'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'l10n_client_admin', + 'access' => user_access('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); } return $items; @@ -121,6 +131,16 @@ function l10n_client_init() { drupal_add_js(drupal_get_path('module', 'l10n_client') .'/l10n_client.js', 'module'); // We use textareas to be able to edit long text, which need resizing. drupal_add_js('misc/textarea.js', 'module'); + + // Load google translation api if activated + if (variable_get('l10n_client_suggest_translations', 1)){ + drupal_set_html_head(""); + drupal_set_html_head(""); + + // Make the current locale available + drupal_add_js(array('locale' => $locale), 'setting'); + drupal_add_js(array('i18n_client_suggestTranslations' => variable_get('l10n_client_suggest_translations', 1)), 'setting'); + } } } @@ -264,6 +284,9 @@ function l10n_client_form($strings) { $form['copy'] = array( '#value' => "", ); + $form['copytrans'] = array( + '#value' => "", + ); $form['clear'] = array( '#value' => "", ); @@ -319,6 +342,18 @@ function l10n_client_save_string() { } /** + * Add configuration menu. + */ +function l10n_client_admin() { + $form['l10n_client_suggest_translations'] = array( + '#type' => 'checkbox', + '#default_value' => variable_get('l10n_client_suggest_translations', 1) , + '#title' => t('Let Google suggest translations') + ); + return system_settings_form($form); +} + +/** * Import one string into the database. * * Note: Backport of Drupal 6 _locale_import_one_string_db basically