You are here

interface LingotekInterfaceTranslationServiceInterface in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 4.0.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  2. 3.2.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  3. 3.3.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  4. 3.5.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  5. 3.6.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  6. 3.7.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface
  7. 3.8.x src/LingotekInterfaceTranslationServiceInterface.php \Drupal\lingotek\LingotekInterfaceTranslationServiceInterface

Service for managing Lingotek interface translations.

Hierarchy

Expanded class hierarchy of LingotekInterfaceTranslationServiceInterface

All classes that implement LingotekInterfaceTranslationServiceInterface

4 files declare their use of LingotekInterfaceTranslationServiceInterface
LingotekInterfaceTranslationClearMetadataForm.php in src/Form/LingotekInterfaceTranslationClearMetadataForm.php
LingotekInterfaceTranslationController.php in src/Controller/LingotekInterfaceTranslationController.php
LingotekInterfaceTranslationForm.php in src/Form/LingotekInterfaceTranslationForm.php
LingotekNotificationController.php in src/Controller/LingotekNotificationController.php

File

src/LingotekInterfaceTranslationServiceInterface.php, line 8

Namespace

Drupal\lingotek
View source
interface LingotekInterfaceTranslationServiceInterface {

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

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

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

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

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

  /**
   * Gets the translation status of a given component translation for a locale.
   *
   * @param string $component
   *   The component 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($component, $locale);

  /**
   * Gets the translation statuses of a given component translation for all locales.
   *
   * @param string $component
   *   The component which status we want to get.
   *
   * @return array
   *   The statuses of the target translation keyed by langcode
   *   (see Lingotek class constants for the values)
   */
  public function getTargetStatuses($component);

  /**
   * Sets the translation status of a given component translation for a locale.
   *
   * @param string $component
   *   The component which status we want to change.
   * @param string $langcode
   *   Language code which we want to modify.
   * @param int $status
   *   Status of the translation. Use Lingotek constants.
   *
   * @return string
   */
  public function setTargetStatus($component, $langcode, $status);

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

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

  /**
   * Gets the document id in the Lingotek platform for a given component.
   *
   * @param string $component
   *   The component which we want the document id.
   *
   * @return string
   *   The document id in the Lingotek platform.
   */
  public function getDocumentId($component);

  /**
   * Sets the Lingotek document id for a given component.
   *
   * @param string $component
   *   The component which we want to set a document id.
   * @param $doc_id
   *   The document id in the Lingotek platform.
   *
   * @return string
   *   The component.
   */
  public function setDocumentId($component, $doc_id);

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

  /**
   * 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 string $component
   *   The component which we want the source data.
   *
   * @return array
   */
  public function getSourceData($component);

  /**
   * Updates the component hash.
   *
   * @param string $component
   *   The component being checked.
   */
  public function updateEntityHash($component);

  /**
   * Checks if the source component data has changed from last time we uploaded it.
   *
   * @param string $component
   *   The component being checked.
   *
   * @return bool
   *   TRUE if the component has changed, false if not.
   */
  public function hasEntityChanged($component);

  /**
   * Request a translation for a given component in the given locale.
   *
   * @param string $component
   *   The component which target we want to add.
   * @param string $locale
   *   Lingotek translation language which we want to modify.
   *
   * @throws \Drupal\lingotek\Exception\LingotekPaymentRequiredException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentArchivedException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentLockedException
   * @throws \Drupal\lingotek\Exception\LingotekApiException
   */
  public function addTarget($component, $locale);

  /**
   * Requests translations of a document in all the enabled locales.
   *
   * @param string $component
   *   The component being requested for translations.
   *
   * @throws \Drupal\lingotek\Exception\LingotekPaymentRequiredException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentArchivedException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentLockedException
   * @throws \Drupal\lingotek\Exception\LingotekApiException
   */
  public function requestTranslations($component);

  /**
   * Uploads a document to the Lingotek service.
   *
   * @param string $component
   *   The component being uploaded.
   * @param string $job_id
   *   (optional) The job ID that will be associated.
   *
   * @return bool
   *   TRUE if the document was uploaded successfully, FALSE if not.
   *
   * @throws \Drupal\lingotek\Exception\LingotekPaymentRequiredException
   * @throws \Drupal\lingotek\Exception\LingotekApiException
   *
   * Propagated from @throws \Drupal\lingotek\Exception\LingotekDocumentArchivedException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentLockedException
   * @see ::updateDocument
   */
  public function uploadDocument($component, $job_id = NULL);

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

  /**
   * Resends a document to the translation service.
   *
   * @param string $component
   *   The component being updated.
   * @param string $job_id
   *   (optional) The job ID that will be associated.
   *
   * @return bool
   *   TRUE if the document was updated successfully, FALSE if not.
   *
   * @throws \Drupal\lingotek\Exception\LingotekPaymentRequiredException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentArchivedException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentLockedException
   * @throws \Drupal\lingotek\Exception\LingotekApiException
   */
  public function updateDocument($component, $job_id = NULL);

  /**
   * Downloads a document from the Lingotek service for all available locales.
   *
   * @param string $component
   *   The component being downloaded.
   *
   * @return bool
   *   TRUE if the document was downloaded successfully, FALSE if not.
   */
  public function downloadDocuments($component);

  /**
   * Cancels a document from the server.
   *
   * @param string $component
   *   The component which we want to cancel.
   *
   * @return string
   *   The component.
   */
  public function cancelDocument($component);

  /**
   * Cancels a translation for a given component in the given locale.
   *
   * @param string $component
   *   The component which target we want to cancel.
   * @param string $locale
   *   Lingotek translation language which we want to modify.
   */
  public function cancelDocumentTarget($component, $locale);

  /**
   * Deletes all local metadata related to an component.
   *
   * @param string $component
   *   The component which we want to forget about.
   *
   * @return string
   *   The component.
   */
  public function deleteMetadata($component);

  /**
   * {@inheritdoc}
   */
  public function deleteAllMetadata();

  /**
   * Loads the component with the given document id.
   *
   * @param string $document_id
   *   The document id.
   *
   * @return string
   *   The component 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 component translation.
   *
   * @param string $component
   *   The component we want to save a translation for.
   * @param $locale
   *   The locale of the translation being saved.
   * @param $data
   *   The data being saved.
   *
   * @return string
   *   Returns the component which translations are saved.
   */
  public function saveTargetData($component, $locale, $data);

  /**
   * Gets the job ID of a given component.
   *
   * @param string $component
   *   The component we want to get the job id.
   *
   * @return string
   *   Returns the job ID is saved.
   */
  public function getJobId($component);

  /**
   * Sets the job ID of a given component.
   *
   * @param string $component
   *   The component we want to save a job id for.
   * @param string $job_id
   *   The job ID being saved.
   * @param bool $update_tms
   *   (Optional) Flag indicating if the change should be communicated to the
   *   TMS. False by default.
   *
   * @return string
   *   Returns the component which job ID is saved.
   *
   * @throws \Drupal\lingotek\Exception\LingotekPaymentRequiredException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentArchivedException
   * @throws \Drupal\lingotek\Exception\LingotekDocumentLockedException
   * @throws \Drupal\lingotek\Exception\LingotekApiException
   */
  public function setJobId($component, $job_id, $update_tms = FALSE);

  /**
   * Updates the 'initial upload' time metadata to the current request time.
   *
   * @param string $component
   *   The component for which we want to update the timestamp.
   * @param int $timestamp
   *   The timestamp we want to store.
   *
   * @return string
   *   Returns the component which translations are saved.
   */
  public function setLastUploaded($component, int $timestamp);

  /**
   * Updates the 'updated date' time metadata to the current request time.
   *
   * @param string $component
   *   The component for which we want to update the timestamp.
   * @param int $timestamp
   *   The timestamp we want to store.
   *
   * @return string
   *   Returns the component which translations are saved.
   */
  public function setLastUpdated($component, int $timestamp);

  /**
   * Returns the 'initial upload' time metadata.
   *
   * @param string $component
   *   The component for which we want to get the timestamp.
   *
   * @return int
   *   Returns the unix timestamp.
   */
  public function getLastUploaded($component);

  /**
   * Returns the 'updated date' time metadata.
   *
   * @param string $component
   *   The component for which we want to get the timestamp.
   *
   * @return int
   *   Returns the unix timestamp.
   */
  public function getUpdatedTime($component);

}

Members

Namesort descending Modifiers Type Description Overrides
LingotekInterfaceTranslationServiceInterface::addTarget public function Request a translation for a given component in the given locale. 1
LingotekInterfaceTranslationServiceInterface::cancelDocument public function Cancels a document from the server. 1
LingotekInterfaceTranslationServiceInterface::cancelDocumentTarget public function Cancels a translation for a given component in the given locale. 1
LingotekInterfaceTranslationServiceInterface::checkSourceStatus public function Checks the source is uploaded correctly. 1
LingotekInterfaceTranslationServiceInterface::checkTargetStatus public function Gets the current status of the target translation. 1
LingotekInterfaceTranslationServiceInterface::checkTargetStatuses public function Gets the current status of all the target translations. 1
LingotekInterfaceTranslationServiceInterface::deleteAllMetadata public function 1
LingotekInterfaceTranslationServiceInterface::deleteMetadata public function Deletes all local metadata related to an component. 1
LingotekInterfaceTranslationServiceInterface::downloadDocument public function Downloads a document from the Lingotek service for a given locale. 1
LingotekInterfaceTranslationServiceInterface::downloadDocuments public function Downloads a document from the Lingotek service for all available locales. 1
LingotekInterfaceTranslationServiceInterface::getAllLocalDocumentIds public function Gets all local document ids. 1
LingotekInterfaceTranslationServiceInterface::getDocumentId public function Gets the document id in the Lingotek platform for a given component. 1
LingotekInterfaceTranslationServiceInterface::getJobId public function Gets the job ID of a given component. 1
LingotekInterfaceTranslationServiceInterface::getLastUploaded public function Returns the 'initial upload' time metadata. 1
LingotekInterfaceTranslationServiceInterface::getSourceData public function Returns the source data that will be uploaded to the Lingotek service. 1
LingotekInterfaceTranslationServiceInterface::getSourceLocale public function Gets the translation source locale of a given component. 1
LingotekInterfaceTranslationServiceInterface::getSourceStatus public function Gets the source status of the given component. 1
LingotekInterfaceTranslationServiceInterface::getTargetStatus public function Gets the translation status of a given component translation for a locale. 1
LingotekInterfaceTranslationServiceInterface::getTargetStatuses public function Gets the translation statuses of a given component translation for all locales. 1
LingotekInterfaceTranslationServiceInterface::getUpdatedTime public function Returns the 'updated date' time metadata. 1
LingotekInterfaceTranslationServiceInterface::hasEntityChanged public function Checks if the source component data has changed from last time we uploaded it. 1
LingotekInterfaceTranslationServiceInterface::loadByDocumentId public function Loads the component with the given document id. 1
LingotekInterfaceTranslationServiceInterface::markTranslationsAsDirty public function Marks the translation status as dirty if they exist. 1
LingotekInterfaceTranslationServiceInterface::requestTranslations public function Requests translations of a document in all the enabled locales. 1
LingotekInterfaceTranslationServiceInterface::saveTargetData public function Save the component translation. 1
LingotekInterfaceTranslationServiceInterface::setDocumentId public function Sets the Lingotek document id for a given component. 1
LingotekInterfaceTranslationServiceInterface::setJobId public function Sets the job ID of a given component. 1
LingotekInterfaceTranslationServiceInterface::setLastUpdated public function Updates the 'updated date' time metadata to the current request time. 1
LingotekInterfaceTranslationServiceInterface::setLastUploaded public function Updates the 'initial upload' time metadata to the current request time. 1
LingotekInterfaceTranslationServiceInterface::setSourceStatus public function Sets the translation status of a given component. 1
LingotekInterfaceTranslationServiceInterface::setTargetStatus public function Sets the translation status of a given component translation for a locale. 1
LingotekInterfaceTranslationServiceInterface::setTargetStatuses public function Sets the translation status of all translations of a given component. 1
LingotekInterfaceTranslationServiceInterface::updateDocument public function Resends a document to the translation service. 1
LingotekInterfaceTranslationServiceInterface::updateEntityHash public function Updates the component hash. 1
LingotekInterfaceTranslationServiceInterface::uploadDocument public function Uploads a document to the Lingotek service. 1