You are here

function lingotek_build_locales_statuses in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lingotek.bulk_grid.inc \lingotek_build_locales_statuses()
2 calls to lingotek_build_locales_statuses()
lingotek_bulk_grid_parse_config_data in ./lingotek.config.inc
lingotek_bulk_grid_parse_table_data in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 2438

Code

function lingotek_build_locales_statuses($row, $t_prefix = TRUE) {
  $list_statuses = array(
    'none',
    'pending',
    'ready',
    'current',
    'ready_interim',
    'interim',
    'edited_interim',
    'edited',
    'untracked',
    'error',
    'archived',
    'gone',
  );
  $locales_statuses = array();
  foreach ($list_statuses as $status) {
    $key = $t_prefix ? 't_' . $status : $status;
    foreach (explode(',', $row->{$key}) as $locale) {
      if (!empty($locale)) {
        $locales_statuses[$locale] = $status;
      }
    }
  }
  if (count($locales_statuses) == 0) {
    $source_language = $row->language;
    $languages = language_list();
    foreach ($languages as $language => $value) {
      if ($language != $source_language) {
        $lingotek_locale = Lingotek::convertDrupal2Lingotek($language);
        $locales_statuses[$lingotek_locale] = LingotekSync::STATUS_NONE;
      }
    }
  }
  return $locales_statuses;
}