function locale_translation_get_projects

Get array of projects which are available for interface translation.

This project data contains all projects which will be checked for available interface translations.

For full functionality this function depends on Update module. When Update module is enabled the project data will contain the most recent module status; both in enabled status as in version. When Update module is disabled this function will return the last known module state. The status will only be updated once Update module is enabled.

Return value

array Array of project data for translation update. See locale_translation_build_projects() for details.

See also

locale_translation_build_projects().

2 calls to locale_translation_get_projects()
LocaleCompareTest::testLocaleCompare in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php
Test for translation status storage and translation status comparison.
locale_translation_manual_status in drupal/core/modules/locale/locale.pages.inc
Page callback: Checks for translation updates and displays the translations status.

File

drupal/core/modules/locale/locale.compare.inc, line 61
The API for comparing project translation status with available translation.

Code

function locale_translation_get_projects() {
  $projects =& drupal_static(__FUNCTION__, array());
  if (empty($projects)) {

    // Get project data from the database.
    $result = db_query('SELECT name, project_type, core, version, server_pattern, status FROM {locale_project}');

    // http://drupal.org/node/1777106 is a follow-up issue to make the check for
    // possible out-of-date project information more robust.
    if ($result
      ->rowCount() == 0 && module_exists('update')) {

      // At least the core project should be in the database, so we build the
      // data if none are found.
      locale_translation_build_projects();
      $result = db_query('SELECT name, project_type, core, version, server_pattern, status FROM {locale_project}');
    }
    foreach ($result as $project) {
      $projects[$project->name] = $project;
    }
  }
  return $projects;
}