You are here

function l10n_update_get_status in Localization update 7.2

Gets the current translation status.

@todo What is 'translation status'?

15 calls to l10n_update_get_status()
drush_l10n_update_status in ./l10n_update.drush.inc
Callback for command l10n-update-status.
L10nUpdateInterfaceTest::testInterface in tests/L10nUpdateInterfaceTest.test
Tests the user interfaces of the interface translation update system.
L10nUpdateTest::testUpdateCheckStatus in tests/L10nUpdateTest.test
Checks if local or remote translation sources are detected.
L10nUpdateTest::testUpdateImportSourceLocal in tests/L10nUpdateTest.test
Tests translation import from local sources.
L10nUpdateTest::testUpdateImportSourceRemote in tests/L10nUpdateTest.test
Tests translation import from remote sources.

... See full list

File

./l10n_update.module, line 648
Download translations from remote localization server.

Code

function l10n_update_get_status($projects = NULL, $langcodes = NULL) {
  module_load_include('translation.inc', 'l10n_update');
  $result = array();
  $cache = cache_get('l10n_update_status');
  $status = $cache ? $cache->data : array();
  $projects = $projects ? $projects : array_keys(l10n_update_get_projects());
  $langcodes = $langcodes ? $langcodes : array_keys(l10n_update_translatable_language_list());

  // Get the translation status of each project-language combination. If no
  // status was stored, a new translation source is created.
  foreach ($projects as $project) {
    foreach ($langcodes as $langcode) {
      if (isset($status[$project][$langcode])) {
        $result[$project][$langcode] = $status[$project][$langcode];
      }
      else {
        $sources = l10n_update_build_sources(array(
          $project,
        ), array(
          $langcode,
        ));
        if (isset($sources[$project][$langcode])) {
          $result[$project][$langcode] = $sources[$project][$langcode];
        }
      }
    }
  }
  return $result;
}