diff -u b/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php --- b/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -15,6 +15,7 @@ use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\RequirementsInterface; use Drupal\Component\Utility\NestedArray; +use Drupal\Core\StringTranslation\TranslationWrapper; /** * Defines the Migration entity. @@ -212,6 +213,36 @@ protected $entityManager; /** + * An array with the statuses as keys and labels as values. + * + * @var array + */ + protected static $statusList; + + /** + * Retrieve a translated status string.. + * + * @param integer + * One of the MigrationInterface STATUS constants. + * + * @return string + * Translated string corresponding to a STATUS_ constant. + */ + public static function getTranslatedStatus($status) { + if (!static::$statusList) { + static::$statusList = [ + static::STATUS_IDLE => new TranslationWrapper('Idle'), + static::STATUS_IMPORTING => new TranslationWrapper('Importing'), + static::STATUS_ROLLING_BACK => new TranslationWrapper('Rolling back'), + static::STATUS_STOPPING => new TranslationWrapper('Stopping'), + static::STATUS_DISABLED => new TranslationWrapper('Disabled'), + ]; + } + + return static::$statusList[$status]; + } + + /** * {@inheritdoc} */ public function getSourcePlugin() { diff -u b/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php --- b/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -100,6 +100,17 @@ const RESULT_DISABLED = 6; /** + * Retrieve a translated status string.. + * + * @param integer + * One of the MigrationInterface STATUS constants. + * + * @return string + * Translated string corresponding to a STATUS_ constant. + */ + public static function getTranslatedStatus($status); + + /** * Returns the initialized source plugin. * * @return \Drupal\migrate\Plugin\MigrateSourceInterface diff -u b/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php --- b/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -10,6 +10,7 @@ use Drupal\Core\Utility\Error; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\migrate\Entity\MigrationInterface; +use Drupal\migrate\Entity\Migration; use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\MigrateIdMapInterface; @@ -238,9 +239,11 @@ */ public function import() { // Only begin the import operation if the migration is currently idle. - if ($this->migration->getMigrationStatus() !== MigrationInterface::STATUS_IDLE) { - $this->message->display($this->t('Migration @id is busy with another operation', array( + if (($status = $this->migration->getMigrationStatus()) !== MigrationInterface::STATUS_IDLE) { + $this->message->display($this->t('Migration @id is busy with another operation: @status', + array( '@id' => $this->migration->id(), + '@status' => Migration::getTranslatedStatus($status), )), 'error'); return MigrationInterface::RESULT_FAILED; }