You are here

public function LingotekInterfaceTranslationService::markTranslationsAsDirty in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 4.0.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  2. 3.2.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  3. 3.3.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  4. 3.4.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  5. 3.5.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  6. 3.6.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()
  7. 3.7.x src/LingotekInterfaceTranslationService.php \Drupal\lingotek\LingotekInterfaceTranslationService::markTranslationsAsDirty()

Marks the translation status as dirty if they exist.

Parameters

string $component: The component which status we want to change.

Return value

string

Overrides LingotekInterfaceTranslationServiceInterface::markTranslationsAsDirty

File

src/LingotekInterfaceTranslationService.php, line 382

Class

LingotekInterfaceTranslationService
Service for managing Lingotek interface translations.

Namespace

Drupal\lingotek

Code

public function markTranslationsAsDirty($component) {
  $target_languages = $this->languageManager
    ->getLanguages();
  $source_langcode = 'en';

  // Only mark as out of date the current ones.
  $to_change = [
    Lingotek::STATUS_CURRENT,
  ];
  foreach ($target_languages as $langcode => $language) {
    if ($langcode != $source_langcode && ($current_status = $this
      ->getTargetStatus($component, $langcode))) {
      if (in_array($current_status, $to_change)) {
        $this
          ->setTargetStatus($component, $langcode, Lingotek::STATUS_PENDING);
      }
    }
  }
}