Drupal - Import po-files using Drush

I found a way to do this using Drush and Localization Update.

  1. Install Localization Update drush en l10n_update
  2. Configure a local path for po-files (admin/config/regional/language/update)
  3. Configure automatic updates from remote servers or just local sources

Now you can put your own po-files in a local path (for example sites/all/translations). If you have translations for your own module then you name it according to this naming convention:

modulename-version.language.po

So a Swedish po-file for 'my_module', version 7.x-1.1 would be named:

my_module-7.x-1.1.sv.po

Now you have everything setup and you can start updating your sites translation with Drush:

drush l10n-update-refresh # Looks for new po-files
drush l10n-update # Updates translations

At the moment there's no way to do it with Drush but you can use the Localization Update module.

You could also try using Selenium IDE or a Selenium script if you have a lot of sites. This is the best solution I was able to come up with for getting translations as an exportable.

  • I say there's no way to do it with Drush because I opened a feature request in the issue queue a few weeks ago and it was closed as "won't fix" with the reason that the maintainers think such a command should be tested in the i18n or other modules first before integrating it into the Drush trunk.