I am trying to print from PHP the list of my updated translations, I know that I can obtain this info using drush l10n-update (I have installed the l10n-update module) from the command line but I want put this command a php script, I try to obtain the info with following codes but I can't see anything:

//this works and I can see my enabled modules
echo passthru('drush pm-list | grep "Enabled"', $o);
// I can't see anything with this
echo passthru('drush l10n-update', $o);

//this works and I can see my enabled modules
echo exec('drush pm-list | grep "Enabled"', $o); 
// I can't see anything with this
echo exec('drush l10n-update', $o); 

//this works and I can see my enabled modules
echo system('drush pm-list | grep "Enabled"');
// I can't see anything with this
echo system('drush l10n-update');

Is there any way to achieve this?

I am using Drush 5.10.0 from the repo of Ubuntu

Edit after Pierre answer:

From the command line output of drush l10n-update-status :

 Project                               Español status                 
 auto_nodetitle 7.x-1.0                Actualizado                    
 drupal 7.28                           Actualización local disponible 
 serial 7.x-1.3                        Actualizado                    
 taxonomy_container 7.x-1.1            Actualización local disponible 
 taxonomy_manager 7.x-1.0              Actualizado          

From the command line output of drush l10n-update :

Fetching update information for all projects / all languages.                                                                                      [status]
Found 2 projects to update.                                                                                                                        [status]
Actualizando traducción.                                                                                                                          [status]
Descargando e importando archivos.                                                                                                                 [status]
WD locale: Disallowed HTML detected. String not imported:                                                                                          [warning]
WD locale: Disallowed HTML detected. String not imported: En UNIX, Linux, y Mac OS X, el archivo /etc/syslog.conf define la configuración de      [warning]
enrutamiento. Los mensajes pueden ser marcados con los códigos LOG_LOCAL0 hasta LOG_LOCAL7. Para más información sobre utilerías de Syslog,
niveles de severidad y cómo definir un archivo syslog.conf, consulte, la página del manual, de la linea de comando de syslog.conf.
WD locale: Disallowed HTML detected. String not imported: OpenID sugiere el uso de cualquiera de las  GMP matemáticas (recomendado para           [warning]
rendimiento) o  bibliotecas matemáticas BC para permitir asociaciones de OpenID.
WD locale: 3 disallowed HTML string(s) in sites/all/translations/drupal-7.28.es.po                                                                 [warning]
Imported: drupal-7.28.es.po.                                                                                                                       [ok]
Imported: drupal-7.28.es.po.                                                                                                                       [ok]
Imported: taxonomy_container-7.x-1.1.es.po.                                                                                                        [ok]
Imported: taxonomy_container-7.x-1.1.es.po.                                                                                                        [ok]
2 projects updated: drupal, taxonomy_container.                                                                                                    [status]
Spanish translation strings added: 10, updated: 0, deleted: 0.
3 translation strings were skipped because they contain disallowed HTML. See Mensajes recientes del registro for details.                          [warning]

As you can see the output is different, because the command drush l10n-update runs the batch process and import the translations.

So, I test in my php script this code:

exec('drush l10n-update-status', $output) . '<br>';

echo '<pre>';
echo '</pre>'; 

And I can see the same output that come from the execution of drush l10n-update-status from the command line.

However with this code:

echo exec('drush l10n-update', $output); 

echo '<pre>';
echo '</pre>';

Nothing is printed just a empty array:


1 Answer 1


Keeping track of the various Drush version IDs is not obvious, especially when it's about "which version of Drush can be used with which version of Drupal".

But nevertheless, I think it's worth looking at "Rework drush l10n-update commands", especially Comment #9 in it, which says:

... There're two new commands. In summary they are:

  1. l10n-update-refresh
  2. l10n-update-status // prints a table
  3. l10n-update // not limited to a number of imports as before but runs the batch process.

Commands 2 and 3 accepts --languages=es,fr,de.

l10n-update also accepts --mode=keep|overwrite.

Those options are validated.

So if these commands are available in your version of Drush, I'd give it a try to use l10n-update-status instead of l10n-update. If they are not available, then maybe the patch in the comment #9 somehow helps to at least understand why it's not working yet (any maybe you can think of a way to backport it also).

  • Is a good option, at least I can see the projects that I can update, but I need get the output of drush l10n-update because this command show other info (the final state after update the translations). If you want test the commands and see the output. Jul 6, 2015 at 18:19
  • I edit the question with aditional information. Jul 6, 2015 at 18:56
  • Hm, seems like I somehow "forgot" about this question/answer ... I might come back to it tomorrow or so. For today I call it a day ... (close to midnight over here ...). Bonne nuit! Dec 7, 2015 at 22:12
  • I had some advance with your answer, but the problem don't have a solution, and I don't know why Dec 7, 2015 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.