 l10n_client.admin.inc | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++
 l10n_client.module    | 124 +-----------------------------------------------
 2 files changed, 130 insertions(+), 122 deletions(-)

diff --git a/l10n_client.admin.inc b/l10n_client.admin.inc
new file mode 100644
index 0000000..144714a
--- /dev/null
+++ b/l10n_client.admin.inc
@@ -0,0 +1,128 @@
+<?php
+
+/**
+ * @file
+ *   Administrative page callbacks for the Localization client module.
+ */
+
+/**
+ * Page callback function to present a form to reimport a translation package.
+ *
+ * @ingroup forms
+ * @see l10n_client_import_package_form_submit()
+ */
+function l10n_client_import_package_form(&$form_state) {
+  // Get all languages, except English
+  $names = locale_language_list('name', TRUE);
+  unset($names['en']);
+
+  if (!count($names)) {
+    // This only works if there is any foreign language set up.
+    drupal_set_message(t('No languages set up to reimport packages into.'), 'warning');
+    return array();
+  }
+
+  $form = array();
+  $form['reimport'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Reimport translation packages'),
+  );
+  $form['reimport']['langcodes'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Language packages'),
+    '#description' => t('Choose language packages to reimport translations from. All files of the packages should be already uncompressed to the Drupal directories. All translation files will be imported for enabled modules and themes and will be imported to the built-in interface textgroup.'),
+    '#options' => $names,
+    '#required' => TRUE,
+  );
+  $form['reimport']['textgroups'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Clean up textgroups in database before reimport'),
+    '#description' => t('If checked, all translations for the given language and selected textgroups will be deleted from the database first, and you will loose all your customized translations and those not available in the files being imported. Use with extreme caution.'),
+    '#default_value' => array(),
+    '#options' => module_invoke_all('locale', 'groups'),
+  );
+  $form['reimport']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Reimport packages')
+  );
+  return $form;
+}
+
+/**
+ * Submission handler for package reimport form.
+ *
+ * @see l10n_client_import_package_form()
+ */
+function l10n_client_import_package_form_submit($form, &$form_state) {
+  if (!empty($form_state['values']['textgroups'])) {
+    // Clean out all translations first if user asked to do that.
+    $langcodes = array_keys(array_filter($form_state['values']['langcodes']));
+    $textgroups = array_keys(array_filter($form_state['values']['textgroups']));
+    if (!empty($textgroups)) {
+      db_query("DELETE FROM {locales_target} WHERE language IN (". db_placeholders($langcodes, 'varchar') .") AND lid IN (SELECT lid FROM {locales_source} WHERE textgroup IN (". db_placeholders($textgroups, 'varchar') ."))", array_merge($langcodes, $textgroups));
+      // Also remove all source strings without translations.
+      db_query("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})");
+    }
+  }
+
+  // Set up and start batch for new imports.
+  include_once 'includes/locale.inc';
+  foreach (array_filter($form_state['values']['langcodes']) as $langcode) {
+    if ($batch = locale_batch_by_language($langcode, '_locale_batch_language_finished')) {
+      batch_set($batch);
+    }
+  }
+  $form_state['redirect'] = 'admin/build/translate';
+}
+
+// -----------------------------------------------------------------------------
+
+/**
+ * Settings form for l10n_client.
+ *
+ * Enable users to set up a central server to share translations with.
+ */
+function l10n_client_settings_form() {
+  $form = array();
+  $form['l10n_client_use_server'] = array(
+    '#title' => t('Enable sharing translations with server'),
+    '#type' => 'checkbox',
+    '#default_value' => variable_get('l10n_client_use_server', FALSE),
+  );
+  $form['l10n_client_server'] = array(
+    '#title' => t('Address of localization server to use'),
+    '#type' => 'textfield',
+    '#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 <a href="@localize">http://localize.drupal.org</a> to share with the greater Drupal community.', array('@localize' => 'http://localize.drupal.org')),
+    '#default_value' => variable_get('l10n_client_server', ''),
+  );
+  return system_settings_form($form);
+}
+
+/**
+ * Validation to make sure the provided server can handle our submissions.
+ *
+ * Make sure it supports the exact version of the API we will try to use.
+ */
+function l10n_client_settings_form_validate($form, &$form_state) {
+  if ($form_state['values']['l10n_client_use_server']) {
+
+    if (!empty($form_state['values']['l10n_client_server'])) {
+      // Try to invoke the remote string submission with a test request.
+      $response = xmlrpc($form_state['values']['l10n_client_server'] .'/xmlrpc.php', 'l10n.server.test', '2.0');
+      if ($response && !empty($response['name']) && !empty($response['version'])) {
+        if (empty($response['supported']) || !$response['supported']) {
+          form_set_error('l10n_client_server', t('The given server could not handle the v2.0 remote submission API.'));
+        }
+        else {
+          drupal_set_message(t('Verified that the specified server can handle remote string submissions. Supported languages: %languages.', array('%languages' => $response['languages'])));
+        }
+      }
+      else {
+        form_set_error('l10n_client_server', t('Invalid localization server address specified. Make sure you specified the right server address.'));
+      }
+    }
+    else {
+      form_set_error('l10n_client_server', t('You should provide a server address, such as http://localize.drupal.org'));
+    }
+  }
+}
diff --git a/l10n_client.module b/l10n_client.module
index 05468ef..af69491 100644
--- a/l10n_client.module
+++ b/l10n_client.module
@@ -59,6 +59,7 @@ function l10n_client_menu() {
     'access arguments' => array('translate interface'),
     'weight' => 5,
     'type' => MENU_LOCAL_TASK,
+    'file' => 'l10n_client.admin.inc',
   );
 
   // Direct copy of the Configure tab from locale module to
@@ -78,6 +79,7 @@ function l10n_client_menu() {
     'access arguments' => array('administer languages'),
     'weight' => 5,
     'type' => MENU_LOCAL_TASK,
+    'file' => 'l10n_client.admin.inc',
   );
   return $items;
 }
@@ -452,128 +454,6 @@ function l10n_client_save_string() {
 // -----------------------------------------------------------------------------
 
 /**
- * Page callback function to present a form to reimport a translation package.
- *
- * @ingroup forms
- * @see l10n_client_import_package_form_submit()
- */
-function l10n_client_import_package_form(&$form_state) {
-  // Get all languages, except English
-  $names = locale_language_list('name', TRUE);
-  unset($names['en']);
-
-  if (!count($names)) {
-    // This only works if there is any foreign language set up.
-    drupal_set_message(t('No languages set up to reimport packages into.'), 'warning');
-    return array();
-  }
-
-  $form = array();
-  $form['reimport'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Reimport translation packages'),
-  );
-  $form['reimport']['langcodes'] = array(
-    '#type' => 'checkboxes',
-    '#title' => t('Language packages'),
-    '#description' => t('Choose language packages to reimport translations from. All files of the packages should be already uncompressed to the Drupal directories. All translation files will be imported for enabled modules and themes and will be imported to the built-in interface textgroup.'),
-    '#options' => $names,
-    '#required' => TRUE,
-  );
-  $form['reimport']['textgroups'] = array(
-    '#type' => 'checkboxes',
-    '#title' => t('Clean up textgroups in database before reimport'),
-    '#description' => t('If checked, all translations for the given language and selected textgroups will be deleted from the database first, and you will loose all your customized translations and those not available in the files being imported. Use with extreme caution.'),
-    '#default_value' => array(),
-    '#options' => module_invoke_all('locale', 'groups'),
-  );
-  $form['reimport']['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Reimport packages')
-  );
-  return $form;
-}
-
-/**
- * Submission handler for package reimport form.
- *
- * @see l10n_client_import_package_form()
- */
-function l10n_client_import_package_form_submit($form, &$form_state) {
-  if (!empty($form_state['values']['textgroups'])) {
-    // Clean out all translations first if user asked to do that.
-    $langcodes = array_keys(array_filter($form_state['values']['langcodes']));
-    $textgroups = array_keys(array_filter($form_state['values']['textgroups']));
-    if (!empty($textgroups)) {
-      db_query("DELETE FROM {locales_target} WHERE language IN (". db_placeholders($langcodes, 'varchar') .") AND lid IN (SELECT lid FROM {locales_source} WHERE textgroup IN (". db_placeholders($textgroups, 'varchar') ."))", array_merge($langcodes, $textgroups));
-      // Also remove all source strings without translations.
-      db_query("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})");
-    }
-  }
-
-  // Set up and start batch for new imports.
-  include_once 'includes/locale.inc';
-  foreach (array_filter($form_state['values']['langcodes']) as $langcode) {
-    if ($batch = locale_batch_by_language($langcode, '_locale_batch_language_finished')) {
-      batch_set($batch);
-    }
-  }
-  $form_state['redirect'] = 'admin/build/translate';
-}
-
-// -----------------------------------------------------------------------------
-
-/**
- * Settings form for l10n_client.
- *
- * Enable users to set up a central server to share translations with.
- */
-function l10n_client_settings_form() {
-  $form = array();
-  $form['l10n_client_use_server'] = array(
-    '#title' => t('Enable sharing translations with server'),
-    '#type' => 'checkbox',
-    '#default_value' => variable_get('l10n_client_use_server', FALSE),
-  );
-  $form['l10n_client_server'] = array(
-    '#title' => t('Address of localization server to use'),
-    '#type' => 'textfield',
-    '#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 <a href="@localize">http://localize.drupal.org</a> to share with the greater Drupal community.', array('@localize' => 'http://localize.drupal.org')),
-    '#default_value' => variable_get('l10n_client_server', ''),
-  );
-  return system_settings_form($form);
-}
-
-/**
- * Validation to make sure the provided server can handle our submissions.
- *
- * Make sure it supports the exact version of the API we will try to use.
- */
-function l10n_client_settings_form_validate($form, &$form_state) {
-  if ($form_state['values']['l10n_client_use_server']) {
-
-    if (!empty($form_state['values']['l10n_client_server'])) {
-      // Try to invoke the remote string submission with a test request.
-      $response = xmlrpc($form_state['values']['l10n_client_server'] .'/xmlrpc.php', 'l10n.server.test', '2.0');
-      if ($response && !empty($response['name']) && !empty($response['version'])) {
-        if (empty($response['supported']) || !$response['supported']) {
-          form_set_error('l10n_client_server', t('The given server could not handle the v2.0 remote submission API.'));
-        }
-        else {
-          drupal_set_message(t('Verified that the specified server can handle remote string submissions. Supported languages: %languages.', array('%languages' => $response['languages'])));
-        }
-      }
-      else {
-        form_set_error('l10n_client_server', t('Invalid localization server address specified. Make sure you specified the right server address.'));
-      }
-    }
-    else {
-      form_set_error('l10n_client_server', t('You should provide a server address, such as http://localize.drupal.org'));
-    }
-  }
-}
-
-/**
  * Implementation of hook_user().
  *
  * Set up API key for localization server.
