You are here

function l10n_update_load_sources in Localization update 7.2

Loads cached translation sources containing current translation status.

Parameters

array $projects: Array of project names. Defaults to all translatable projects.

array $langcodes: Array of language codes. Defaults to all translatable languages.

Return value

array Array of source objects. Keyed with <project name>:<language code>.

See also

l10n_update_source_build()

File

./l10n_update.translation.inc, line 103
Common API for interface translation.

Code

function l10n_update_load_sources(array $projects = NULL, array $langcodes = NULL) {
  $sources = array();
  $projects = $projects ? $projects : array_keys(l10n_update_get_projects());
  $langcodes = $langcodes ? $langcodes : array_keys(l10n_update_translatable_language_list());

  // Load source data from l10n_update_status cache.
  $status = l10n_update_get_status();

  // Use only the selected projects and languages for update.
  foreach ($projects as $project) {
    foreach ($langcodes as $langcode) {
      $sources[$project][$langcode] = isset($status[$project][$langcode]) ? $status[$project][$langcode] : NULL;
    }
  }
  return $sources;
}