Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getSupportedTargetLanguages(TranslatorInterface $translator, $source_language)
 {
     $languages = tmgmt_local_supported_target_languages($source_language);
     if (\Drupal::config('tmgmt_local.settings')->get('allow_all')) {
         $languages += parent::getSupportedTargetLanguages($translator, $source_language);
     }
     return $languages;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 function checkAvailable(TranslatorInterface $translator)
 {
     if ($translator->getSetting('action') == 'not_available') {
         return AvailableResult::no(t('@translator is not available. Make sure it is properly <a href=:configured>configured</a>.', ['@translator' => $translator->label(), ':configured' => $translator->url()]));
     }
     return parent::checkAvailable($translator);
 }
 /**
  * {@inheritdoc}
  */
 public function checkTranslatable(TranslatorInterface $translator, JobInterface $job)
 {
     foreach (\Drupal::service('tmgmt.data')->filterTranslatable($job->getData()) as $value) {
         // If one of the texts in this job exceeds the max character count
         // the job can't be translated.
         if (Unicode::strlen($value['#text']) > $this->maxCharacters) {
             return TranslatableResult::no(t('The length of the job exceeds tha max character count (@count).', ['@count' => $this->maxCharacters]));
         }
     }
     return parent::checkTranslatable($translator, $job);
 }