? 644916_translations.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush_make/Attic/README.txt,v
retrieving revision 1.1.2.16
diff -u -p -r1.1.2.16 README.txt
--- README.txt	25 Aug 2010 16:04:48 -0000	1.1.2.16
+++ README.txt	2 Sep 2010 21:04:20 -0000
@@ -69,6 +69,11 @@ where `drush make` can be used within an
 
       Run a temporary test build and clean up.
 
+    --translations=languages
+
+      Retrieve translations for the specified comma-separated list
+      of language(s) if available for all projects.
+
     --working-copy
 
       Where possible, retrieve a working copy of projects from
@@ -174,6 +179,20 @@ Do not use both types of declarations fo
 
         projects[mytheme][directory_name] = "yourtheme"
 
+- `l10n_path`
+
+  Specific URL (can include tokens) to a translation. Allows translations to be
+  retrieved from l10n servers other than `localize.drupal.org`.
+
+        projects[mytheme][l10n_path] = "http://myl10nserver.com/files/translations/%project-%core-%version-%language.po"
+
+- `l10n_path`
+
+  URL to an l10n server XML info file. Allows translations to be retrieved from
+  l10n servers other than `localize.drupal.org`.
+
+        projects[mytheme][l10n_path] = "http://myl10nserver.com/files/translations/%project-%core-%version-%language.po"
+
 
 ### Project download options
 
Index: drush_make.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush_make/Attic/drush_make.drush.inc,v
retrieving revision 1.11.2.60
diff -u -p -r1.11.2.60 drush_make.drush.inc
--- drush_make.drush.inc	30 Jun 2010 22:24:24 -0000	1.11.2.60
+++ drush_make.drush.inc	2 Sep 2010 21:04:20 -0000
@@ -43,6 +43,7 @@ function drush_make_drush_command() {
       '--prepare-install' => 'Prepare the built site for installation. Generate a properly permissioned settings.php and files directory.',
       '--tar' => 'Generate a tar archive of the build. The output filename will be [build path].tar.gz.',
       '--test' => 'Run a temporary test build and clean up.',
+      '--translations=languages' => 'Retrieve translations for the specified comma-separated list of language(s) if available for all projects.',
       '--working-copy' => 'Where possible, retrieve a working copy of projects from their respective repositories.',
     ),
   );
Index: drush_make.project.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush_make/Attic/drush_make.project.inc,v
retrieving revision 1.1.2.36
diff -u -p -r1.1.2.36 drush_make.project.inc
--- drush_make.project.inc	27 Aug 2010 08:13:48 -0000	1.1.2.36
+++ drush_make.project.inc	2 Sep 2010 21:04:20 -0000
@@ -33,6 +33,9 @@ class DrushMakeProject {
     if (!$this->applyPatches($download_location)) {
       return FALSE;
     }
+    if (!$this->getTranslations($download_location)) {
+      return FALSE;
+    }
     if (!$this->recurse($download_location)) {
       return FALSE;
     }
@@ -93,6 +96,65 @@ class DrushMakeProject {
   }
 
   /**
+   * Retrieve translations for this project.
+   */
+  function getTranslations($project_directory) {
+    static $cache = array();
+    if ($this->name && $this->core && $this->version && in_array($this->type, array('core', 'module', 'profile', 'theme'), TRUE) && $langcodes = drush_get_option('translations', FALSE)) {
+      // Support the l10n_path, l10n_url keys from l10n_update. Note that the
+      // l10n_server key is not supported.
+      if (isset($this->l10n_path)) {
+        $update_url = $this->l10n_path;
+      }
+      else {
+        $l10n_server = isset($this->l10n_url) ? $this->l10n_url : 'http://localize.drupal.org/l10n_server.xml';
+        if (!isset($cache[$l10n_server])) {
+          $server_info = simplexml_load_string(drush_make_get_remote_file($l10n_server));
+          $cache[$l10n_server] = !empty($server_info->update_url) ? $server_info->update_url : FALSE;
+        }
+        if ($cache[$l10n_server]) {
+          $update_url = $cache[$l10n_server];
+        }
+        else {
+          drush_make_error('XML_ERROR', dt("Could not retrieve l10n update url for %project.", array('%project' => $project['name'])));
+          return FALSE;
+        }
+      }
+      if ($update_url) {
+        $langcodes = explode(',', $langcodes);
+        foreach ($langcodes as $langcode) {
+          $variables = array(
+            '%project' => $this->name,
+            '%release' => $this->type === 'core' ? $this->version : "{$this->core}-{$this->version}",
+            '%core' => $this->core,
+            '%language' => $langcode,
+            '%filename' => '%filename',
+          );
+          $url = strtr($update_url, $variables);
+
+          // Download the translation file.
+          list($filename) = array_reverse(explode('/', $url));
+          $success = drush_shell_exec('wget %s', $url);
+          $success = !$success ? drush_shell_exec('curl -f -L -O %s', $url) : $success;
+          if (file_exists($filename) && $success) {
+            drush_shell_exec('mkdir -p %s/translations', $project_directory);
+            drush_shell_exec("mv %s %s/translations", $filename, $project_directory);
+          }
+          else {
+            if (file_exists($filename)) {
+              drush_op('unlink', $filename);
+            }
+            drush_log('Unable to download ' . $filename . ' from ' . $url . '.', 'warning');
+            return FALSE;
+          }
+        }
+        drush_log('Downloaded translations for ' . $this->name, 'ok');
+      }
+    }
+    return TRUE;
+  }
+
+  /**
    * Generate the proper path for this project type.
    *
    * @param $base
Index: drush_make.test.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush_make/Attic/drush_make.test.inc,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 drush_make.test.inc
--- drush_make.test.inc	29 Jun 2010 22:04:36 -0000	1.1.2.13
+++ drush_make.test.inc	2 Sep 2010 21:04:20 -0000
@@ -82,6 +82,12 @@ function drush_make_test_get_tests($id =
       'md5'      => '272e2b9bb27794c54396f2f03c159725',
       'options'  => array(),
     ),
+    'translations' => array(
+      'name'     => 'Translation downloads',
+      'makefile' => 'tests/translations.make',
+      'md5'      => '0167ae21faf52235177a243783f89fb3',
+      'options'  => array('translations' => 'es,pt-br'),
+    ),
   );
   if (isset($id)) {
     return isset($tests[$id]) ? $tests[$id] : FALSE;
Index: tests/translations.make
===================================================================
RCS file: tests/translations.make
diff -N tests/translations.make
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/translations.make	2 Sep 2010 21:04:20 -0000
@@ -0,0 +1,7 @@
+core = 6.x
+
+projects[drupal] = 6.19
+projects[token] = 1.14
+projects[zen] = 2.0
+
+; @TODO: Add a project that uses a custom l10n_server
