I have about 20 sites that have a common translation. I don't want to go into admin of each site each time the po-file is updated.
Is it possible to import a po-file using Drush?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have about 20 sites that have a common translation. I don't want to go into admin of each site each time the po-file is updated.
Is it possible to import a po-file using Drush?
I found a way to do this using Drush and Localization Update.
drush en l10n_update
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
de.po
for German. I've renamed it to my modules name and appended it the version of my module like: controller-7.x-1.0.de.po
. Pushed it with git and executed the drush commands. But it doesn't detect my newly pushed po-file and says 'All translations up to date'. Where am I doing wrong?
– Елин Й.
Feb 13 '14 at 10:41
project
property, otherwise the module will be ignored completely.
– thedotwriter
Nov 20 '17 at 10:24
--mode=overwrite
when running drush l10n-update
, otherwise the modifications in my .po file would not be taken into account (even if mode
is already set to overwrite
in the backend).
– thedotwriter
Nov 28 '17 at 10:23
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.
Also, the drush module Drush Language Commands has support for importing and exporting po files.
Your best bet is to use the Potx Exportables module.
It exposes Drush command drush potx-import-all
For those who lands here many years later, the same commands for Drush 9 are: