locale_translation_load_sources

locale_translation_load_sources(array $projects = NULL, array $langcodes = NULL)

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

locale_translation_source_build()

File

core/modules/locale/locale.translation.inc, line 102
Common API for interface translation.

Code

function locale_translation_load_sources(array $projects = NULL, array $langcodes = NULL) {
  $sources = array();
  $projects = $projects ? $projects : array_keys(locale_translation_get_projects());
  $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list());

  // Load source data from locale_translation_status cache.
  $status = locale_translation_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;
}
doc_Drupal
2016-10-29 09:24:26
Comments
Leave a Comment

Please login to continue.