Index: l10n_client.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/Attic/l10n_client.module,v
retrieving revision 1.22.4.3
diff -u -p -r1.22.4.3 l10n_client.module
--- l10n_client.module	17 Nov 2009 12:12:31 -0000	1.22.4.3
+++ l10n_client.module	17 Apr 2010 10:45:41 -0000
@@ -414,15 +416,15 @@ function l10n_client_save_string() {
   if (user_access('use on-page translation')) {
     if (isset($_POST['source']) && isset($_POST['target']) && !empty($_POST['form_token']) && drupal_valid_token($_POST['form_token'], 'l10n_client_form')) {
       include_once 'includes/locale.inc';
-      $report = array(0, 0, 0);
+      $report = array('skips' => 0, 'additions' => 0, 'updates' => 0);
       // @todo: add actual context support.
       _locale_import_one_string_db($report, $language->language, '', $_POST['source'], $_POST['target'], 'default', NULL, LOCALE_IMPORT_OVERWRITE);
       cache_clear_all('locale:', 'cache', TRUE);
       _locale_invalidate_js($language->language);
 
       // Submit to remote server if enabled.
-      if (variable_get('l10n_client_use_server', FALSE) && user_access('submit translations to localization server') && !empty($user->l10n_client_key)) {
-        l10n_client_submit_translation($language->language, $_POST['source'], $_POST['target'], $user->l10n_client_key, l10n_client_user_token($user));
+      if (variable_get('l10n_client_use_server', FALSE) && user_access('submit translations to localization server') && !empty($user->data['l10n_client_key'])) {
+        l10n_client_submit_translation($language->language, $_POST['source'], $_POST['target'], $user->data['l10n_client_key'], l10n_client_user_token($user));
       }
     }
   }
@@ -574,7 +576,7 @@ function l10n_client_form_user_profile_f
       $form['l10n_client']['l10n_client_key'] = array(
         '#type' => 'textfield',
         '#title' => t('Your Localization Server API key'),
-        '#default_value' => !empty($account->l10n_client_key) ? $account->l10n_client_key : '',
+        '#default_value' => !empty($account->data['l10n_client_key']) ? $account->data['l10n_client_key'] : '',
         '#description' => t('This is a unique key that will allow you to send translations to the remote server. To get your API key go to !server-link.', array('!server-link' => l($server_link, $server_link))),
       );
       return $form;
@@ -583,6 +585,24 @@ function l10n_client_form_user_profile_f
 }
 
 /**
+ * Save in the l10n_client_key in user object.
+ *
+ * @param array $edit
+ * @param object $account
+ * @param array $category
+ *
+ * @see user_save().
+ * @see hook_user_presave().
+ */
+function l10n_client_user_presave(&$edit, $account, $category) {
+  // Make sure that our form value 'mymodule_foo' is stored as 'mymodule_bar'.
+  if (isset($edit['l10n_client_key'])) {
+    $edit['data']['l10n_client_key'] = trim($edit['l10n_client_key']);
+  }
+}
+
+
+/**
  * Get user based semi unique token. This will ensure user keys are unique for each client.
  */
 function l10n_client_user_token($account = NULL) {
