public function LingotekCliService::downloadTranslations in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 4.0.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.0.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.1.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.2.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.3.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.4.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.6.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.7.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
- 3.8.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::downloadTranslations()
File
- src/
Cli/ LingotekCliService.php, line 160
Class
Namespace
Drupal\lingotek\CliCode
public function downloadTranslations($entity_type_id, $entity_id, $langcodes = [
'all',
]) {
$entity = $this
->getEntity($entity_type_id, $entity_id);
if ($entity instanceof EntityInterface) {
if (in_array('all', $langcodes)) {
$this->translationService
->downloadDocuments($entity);
}
else {
foreach ($langcodes as $langcode) {
$locale = $this->languageLocaleMapper
->getLocaleForLangcode($langcode);
if ($locale) {
$this->translationService
->downloadDocument($entity, $locale);
}
else {
$this->logger
->error('Language %langcode is not valid.', [
'%langcode' => $langcode,
]);
}
}
}
return self::COMMAND_SUCCEDED;
}
// Contains an error message.
return $entity;
}