function locale_translation_load_sources
Same name in other branches
- 9 core/modules/locale/locale.translation.inc \locale_translation_load_sources()
- 10 core/modules/locale/locale.translation.inc \locale_translation_load_sources()
- 11.x core/modules/locale/locale.translation.inc \locale_translation_load_sources()
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 104
Code
function locale_translation_load_sources(array $projects = NULL, array $langcodes = NULL) {
$sources = [];
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.