Commit 7cffb442 authored by Mathilde Dumond's avatar Mathilde Dumond Committed by Sascha Grossenbacher
Browse files

Issue #3127040 by mathilde_dumond, mo_farhaz: BLEND rename

parent 22d218ac
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ FEATURES
  * translate the content of your site with professional translators from the
    OneHourTranslation service.
  * support a huge list of supported languages (see
    http://www.onehourtranslation.com/resources/remote-api/supported-languages)
    https://www.getblend.com/supported-languages/)


REQUIREMENTS
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class OhtController extends ControllerBase {
      }
      elseif ($event == 'project.status.update' && $request->get('project_status_code') == 'cancelled') {
        // Abort the job item.
        $job_item->setState(JobItemInterface::STATE_ABORTED, 'Aborted by One Hour Translation.');
        $job_item->setState(JobItemInterface::STATE_ABORTED, 'Aborted by BLEND.');
        $job_item->save();
      }

+4 −4
Original line number Diff line number Diff line
@@ -113,19 +113,19 @@ class OhtTranslatorUi extends TranslatorPluginUiBase {

    $form['registration_link'] = [
      '#type' => 'markup',
      '#markup' => t('To support further development of this project, use the following link when registering for an account: <a href="@url" alt="OneHourTranslation">@url</a>.', ['@url' => 'http://www.onehourtranslation.com/affiliate/mirod']),
      '#markup' => t('To support further development of this project, use the following link when registering for an account: <a href="@url" alt="BLEND">@url</a>.', ['@url' => 'http://www.getblend.com/affiliate/mirod']),
    ];
    $form['api_public_key'] = array(
      '#type' => 'textfield',
      '#title' => t('OHT API Public Key'),
      '#default_value' => $translator->getSetting('api_public_key'),
      '#description' => t('Please enter your public API key or visit <a href="@url">the API keys page</a> to get one.', ['@url' => 'https://www.onehourtranslation.com/profile/apiKeys']),
      '#description' => t('Please enter your public API key or visit <a href="@url">the API keys page</a> to get one.', ['@url' => 'https://www.getblend.com/profile/apiKeys']),
    );
    $form['api_secret_key'] = array(
      '#type' => 'textfield',
      '#title' => t('OHT API Secret key'),
      '#default_value' => $translator->getSetting('api_secret_key'),
      '#description' => t('Please enter your secret API key or visit <a href="@url">the API keys page</a> to get one.', ['@url' => 'https://www.onehourtranslation.com/profile/apiKeys']),
      '#description' => t('Please enter your secret API key or visit <a href="@url">the API keys page</a> to get one.', ['@url' => 'https://www.getblend.com/profile/apiKeys']),
    );
    $form['use_sandbox'] = array(
      '#type' => 'checkbox',
@@ -256,7 +256,7 @@ class OhtTranslatorUi extends TranslatorPluginUiBase {
  }

  /**
   * Submit callback to pull translations form OHT.
   * Submit callback to pull translations form BLEND.
   */
  public function submitPullTranslations(array $form, FormStateInterface $form_state) {
    /** @var Drupal\tmgmt\Entity\Job $job */
+6 −6
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ use Drupal\tmgmt\Translator\AvailableResult;
 *
 * @TranslatorPlugin(
 *   id = "oht",
 *   label = @Translation("One Hour Translation"),
 *   description = @Translation("One Hour Translation provides professional, fast and affordable human translation services, available 24/7."),
 *   label = @Translation("BLEND"),
 *   description = @Translation("BLEND provides professional, fast and affordable human translation services, available 24/7."),
 *   ui = "Drupal\tmgmt_oht\OhtTranslatorUi",
 *   logo = "icons/oht.svg",
 * )
@@ -564,7 +564,7 @@ class OhtTranslator extends TranslatorPluginBase implements ContainerFactoryPlug
  }

  /**
   * Creates new translation project at OHT.
   * Creates new translation project at BLEND.
   *
   * @param int $tjiid
   *   Translation job item id.
@@ -719,7 +719,7 @@ class OhtTranslator extends TranslatorPluginBase implements ContainerFactoryPlug
  }

  /**
   * Receives and stores a translation returned by OHT.
   * Receives and stores a translation returned by BLEND.
   *
   * @param array $resource_uuids
   *   The list of resource uuids.
@@ -816,7 +816,7 @@ class OhtTranslator extends TranslatorPluginBase implements ContainerFactoryPlug
        }
        elseif ($project_details['project_status_code'] == 'cancelled') {
          // Abort the job item.
          $job_item->setState(JobItemInterface::STATE_ABORTED, 'Aborted by One Hour Translation.');
          $job_item->setState(JobItemInterface::STATE_ABORTED, 'Aborted by BLEND.');
          $job_item->save();
          $not_translated++;
        }
@@ -849,7 +849,7 @@ class OhtTranslator extends TranslatorPluginBase implements ContainerFactoryPlug
      $job_item = $remote->getJobItem();
      if (!$job_item->isAborted()) {
        try {
          // Cancel the project on One Hour Translation site.
          // Cancel the project on BLEND site.
          $this->cancelProject($remote->getRemoteIdentifier1());
          // Abort the job item.
          $job_item->setState(JobItemInterface::STATE_ABORTED, 'Aborted by user.');
+4 −4
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * Mock server for Oht translator.
 * Mock server for BLEND translator.
 */
class OhtTranslatorTestController {

@@ -101,8 +101,8 @@ class OhtTranslatorTestController {
      return $error_response;
    }

    // Return a response similar to that of the Oht's API.
    /* @see https://www.onehourtranslation.com/translation/api-documentation-v2/general-instructions#get-quote */
    // Return a response similar to that of the BLEND's API.
    /* @see https://apidocs.getblend.com/#8f284774-4bad-4942-a04d-aee2af6b716a */
    $resource = new \stdClass();
    $resource->price = 1.23;
    $resource->resource = $this::SOURCE_RESOURCE_UUID;
@@ -140,7 +140,7 @@ class OhtTranslatorTestController {
    }

    // Return a response similar to that of the Oht's API.
    /* @see https://www.onehourtranslation.com/translation/api-documentation-v2/general-instructions#supported-expertise */
    /* @see https://apidocs.getblend.com/#52bfaa62-c2f4-4c79-8673-ffbf1783805e */
    $expertise_1 = new \stdClass();
    $expertise_1->name = 'Automotive / Aerospace';
    $expertise_1->code = 'automotive-aerospace';
Loading