You are here

function lingotek_delete_target_language in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_delete_target_language()
  2. 7.2 lingotek.util.inc \lingotek_delete_target_language()
  3. 7.3 lingotek.util.inc \lingotek_delete_target_language()
  4. 7.5 lingotek.util.inc \lingotek_delete_target_language()
  5. 7.6 lingotek.util.inc \lingotek_delete_target_language()

Flags a target language as active:FALSE in the Target Language tracking.

1 call to lingotek_delete_target_language()
lingotek_dashboard_command_ajax in ./lingotek.dashboard.inc
Ajax Command Processing for the Lingotek dashboard.

File

./lingotek.util.inc, line 736
Utility functions.

Code

function lingotek_delete_target_language($lingotek_locale) {
  $result = FALSE;
  if (is_string($lingotek_locale) && strlen($lingotek_locale)) {
    if (Lingotek::convertDrupal2Lingotek(language_default()->language, FALSE) != $lingotek_locale) {
      db_update('languages')
        ->fields(array(
        'enabled' => 0,
        'lingotek_enabled' => 0,
      ))
        ->condition('lingotek_locale', $lingotek_locale)
        ->execute();
      LingotekLog::info("Target language removed: @lingotek_locale", array(
        '@lingotek_locale' => $lingotek_locale,
      ));
    }

    // Removes the node sync target language entries from the lingotek table
    // and removes config chunk target language entries from lingotek_config_metadata.
    LingotekSync::deleteTargetEntriesForAllDocs($lingotek_locale);

    // Remove the Target Language from the Lingotek Project.
    $project_id = variable_get('lingotek_project', '');
    $api = LingotekApi::instance();
    $result = $api
      ->removeTranslationTarget(NULL, $project_id, $lingotek_locale);
  }
  return $result;
}