--- sites/all/modules/l10n_server/l10n_community/export_or.inc	Wed Nov 07 19:34:31 2007
+++ sites/all/modules/l10n_server/l10n_community/export.inc	Wed Nov 07 19:15:27 2007
@@ -52,6 +52,13 @@
       '#type' => 'value',
       '#value' => $langcode,
     );
+    $form['version'] = array(
+      '#title' => t('Drupal version support'),
+      '#type' => 'radios',
+      '#options' => array('d5' => t('Drupal 5'), 'd6' => t('Drupal 6')),
+      '#default_value' => 'd6',
+      '#description' => t('Version supported. If you use these translations in Drupal 5, select Drupal 5 translations, otherwise select Drupal 6 translation in a Drupal 6 translation site')
+    );
   }
   $form['uri'] = array(
     '#type' => 'value',
@@ -77,7 +84,7 @@
   $type = (isset($form['type']) ? $form['type'] : 'template');
 
   // Generate tarball and get file name.
-  $filename = l10n_community_export($form['uri'], ($form['release'] == 'all' ? NULL : $form['release']), $language, ($type != 'translation'));
+  $filename = l10n_community_export($form['uri'], ($form['release'] == 'all' ? NULL : $form['release']), $language, ($type != 'translation'), $form['version']);
   
   // Return compressed archive to user.
   header('Content-Disposition: attachment; filename='. $form['uri'] . (isset($language) ? '-'. $language->locale : '') . ($type == 'template' ? '-templates' : '-translations') .'.tgz');
@@ -104,7 +111,7 @@
  * @todo
  *   Look into possibly exporting suggestions as fuzzy translations.
  */
-function l10n_community_export($uri, $release = NULL, $language = NULL, $template = TRUE) {
+function l10n_community_export($uri, $release = NULL, $language = NULL, $template = TRUE, $version = NULL) {
   include_once 'Archive/Tar.php';
   
   $project = l10n_community_get_projects($uri);
@@ -134,6 +141,8 @@
   $result = db_query($sql, $sql_args);
   $previous_sid = 0;
   $export_string = $string_files = array();
+  
+  $version == d5 ? $po_folder = 'po' : 'translations';
     
   while ($string = db_fetch_object($result)) {
     if ($string->sid != $previous_sid) {
@@ -145,12 +154,12 @@
           // Appeared in more then one file, so goes to general.po.
           // Note that some modules like ubercart might not have their
           // root module in the root folder, so this needs to be rethought.
-          $filename = './translations/general';
+          $filename = './'.$po_folder.'/general';
         }
         else {
           // Putting into one specific directory, and there to a file.
           $filename = preg_replace('!(^[^/]+/)!', '', array_shift(array_keys($export_string['comment'])));
-          $filename = dirname($filename) .'/translations/'. str_replace(array('.', '_'), '-', basename($filename));
+          $filename = dirname($filename) .'/'.$po_folder.'/'. str_replace(array('.', '_'), '-', basename($filename));
         }
         $filename .= ($template ? '.pot' : '.'. $language->locale .'.po');
         
