You are here

interface LingotekContentTranslationServiceInterface in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  2. 4.0.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  3. 3.0.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  4. 3.1.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  5. 3.2.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  6. 3.3.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  7. 3.4.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  8. 3.5.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  9. 3.6.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  10. 3.7.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface
  11. 3.8.x src/LingotekContentTranslationServiceInterface.php \Drupal\lingotek\LingotekContentTranslationServiceInterface

Service for managing Lingotek content translations.

Hierarchy

Expanded class hierarchy of LingotekContentTranslationServiceInterface

All classes that implement LingotekContentTranslationServiceInterface

10 files declare their use of LingotekContentTranslationServiceInterface
LingotekContentTypeNotificationCallbackTest.php in src/Tests/LingotekContentTypeNotificationCallbackTest.php
LingotekFieldBodyNotificationCallbackTest.php in src/Tests/LingotekFieldBodyNotificationCallbackTest.php
LingotekManagementForm.php in src/Form/LingotekManagementForm.php
Contains \Drupal\Lingotek\Form\LingotekManagementForm.
LingotekManagementFormTest.php in tests/src/Unit/Form/LingotekManagementFormTest.php
LingotekMetadataEditForm.php in src/Form/LingotekMetadataEditForm.php

... See full list

File

src/LingotekContentTranslationServiceInterface.php, line 14
Contains \Drupal\lingotek\LingotekContentTranslationServiceInterface.

Namespace

Drupal\lingotek
View source
interface LingotekContentTranslationServiceInterface {

  /**
   * Checks the source is uploaded correctly.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to check.
   *
   * @return boolean
   *   True if the entity is uploaded successfully.
   */
  public function checkSourceStatus(ContentEntityInterface &$entity);

  /**
   * Gets the source status of the given entity.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to check.
   *
   * @return int
   *   The status of the target translation (see Lingotek class constants)
   */
  public function getSourceStatus(ContentEntityInterface &$entity);

  /**
   * Sets the translation status of a given entity.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to change.
   * @param int $status
   *   Status of the translation. Use Lingotek class constants.
   *
   * @return ContentEntityInterface
   */
  public function setSourceStatus(ContentEntityInterface &$entity, $status);

  /**
   * Gets the current status of all the target translations.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to check.
   *
   */
  public function checkTargetStatuses(ContentEntityInterface &$entity);

  /**
   * Gets the current status of the target translation.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to check.
   * @param string $langcode
   *   Translation language we want to check.
   *
   * @return boolean
   *   True if the entity is uploaded succesfully.
   */
  public function checkTargetStatus(ContentEntityInterface &$entity, $langcode);

  /**
   * Gets the translation status of a given entity translation for a locale.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to get.
   * @param string $locale
   *   Lingotek translation language which we want to get.
   *
   * @return int
   *   The status of the target translation (see Lingotek class constants)
   */
  public function getTargetStatus(ContentEntityInterface &$entity, $locale);

  /**
   * Sets the translation status of a given entity translation for a locale.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to change.
   * @param string $locale
   *   Lingotek translation language which we want to modify.
   * @param int $status
   *   Status of the translation. Use Lingotek constants.
   * @param bool $save
   *   If FALSE, the entity is not saved yet. Defaults to TRUE.
   *
   * @return ContentEntityInterface
   */
  public function setTargetStatus(ContentEntityInterface &$entity, $locale, $status, $save = TRUE);

  /**
   * Sets the translation status of all translations of a given entity.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to change.
   * @param int $status
   *   Status of the translation. Use Lingotek constants.
   *
   * @return ContentEntityInterface
   */
  public function setTargetStatuses(ContentEntityInterface &$entity, $status);

  /**
   * Marks the translation status as dirty if they exist.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which status we want to change.
   *
   * @return ContentEntityInterface
   */
  public function markTranslationsAsDirty(ContentEntityInterface &$entity);

  /**
   * Gets the document id in the Lingotek platform for a given entity.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want the document id.
   *
   * @return string
   *   The document id in the Lingotek platform.
   */
  public function getDocumentId(ContentEntityInterface &$entity);

  /**
   * Sets the Lingotek document id for a given entity.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want to set a document id.
   * @param $doc_id
   *   The document id in the Lingotek platform.
   * @return ContentEntityInterface
   *   The entity.
   */
  public function setDocumentId(ContentEntityInterface &$entity, $doc_id);

  /**
   * Gets the translation source locale of a given entity.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want to get the source locale.
   *
   * @return string
   *   The locale as expected by the Lingotek service.
   */
  public function getSourceLocale(ContentEntityInterface &$entity);

  /**
   * Returns the source data that will be uploaded to the Lingotek service.
   *
   * Only those fields that have actual translatable text, and have marked for upload will
   * be included.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want the source data.
   *
   * @return mixed
   */
  public function getSourceData(ContentEntityInterface &$entity);

  /**
   * Updates the entity hash.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being checked
   *
   * @return $this
   */
  public function updateEntityHash(ContentEntityInterface $entity);

  /**
   * Checks if the source entity data has changed from last time we uploaded it.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being checked
   *
   * @return boolean
   *   TRUE if the entity has changed, false if not.
   */
  public function hasEntityChanged(ContentEntityInterface &$entity);

  /**
   * Request a translation for a given entity in the given locale.
   *
   * @param ContentEntityInterface &$entity
   *   The entity which target we want to add.
   * @param string $locale
   *   Lingotek translation language which we want to modify.
   */
  public function addTarget(ContentEntityInterface &$entity, $locale);

  /**
   * Requests translations of a document in all the enabled locales.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being requested for translations.
   */
  public function requestTranslations(ContentEntityInterface &$entity);

  /**
   * Uploads a document to the Lingotek service.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being uploaded.
   *
   * @return boolean
   *   TRUE if the document was uploaded successfully, FALSE if not.
   */
  public function uploadDocument(ContentEntityInterface $entity);

  /**
   * Downloads a document from the Lingotek service for a given locale.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being downloaded.
   * @param string $locale
   *   Lingotek translation language which we want to download.
   *
   * @return boolean
   *   TRUE if the document was downloaded successfully, FALSE if not.
   */
  public function downloadDocument(ContentEntityInterface &$entity, $locale);

  /**
   * Resends a document to the translation service.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity being updated.
   *
   * @return boolean
   *   TRUE if the document was updated successfully, FALSE if not.
   */
  public function updateDocument(ContentEntityInterface &$entity);

  /**
   * Deletes a document from the server and all related local data.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want to delete.
   *
   * @return ContentEntityInterface
   *   The entity.
   */
  public function deleteDocument(ContentEntityInterface &$entity);

  /**
   * Deletes all local metadata related to an entity.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity which we want to forget about.
   *
   * @return ContentEntityInterface
   *   The entity.
   */
  public function deleteMetadata(ContentEntityInterface &$entity);

  /**
   * Loads the entity with the given document id.
   *
   * @param string $document_id
   *   The document id.
   *
   * @return ContentEntityInterface
   *   The entity with the given document id.
   */
  public function loadByDocumentId($document_id);

  /**
   * Gets all local document ids.
   *
   * @return string[]
   *   Gets all local document ids.
   */
  public function getAllLocalDocumentIds();

  /**
   * Save the entity translation.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface &$entity
   *   The entity we want to save a translation for.
   * @param $locale
   *   The locale of the translation being saved.
   * @param $data
   *   The data being saved.
   *
   * @return ContentEntityInterface
   *   Returns the entity which translations are saved.
   */
  public function saveTargetData(ContentEntityInterface &$entity, $locale, $data);

}

Members

Namesort descending Modifiers Type Description Overrides
LingotekContentTranslationServiceInterface::addTarget public function Request a translation for a given entity in the given locale. 1
LingotekContentTranslationServiceInterface::checkSourceStatus public function Checks the source is uploaded correctly. 1
LingotekContentTranslationServiceInterface::checkTargetStatus public function Gets the current status of the target translation. 1
LingotekContentTranslationServiceInterface::checkTargetStatuses public function Gets the current status of all the target translations. 1
LingotekContentTranslationServiceInterface::deleteDocument public function Deletes a document from the server and all related local data. 1
LingotekContentTranslationServiceInterface::deleteMetadata public function Deletes all local metadata related to an entity. 1
LingotekContentTranslationServiceInterface::downloadDocument public function Downloads a document from the Lingotek service for a given locale. 1
LingotekContentTranslationServiceInterface::getAllLocalDocumentIds public function Gets all local document ids. 1
LingotekContentTranslationServiceInterface::getDocumentId public function Gets the document id in the Lingotek platform for a given entity. 1
LingotekContentTranslationServiceInterface::getSourceData public function Returns the source data that will be uploaded to the Lingotek service. 1
LingotekContentTranslationServiceInterface::getSourceLocale public function Gets the translation source locale of a given entity. 1
LingotekContentTranslationServiceInterface::getSourceStatus public function Gets the source status of the given entity. 1
LingotekContentTranslationServiceInterface::getTargetStatus public function Gets the translation status of a given entity translation for a locale. 1
LingotekContentTranslationServiceInterface::hasEntityChanged public function Checks if the source entity data has changed from last time we uploaded it. 1
LingotekContentTranslationServiceInterface::loadByDocumentId public function Loads the entity with the given document id. 1
LingotekContentTranslationServiceInterface::markTranslationsAsDirty public function Marks the translation status as dirty if they exist. 1
LingotekContentTranslationServiceInterface::requestTranslations public function Requests translations of a document in all the enabled locales. 1
LingotekContentTranslationServiceInterface::saveTargetData public function Save the entity translation. 1
LingotekContentTranslationServiceInterface::setDocumentId public function Sets the Lingotek document id for a given entity. 1
LingotekContentTranslationServiceInterface::setSourceStatus public function Sets the translation status of a given entity. 1
LingotekContentTranslationServiceInterface::setTargetStatus public function Sets the translation status of a given entity translation for a locale. 1
LingotekContentTranslationServiceInterface::setTargetStatuses public function Sets the translation status of all translations of a given entity. 1
LingotekContentTranslationServiceInterface::updateDocument public function Resends a document to the translation service. 1
LingotekContentTranslationServiceInterface::updateEntityHash public function Updates the entity hash. 1
LingotekContentTranslationServiceInterface::uploadDocument public function Uploads a document to the Lingotek service. 1